From fd5e9faf17ddac4c6dc76a904e0d27e2ced3f6ae Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Wed, 10 Jan 2024 16:20:18 -0600 Subject: [PATCH 1/4] Minor fixes --- element_array_ephys/ephys_acute.py | 13 +++++++++---- element_array_ephys/ephys_no_curation.py | 6 +++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/element_array_ephys/ephys_acute.py b/element_array_ephys/ephys_acute.py index 0a213db8..cbafb194 100644 --- a/element_array_ephys/ephys_acute.py +++ b/element_array_ephys/ephys_acute.py @@ -126,7 +126,7 @@ class AcquisitionSoftware(dj.Lookup): acq_software ( varchar(24) ): Acquisition software, e.g,. SpikeGLX, OpenEphys """ - definition = """ # Software used for recording of neuropixels probes + definition = """ # Name of software used for recording of neuropixels probes - SpikeGLX or Open Ephys acq_software: varchar(24) """ contents = zip(["SpikeGLX", "Open Ephys"]) @@ -180,7 +180,10 @@ 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]: + if ( + probe_key["probe"] not in [p["probe"] for p in probe_list] + and probe_key not in probe.Probe() + ): probe_list.append(probe_key) probe_dir = meta_filepath.parent @@ -204,7 +207,10 @@ 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]: + if ( + probe_key["probe"] not in [p["probe"] for p in probe_list] + and probe_key not in probe.Probe() + ): probe_list.append(probe_key) probe_insertion_list.append( { @@ -533,7 +539,6 @@ def make(self, key): - 1 : 0 : -self._skip_channel_counts ] - # (sample x channel) lfp = oe_probe.lfp_timeseries[:, lfp_channel_ind] lfp = ( lfp * np.array(oe_probe.lfp_meta["channels_gains"])[lfp_channel_ind] diff --git a/element_array_ephys/ephys_no_curation.py b/element_array_ephys/ephys_no_curation.py index 4d052169..22b76c39 100644 --- a/element_array_ephys/ephys_no_curation.py +++ b/element_array_ephys/ephys_no_curation.py @@ -58,7 +58,6 @@ def activate( global _linking_module _linking_module = linking_module - # activate probe.activate( probe_schema_name, create_schema=create_schema, create_tables=create_tables ) @@ -315,8 +314,9 @@ def make(self, key): break else: raise FileNotFoundError( - "Ephys recording data not found!" - " Neither SpikeGLX nor Open Ephys recording files found" + f"Ephys recording data not found!" + f" Neither SpikeGLX nor Open Ephys recording files found" + f" in {session_dir}" ) supported_probe_types = probe.ProbeType.fetch("probe_type") From a3f353a7f85412b00a2a9bd4f8419fb4a307af8c Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 14:58:41 -0400 Subject: [PATCH 2/4] Fix(spikeglx): robust IMAX value detection from IMEC file --- CHANGELOG.md | 6 ++++++ element_array_ephys/readers/spikeglx.py | 4 ++-- element_array_ephys/version.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54926bd3..7cba7c56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## v0.3.7 (2024-11-01) + +### Fix + +* Fi(spikeglx): robust IMAX value detection from IMEC file + ## v0.3.6 (2024-10-01) ### Chore diff --git a/element_array_ephys/readers/spikeglx.py b/element_array_ephys/readers/spikeglx.py index ca60648d..214b70b9 100644 --- a/element_array_ephys/readers/spikeglx.py +++ b/element_array_ephys/readers/spikeglx.py @@ -96,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 = IMAX[self.apmeta.probe_model] 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] imroTbl_data = self.lfmeta.imroTbl["data"] imroTbl_idx = 4 chn_ind = self.lfmeta.get_recording_channels_indices(exclude_sync=True) diff --git a/element_array_ephys/version.py b/element_array_ephys/version.py index 008790cf..6b3c3b3f 100644 --- a/element_array_ephys/version.py +++ b/element_array_ephys/version.py @@ -1,3 +1,3 @@ """Package metadata.""" -__version__ = "0.3.6" +__version__ = "0.3.7" From 3e401f1758a1ce9523e6298ebbdadef2c59990d4 Mon Sep 17 00:00:00 2001 From: kushalbakshi Date: Fri, 1 Nov 2024 15:00:35 -0400 Subject: [PATCH 3/4] Remove merge conflict-resolution change --- element_array_ephys/ephys_acute.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/element_array_ephys/ephys_acute.py b/element_array_ephys/ephys_acute.py index 54a322b5..f93a66a4 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 @@ -207,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 4f704690c547a794e8ad94144e0bc62cb2446e0e Mon Sep 17 00:00:00 2001 From: Kushal Bakshi <52367253+kushalbakshi@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:18:50 -0400 Subject: [PATCH 4/4] Update CHANGELOG.md Co-authored-by: Thinh Nguyen --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cba7c56..ce98a10a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fix -* Fi(spikeglx): robust IMAX value detection from IMEC file +* Fix(spikeglx): robust IMAX value detection from IMEC file (metadata 3.0) ## v0.3.6 (2024-10-01)