From b05d39fe8f858ca05f32b3721f056ef17db1b2c8 Mon Sep 17 00:00:00 2001 From: Sam Bray Date: Wed, 24 Jan 2024 10:02:42 -0800 Subject: [PATCH] ensure that fetch1 prior to ripple selection is restricted to single entry primary key --- notebooks/32_Ripple_Detection.ipynb | 519 +++++++++++++++----- notebooks/py_scripts/32_Ripple_Detection.py | 12 +- 2 files changed, 417 insertions(+), 114 deletions(-) diff --git a/notebooks/32_Ripple_Detection.ipynb b/notebooks/32_Ripple_Detection.ipynb index 63f78c2c9..e9ac8348c 100644 --- a/notebooks/32_Ripple_Detection.ipynb +++ b/notebooks/32_Ripple_Detection.ipynb @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "fc5e9860", "metadata": {}, "outputs": [ @@ -56,8 +56,9 @@ "name": "stderr", "output_type": "stream", "text": [ - "[2023-07-28 14:45:50,776][INFO]: Connecting root@localhost:3306\n", - "[2023-07-28 14:45:50,804][INFO]: Connected root@localhost:3306\n" + "[2024-01-24 09:56:01,323][INFO]: Connecting sambray@lmf-db.cin.ucsf.edu:3306\n", + "[2024-01-24 09:56:01,355][INFO]: Connected sambray@lmf-db.cin.ucsf.edu:3306\n", + "[09:56:02][WARNING] Spyglass: Please update position_tools to >= 0.1.0\n" ] } ], @@ -115,35 +116,33 @@ "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "\u001b[0;31mSignature:\u001b[0m\n", - "\u001b[0msgrip\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRippleLFPSelection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_lfp_electrodes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n", - "\u001b[0;34m\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", - "\u001b[0;34m\u001b[0m \u001b[0melectrode_list\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", - "\u001b[0;34m\u001b[0m \u001b[0mgroup_name\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'CA1'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", - "\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", - "\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mDocstring:\u001b[0m\n", - "Removes all electrodes for the specified nwb file and then\n", - "adds back the electrodes in the list\n", - "\n", - "Parameters\n", - "----------\n", - "key : dict\n", - " dictionary corresponding to the LFPBand entry to use for\n", - " ripple detection\n", - "electrode_list : list\n", - " list of electrodes from LFPBandSelection.LFPBandElectrode\n", - " to be used as the ripple LFP during detection\n", - "group_name : str, optional\n", - " description of the electrode group, by default \"CA1\"\n", - "\u001b[0;31mFile:\u001b[0m ~/Src2/spyglass/src/spyglass/ripple/v1/ripple.py\n", - "\u001b[0;31mType:\u001b[0m function" - ] - }, - "metadata": {}, - "output_type": "display_data" + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[0;31mSignature:\u001b[0m\n", + "\u001b[0msgr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRippleLFPSelection\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_lfp_electrodes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\u001b[0m\n", + "\u001b[0;34m\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", + "\u001b[0;34m\u001b[0m \u001b[0melectrode_list\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mNone\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", + "\u001b[0;34m\u001b[0m \u001b[0mgroup_name\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'CA1'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", + "\u001b[0;34m\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\n", + "\u001b[0;34m\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mDocstring:\u001b[0m\n", + "Removes all electrodes for the specified nwb file and then\n", + "adds back the electrodes in the list\n", + "\n", + "Parameters\n", + "----------\n", + "key : dict\n", + " dictionary corresponding to the LFPBand entry to use for\n", + " ripple detection\n", + "electrode_list : list\n", + " list of electrodes from LFPBandSelection.LFPBandElectrode\n", + " to be used as the ripple LFP during detection\n", + "group_name : str, optional\n", + " description of the electrode group, by default \"CA1\"\n", + "\u001b[0;31mFile:\u001b[0m ~/Documents/spyglass/src/spyglass/ripple/v1/ripple.py\n", + "\u001b[0;31mType:\u001b[0m function" + ] } ], "source": [ @@ -187,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 10, "id": "7c9f301d-7199-4c20-b008-38a1c16f1d04", "metadata": {}, "outputs": [ @@ -515,7 +514,7 @@ " 1000 CA1_test -1 19 None " ] }, - "execution_count": 4, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -898,7 +897,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 6, "id": "0eba0656-c4dd-42bd-b18f-23aac13eb70a", "metadata": {}, "outputs": [], @@ -932,7 +931,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 11, "id": "345709c2-2892-407d-ab2d-d3fd36f67d69", "metadata": {}, "outputs": [], @@ -941,7 +940,11 @@ "\n", "lfp_band_key = (\n", " lfp_analysis.LFPBandV1()\n", - " & {\"filter_name\": filter_name, \"nwb_file_name\": nwb_file_name}\n", + " & {\n", + " \"filter_name\": filter_name,\n", + " \"nwb_file_name\": nwb_file_name,\n", + " \"lfp_band_sampling_rate\": 1000,\n", + " }\n", ").fetch1(\"KEY\")\n", "\n", "sgr.RippleLFPSelection.set_lfp_electrodes(\n", @@ -953,7 +956,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 12, "id": "96eb2aae-e93a-4214-a5e2-8c729767634b", "metadata": {}, "outputs": [ @@ -1049,41 +1052,152 @@ "

reference_elect_id

\n", " the reference electrode to use; -1 for no reference\n", " \n", - " 2f3c93d5-5d5d-2d47-75b3-c346dddbd312\n", + " 0087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "0\n", + "0\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "1\n", + "4\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "11\n", + "44\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "12\n", + "49\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", "Ripple 150-250 Hz\n", "1000\n", - "tonks20211103_.nwb\n", - "test interval\n", - "100\n", - "CA1_test\n", - "CA1_test\n", - "7\n", - "28\n", - "-12f3c93d5-5d5d-2d47-75b3-c346dddbd312\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "13\n", + "52\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "14\n", + "56\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "16\n", + "64\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "17\n", + "68\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "18\n", + "72\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", "Ripple 150-250 Hz\n", "1000\n", - "tonks20211103_.nwb\n", - "test interval\n", - "100\n", - "CA1_test\n", - "CA1_test\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "19\n", + "76\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "2\n", "8\n", - "32\n", + "-10087e094-8238-32b8-9e8d-ecb7d9352b3b\n", + "Ripple 150-250 Hz\n", + "1000\n", + "Winnie20220714_.nwb\n", + "pos 9 valid times\n", + "1000\n", + "CA1\n", + "tetrode_sample_Winnie\n", + "20\n", + "80\n", "-1 \n", " \n", - " \n", - "

Total: 2

\n", + "

...

\n", + "

Total: 60265

\n", " " ], "text/plain": [ "*lfp_merge_id *filter_name *filter_sampli *nwb_file_name *target_interv *lfp_band_samp *group_name *lfp_electrode *electrode_gro *electrode_id *reference_ele\n", "+------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+ +------------+\n", - "2f3c93d5-5d5d- Ripple 150-250 1000 tonks20211103_ test interval 100 CA1_test CA1_test 7 28 -1 \n", - "2f3c93d5-5d5d- Ripple 150-250 1000 tonks20211103_ test interval 100 CA1_test CA1_test 8 32 -1 \n", - " (Total: 2)" + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 0 0 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 1 4 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 11 44 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 12 49 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 13 52 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 14 56 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 16 64 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 17 68 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 18 72 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 19 76 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 2 8 -1 \n", + "0087e094-8238- Ripple 150-250 1000 Winnie20220714 pos 9 valid ti 1000 CA1 tetrode_sample 20 80 -1 \n", + " ...\n", + " (Total: 60265)" ] }, - "execution_count": 20, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -1103,7 +1217,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 13, "id": "a601b1ac-0d37-4215-b9c6-5797bf21a1a0", "metadata": {}, "outputs": [], @@ -1122,7 +1236,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 14, "id": "3ac90755-f6b0-434c-ab57-6177e064a5f3", "metadata": {}, "outputs": [ @@ -1192,20 +1306,24 @@ " dictionary of parameters\n", " \n", " default\n", + "=BLOB=default_ms\n", + "=BLOB=default_sharon\n", "=BLOB= \n", " \n", " \n", - "

Total: 1

\n", + "

Total: 3

\n", " " ], "text/plain": [ "*ripple_param_ ripple_par\n", "+------------+ +--------+\n", "default =BLOB= \n", - " (Total: 1)" + "default_ms =BLOB= \n", + "default_sharon =BLOB= \n", + " (Total: 3)" ] }, - "execution_count": 21, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -1225,7 +1343,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 15, "id": "837a1c8d-87b6-42d9-9cfa-787ef63f7284", "metadata": {}, "outputs": [ @@ -1242,7 +1360,7 @@ " 'close_ripple_threshold': 0.0}}}" ] }, - "execution_count": 22, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -1284,10 +1402,22 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 16, "id": "cc3c95f0-3fd0-440c-93f9-338f01a1d893", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.5.1 because version 1.6.0 is already loaded.\n", + " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'core' version 2.4.0 because version 2.6.0-alpha is already loaded.\n", + " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-experimental' version 0.2.0 because version 0.3.0 is already loaded.\n", + " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n" + ] + }, { "data": { "text/html": [ @@ -1463,7 +1593,7 @@ "[48950 rows x 6 columns]" ] }, - "execution_count": 27, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -1508,59 +1638,36 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 17, "id": "8ddee771-470f-44e4-b0ac-1d2eef60f66d", "metadata": {}, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Computing ripple times for: {'lfp_merge_id': UUID('2f3c93d5-5d5d-2d47-75b3-c346dddbd312'), 'filter_name': 'Ripple 150-250 Hz', 'filter_sampling_rate': 1000, 'nwb_file_name': 'tonks20211103_.nwb', 'target_interval_list_name': 'test interval', 'lfp_band_sampling_rate': 100, 'group_name': 'CA1_test', 'ripple_param_name': 'default', 'pos_merge_id': UUID('68959dc8-f8a3-c3c0-a534-096b3bc10f6c')}\n" - ] - }, { "name": "stderr", "output_type": "stream", "text": [ - "<__array_function__ internals>:200: RuntimeWarning: invalid value encountered in cast\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/ripple_detection/detectors.py:31: RuntimeWarning: invalid value encountered in sqrt\n", - " return np.sqrt(ripple_consensus_trace)\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.5.1 because version 1.6.0 is already loaded.\n", + "[10:01:12][INFO] Spyglass: Computing ripple times for: {'lfp_merge_id': UUID('2f3c93d5-5d5d-2d47-75b3-c346dddbd312'), 'filter_name': 'Ripple 150-250 Hz', 'filter_sampling_rate': 1000, 'nwb_file_name': 'tonks20211103_.nwb', 'target_interval_list_name': 'test interval', 'lfp_band_sampling_rate': 1000, 'group_name': 'CA1_test', 'ripple_param_name': 'default', 'pos_merge_id': UUID('68959dc8-f8a3-c3c0-a534-096b3bc10f6c')}\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-common' version 1.5.1 because version 1.6.0 is already loaded.\n", " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'core' version 2.4.0 because version 2.6.0-alpha is already loaded.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'core' version 2.4.0 because version 2.6.0-alpha is already loaded.\n", " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-experimental' version 0.2.0 because version 0.3.0 is already loaded.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/hdmf/spec/namespace.py:531: UserWarning: Ignoring cached namespace 'hdmf-experimental' version 0.2.0 because version 0.3.0 is already loaded.\n", " warn(\"Ignoring cached namespace '%s' version %s because version %s is already loaded.\"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_0' has data shape (66792, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_0' has data shape (66792, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_1' has data shape (48950, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_1' has data shape (48950, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_2' has data shape (98507, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_2' has data shape (98507, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_3' has data shape (44892, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_3' has data shape (44892, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_4' has data shape (82313, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_4' has data shape (82313, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_5' has data shape (81566, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_5' has data shape (81566, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", - "/home/dgramling/anaconda3/envs/spyglass-position3/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_6' has data shape (83811, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", - " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing new NWB file tonks20211103_6VF2MQ65RR.nwb\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/dgramling/Src2/datajoint-python/datajoint/external.py:276: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.\n", - " if check_hash:\n" + "/home/sambray/mambaforge-pypy3/envs/spyglass/lib/python3.9/site-packages/pynwb/behavior.py:46: UserWarning: SpatialSeries 'series_6' has data shape (83811, 4) which is not compliant with NWB 2.5 and greater. The second dimension should have length <= 3 to represent at most x, y, z.\n", + " warnings.warn(\"SpatialSeries '%s' has data shape %s which is not compliant with NWB 2.5 and greater. \"\n", + "[10:01:14][INFO] Spyglass: Writing new NWB file tonks20211103_41QOWS4VUO.nwb\n" ] } ], @@ -1584,7 +1691,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 18, "id": "676b05bd-e8ec-41de-9df0-a823cd90aca3", "metadata": {}, "outputs": [ @@ -1704,6 +1811,166 @@ " 1.635961e+09\n", " 1.635961e+09\n", " \n", + " \n", + " 17\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 18\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 19\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 20\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 21\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 22\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 23\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 24\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 25\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 26\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 27\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 28\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 29\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 30\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 31\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 32\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 33\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 34\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 35\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 36\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 37\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 38\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 39\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 40\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 41\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 42\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 43\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 44\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 45\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 46\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 47\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", + " \n", + " 48\n", + " 1.635961e+09\n", + " 1.635961e+09\n", + " \n", " \n", "\n", "" @@ -1727,10 +1994,42 @@ "13 1.635961e+09 1.635961e+09\n", "14 1.635961e+09 1.635961e+09\n", "15 1.635961e+09 1.635961e+09\n", - "16 1.635961e+09 1.635961e+09" + "16 1.635961e+09 1.635961e+09\n", + "17 1.635961e+09 1.635961e+09\n", + "18 1.635961e+09 1.635961e+09\n", + "19 1.635961e+09 1.635961e+09\n", + "20 1.635961e+09 1.635961e+09\n", + "21 1.635961e+09 1.635961e+09\n", + "22 1.635961e+09 1.635961e+09\n", + "23 1.635961e+09 1.635961e+09\n", + "24 1.635961e+09 1.635961e+09\n", + "25 1.635961e+09 1.635961e+09\n", + "26 1.635961e+09 1.635961e+09\n", + "27 1.635961e+09 1.635961e+09\n", + "28 1.635961e+09 1.635961e+09\n", + "29 1.635961e+09 1.635961e+09\n", + "30 1.635961e+09 1.635961e+09\n", + "31 1.635961e+09 1.635961e+09\n", + "32 1.635961e+09 1.635961e+09\n", + "33 1.635961e+09 1.635961e+09\n", + "34 1.635961e+09 1.635961e+09\n", + "35 1.635961e+09 1.635961e+09\n", + "36 1.635961e+09 1.635961e+09\n", + "37 1.635961e+09 1.635961e+09\n", + "38 1.635961e+09 1.635961e+09\n", + "39 1.635961e+09 1.635961e+09\n", + "40 1.635961e+09 1.635961e+09\n", + "41 1.635961e+09 1.635961e+09\n", + "42 1.635961e+09 1.635961e+09\n", + "43 1.635961e+09 1.635961e+09\n", + "44 1.635961e+09 1.635961e+09\n", + "45 1.635961e+09 1.635961e+09\n", + "46 1.635961e+09 1.635961e+09\n", + "47 1.635961e+09 1.635961e+09\n", + "48 1.635961e+09 1.635961e+09" ] }, - "execution_count": 33, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -1753,9 +2052,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python [conda env:spyglass-position3] *", + "display_name": "spyglass", "language": "python", - "name": "conda-env-spyglass-position3-py" + "name": "python3" }, "language_info": { "codemirror_mode": { diff --git a/notebooks/py_scripts/32_Ripple_Detection.py b/notebooks/py_scripts/32_Ripple_Detection.py index de6a046cc..652795939 100644 --- a/notebooks/py_scripts/32_Ripple_Detection.py +++ b/notebooks/py_scripts/32_Ripple_Detection.py @@ -5,11 +5,11 @@ # extension: .py # format_name: light # format_version: '1.5' -# jupytext_version: 1.16.0 +# jupytext_version: 1.15.2 # kernelspec: -# display_name: Python [conda env:spyglass-position3] * +# display_name: spyglass # language: python -# name: conda-env-spyglass-position3-py +# name: python3 # --- # # Ripple Detection @@ -131,7 +131,11 @@ lfp_band_key = ( lfp_analysis.LFPBandV1() - & {"filter_name": filter_name, "nwb_file_name": nwb_file_name} + & { + "filter_name": filter_name, + "nwb_file_name": nwb_file_name, + "lfp_band_sampling_rate": 1000, + } ).fetch1("KEY") sgr.RippleLFPSelection.set_lfp_electrodes(