-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates for compatibility with spikeinterface version 0.101
- Loading branch information
Lauren M Ostrowski
committed
Oct 30, 2024
1 parent
cc51a70
commit 3d9f5f6
Showing
45 changed files
with
18,122 additions
and
5,998 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 103 additions & 58 deletions
161
.ipynb_checkpoints/1-preprocess_acoustics-zebra_finch-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
1,023 changes: 903 additions & 120 deletions
1,023
.ipynb_checkpoints/1.1-preprocess_acoustics-zebra_finch-one_session-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
168 changes: 168 additions & 0 deletions
168
.ipynb_checkpoints/1.3-get_IMEC_lengths-checkpoint.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Look up lengths of IMEC recordings\n", | ||
"\n", | ||
"For recordings you want to concatenate, look up lengths of individual segments and stitch them together in 2-curate_acoustics\n", | ||
"\n", | ||
"Use the environment **songproc** to run this notebook" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"h5py version > 2.10.0. Some extractors might not work properly. It is recommended to downgrade to version 2.10.0: \n", | ||
">>> pip install h5py==2.10.0\n" | ||
] | ||
}, | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/mnt/cube/lo/envs/songproc/lib/python3.8/site-packages/spikeextractors/__init__.py:21: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.\n", | ||
" if StrictVersion(h5py.__version__) > '2.10.0':\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%matplotlib widget\n", | ||
"import numpy as np\n", | ||
"import sys\n", | ||
"sys.path.append('/mnt/cube/lo/envs/ceciestunepipe')\n", | ||
"from ceciestunepipe.file import bcistructure as et\n", | ||
"from ceciestunepipe.util import sglxutil as sglu\n", | ||
"from ceciestunepipe.util import sglxsync as sy\n", | ||
"from ceciestunepipe.util.spikeextractors.extractors.spikeglxrecordingextractor import spikeglxrecordingextractor as sglex" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Set parameters" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# single session params\n", | ||
"sess_par = {\n", | ||
" 'bird':'z_c7r3_24',\n", | ||
" 'sess':'2024-10-26',\n", | ||
" 'stim_sess':[], # sessions where stimuli were presented\n", | ||
" 'mic_list':['microphone_M','microphone_F'], # list of mics of interest, by signal name in rig.json\n", | ||
" 'adc_list':[], # list of adc channels of interest\n", | ||
" 'stim_list':[], # list of adc chans with the stimulus\n", | ||
" 'nidq_ttl_list':[], # list of TTL signals form the nidq digital inputs to extract (besides the 'sync')\n", | ||
" 'ref_stream':'ap_0', # what to synchronize everything to (sglx only, oe already synced)\n", | ||
" 'trial_tag_chan':2, # sglx, what was the tag channel in the stimulus wave (this should come from meta et. al)\n", | ||
" 'on_signal':1, # sglx, whether signal on is hi or lo\n", | ||
" 'sort':'sort_0', # sort index\n", | ||
" 'ephys_software':'sglx'\n", | ||
"}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"['1146_g0', '1201_g0', '1330_g0', '1403_g0', '1425_g0']\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# get epochs\n", | ||
"sess_epochs = et.list_ephys_epochs(sess_par)\n", | ||
"print(sess_epochs)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Display lengths of recordings" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Epoch 1146_g0: 27083876 samples\n", | ||
"Epoch 1201_g0: 158552049 samples\n", | ||
"Epoch 1330_g0: 13797107 samples\n", | ||
"Epoch 1403_g0: 38425270 samples\n", | ||
"Epoch 1425_g0: 235757801 samples\n", | ||
"Sampling rate: 29999.68717785555 Hz\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"for epoch in sess_epochs:\n", | ||
" sess_par['epoch'] = epoch\n", | ||
"\n", | ||
" epoch_struct = et.sgl_struct(sess_par,sess_par['epoch'],ephys_software=sess_par['ephys_software'])\n", | ||
"\n", | ||
" # get epoch files\n", | ||
" sgl_folders, sgl_files = sglu.sgl_file_struct(epoch_struct['folders']['sglx'])\n", | ||
" run_meta_files = {k:v[0] for k,v in sgl_files.items()}\n", | ||
" run_recordings = {k:sglex.SpikeGLXRecordingExtractor(sglu.get_data_meta_path(v)[0]) for k,v in run_meta_files.items()}\n", | ||
"\n", | ||
" # get streams, from raw recording extractors and preprocessed data\n", | ||
" all_streams = list(run_recordings.keys()) #+ ['wav'] ### might want to just remove this\n", | ||
" all_syn_dict = {k:sy.get_syn_pattern(run_recordings,epoch_struct,k,force=False) for k in all_streams}\n", | ||
" \n", | ||
" # display n_samples\n", | ||
" print('Epoch {}: {} samples'.format(epoch, np.shape(all_syn_dict['ap_0']['t_0'])[0]))\n", | ||
" \n", | ||
"print('Sampling rate:',all_syn_dict['ap_0']['s_f'],'Hz')" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "songproc", | ||
"language": "python", | ||
"name": "songproc" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.16" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
2,393 changes: 699 additions & 1,694 deletions
2,393
.ipynb_checkpoints/2-curate_acoustics-checkpoint.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.