Skip to content

Commit

Permalink
Updates for compatibility with spikeinterface version 0.101
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren M Ostrowski committed Oct 30, 2024
1 parent cc51a70 commit 3d9f5f6
Show file tree
Hide file tree
Showing 45 changed files with 18,122 additions and 5,998 deletions.
9 changes: 5 additions & 4 deletions .ipynb_checkpoints/0-reference_files-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"from ceciestunepipe.file import bcistructure as et\n",
"\n",
"sess_par = {\n",
" 'bird': 'z_r5r13_24',\n",
" 'sess': '2024-08-08'\n",
" 'bird': 'z_c7r3_24',\n",
" 'sess': '2024-10-27'\n",
"}\n",
"\n",
"rig_dict_path = et.get_exp_struct(sess_par['bird'],sess_par['sess'])['files']['rig']"
Expand All @@ -50,7 +50,8 @@
" 'microphone_M': 'adc-00',\n",
" 'microphone_F': 'adc-05',\n",
" 'wav_stim': 'adc-01',\n",
" 'wav_syn': 'adc-02'\n",
" 'wav_syn': 'adc-02',\n",
" 'opto_stim': 'adc-06'\n",
" },\n",
" 'port': {\n",
" 'probe_0': 'A-'\n",
Expand All @@ -59,7 +60,7 @@
" 'probe': {\n",
" 'probe_0': { # will always be probe_0 unless multiple recordings from different probes on the same day\n",
" 'model': 'NP2013',\n",
" 'serial': '22420013432', # update every time\n",
" 'serial': '22420015061', # update every time\n",
" 'headstage': '23280347'\n",
" }\n",
" }\n",
Expand Down
161 changes: 103 additions & 58 deletions .ipynb_checkpoints/1-preprocess_acoustics-zebra_finch-checkpoint.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

168 changes: 168 additions & 0 deletions .ipynb_checkpoints/1.3-get_IMEC_lengths-checkpoint.ipynb
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 .ipynb_checkpoints/2-curate_acoustics-checkpoint.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 3d9f5f6

Please sign in to comment.