From f395c58a94b2704e3f0cc55eb507b69f5ec0bc27 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 11:05:29 -0400 Subject: [PATCH 1/4] Add NP1015 IMAX value for spikeglx reader --- element_array_ephys/readers/spikeglx.py | 1 + 1 file changed, 1 insertion(+) diff --git a/element_array_ephys/readers/spikeglx.py b/element_array_ephys/readers/spikeglx.py index ca60648d..692cd70f 100644 --- a/element_array_ephys/readers/spikeglx.py +++ b/element_array_ephys/readers/spikeglx.py @@ -14,6 +14,7 @@ IMAX = { "neuropixels 1.0 - 3A": 512, "neuropixels 1.0 - 3B": 512, + "NP1015": 512, "neuropixels 2.0 - SS": 8192, "neuropixels 2.0 - MS": 8192, } From 0b03b8a2ad73cf211306eb73528f9108ce84cf21 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 12:27:24 -0400 Subject: [PATCH 2/4] Implement robust IMAX value detection from IMEC file --- element_array_ephys/ephys_acute.py | 5 +---- element_array_ephys/readers/spikeglx.py | 11 ++--------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/element_array_ephys/ephys_acute.py b/element_array_ephys/ephys_acute.py index 54a322b5..bdf5b51b 100644 --- a/element_array_ephys/ephys_acute.py +++ b/element_array_ephys/ephys_acute.py @@ -180,10 +180,7 @@ def auto_generate_entries(cls, session_key): "probe_type": spikeglx_meta.probe_model, "probe": spikeglx_meta.probe_SN, } - if ( - probe_key["probe"] not in [p["probe"] for p in probe_list] - and probe_key not in probe.Probe() - ): + if probe_key["probe"] not in [p["probe"] for p in probe_list]: probe_list.append(probe_key) probe_dir = meta_filepath.parent diff --git a/element_array_ephys/readers/spikeglx.py b/element_array_ephys/readers/spikeglx.py index 692cd70f..91ba1fe9 100644 --- a/element_array_ephys/readers/spikeglx.py +++ b/element_array_ephys/readers/spikeglx.py @@ -11,13 +11,6 @@ AP_GAIN = 80 # For NP 2.0 probes; APGain = 80 for all AP (LF is computed from AP) # Imax values for different probe types - see metaguides (http://billkarsh.github.io/SpikeGLX/#metadata-guides) -IMAX = { - "neuropixels 1.0 - 3A": 512, - "neuropixels 1.0 - 3B": 512, - "NP1015": 512, - "neuropixels 2.0 - SS": 8192, - "neuropixels 2.0 - MS": 8192, -} class SpikeGLX: @@ -99,13 +92,13 @@ def get_channel_bit_volts(self, band="ap"): vmax = float(self.apmeta.meta["imAiRangeMax"]) if band == "ap": - imax = IMAX[self.apmeta.probe_model] + imax = self.apmeta.meta["imMaxInt"] imroTbl_data = self.apmeta.imroTbl["data"] imroTbl_idx = 3 chn_ind = self.apmeta.get_recording_channels_indices(exclude_sync=True) elif band == "lf": - imax = IMAX[self.lfmeta.probe_model] + imax = self.lfmeta.meta["imMaxInt"] imroTbl_data = self.lfmeta.imroTbl["data"] imroTbl_idx = 4 chn_ind = self.lfmeta.get_recording_channels_indices(exclude_sync=True) From 51b25c733d65e71117d2b2fb80fa5783c91d40e2 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 12:29:22 -0400 Subject: [PATCH 3/4] Revert merge conflict resolution change --- element_array_ephys/ephys_acute.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/element_array_ephys/ephys_acute.py b/element_array_ephys/ephys_acute.py index bdf5b51b..f93a66a4 100644 --- a/element_array_ephys/ephys_acute.py +++ b/element_array_ephys/ephys_acute.py @@ -204,10 +204,7 @@ def auto_generate_entries(cls, session_key): "probe_type": oe_probe.probe_model, "probe": oe_probe.probe_SN, } - if ( - probe_key["probe"] not in [p["probe"] for p in probe_list] - and probe_key not in probe.Probe() - ): + if probe_key["probe"] not in [p["probe"] for p in probe_list]: probe_list.append(probe_key) probe_insertion_list.append( { From b4717a9f8af55b8cc6fedbf3851a42ace43fead5 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 12:34:46 -0400 Subject: [PATCH 4/4] Update code based on review suggestion --- element_array_ephys/readers/spikeglx.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/element_array_ephys/readers/spikeglx.py b/element_array_ephys/readers/spikeglx.py index 91ba1fe9..214b70b9 100644 --- a/element_array_ephys/readers/spikeglx.py +++ b/element_array_ephys/readers/spikeglx.py @@ -11,6 +11,12 @@ AP_GAIN = 80 # For NP 2.0 probes; APGain = 80 for all AP (LF is computed from AP) # Imax values for different probe types - see metaguides (http://billkarsh.github.io/SpikeGLX/#metadata-guides) +IMAX = { + "neuropixels 1.0 - 3A": 512, + "neuropixels 1.0 - 3B": 512, + "neuropixels 2.0 - SS": 8192, + "neuropixels 2.0 - MS": 8192, +} class SpikeGLX: @@ -90,15 +96,15 @@ def get_channel_bit_volts(self, band="ap"): dataVolts = dataInt * Vmax / Imax / gain """ vmax = float(self.apmeta.meta["imAiRangeMax"]) + imax = self.apmeta.meta.get("imMaxInt") + imax = float(imax) if imax else IMAX[self.apmeta.probe_model] if band == "ap": - imax = self.apmeta.meta["imMaxInt"] imroTbl_data = self.apmeta.imroTbl["data"] imroTbl_idx = 3 chn_ind = self.apmeta.get_recording_channels_indices(exclude_sync=True) elif band == "lf": - imax = self.lfmeta.meta["imMaxInt"] imroTbl_data = self.lfmeta.imroTbl["data"] imroTbl_idx = 4 chn_ind = self.lfmeta.get_recording_channels_indices(exclude_sync=True)