From a0df46be93cf005e39463639b545cf698643cb0e Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Tue, 4 Mar 2025 17:04:13 -0600 Subject: [PATCH 1/4] update: install neo from source until 0.14.1 release --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 0ff4bf08..c08341ab 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ "openpyxl", "plotly", "seaborn", + "neo @ git+https://github.com/NeuralEnsemble/python-neo.git", # install neo from source until 0.14.1 release "spikeinterface", "scikit-image", "nbformat>=4.2.0", From ecd0cadd11b7f35a0e0317a52f8372e84add09e9 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Fri, 5 Dec 2025 14:42:24 -0600 Subject: [PATCH 2/4] feat: use three-part-make for `EphysRecording` table --- element_array_ephys/ephys.py | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/element_array_ephys/ephys.py b/element_array_ephys/ephys.py index 60ffa9b5..f43aa620 100644 --- a/element_array_ephys/ephys.py +++ b/element_array_ephys/ephys.py @@ -4,7 +4,7 @@ import pathlib import re from decimal import Decimal - +from typing import Any, Dict, List, Tuple import datajoint as dj import numpy as np import pandas as pd @@ -293,14 +293,28 @@ class EphysFile(dj.Part): file_path: varchar(255) # filepath relative to root data directory """ - def make(self, key): - """Populates table with electrophysiology recording information.""" + def make_fetch(self, key: dict) -> Tuple[pathlib.Path, str, List[str], List[str]]: + """Fetch required data from database for processing.""" session_dir = find_full_path( get_ephys_root_data_dir(), get_session_directory(key) ) inserted_probe_serial_number = (ProbeInsertion * probe.Probe & key).fetch1( "probe" ) + supported_probe_types = list(probe.ProbeType.fetch("probe_type")) + supported_acq_software = list(AcquisitionSoftware.fetch("acq_software")) + + return session_dir, inserted_probe_serial_number, supported_probe_types, supported_acq_software + + def make_compute( + self, + key: dict, + session_dir: pathlib.Path, + inserted_probe_serial_number: str, + supported_probe_types: List[str], + supported_acq_software: List[str], + ) -> Tuple[Dict[str, Any], List[Dict[str, Any]], Dict[str, Any], List[Dict[str, Any]], List[Dict[str, Any]]]: + """Populates table with electrophysiology recording information.""" # Search session dir and determine acquisition software for ephys_pattern, ephys_acq_type in ( @@ -317,13 +331,11 @@ def make(self, key): "Neither SpikeGLX nor Open Ephys recording files found" ) - if acq_software not in AcquisitionSoftware.fetch("acq_software"): + if acq_software not in supported_acq_software: raise NotImplementedError( f"Processing ephys files from acquisition software of type {acq_software} is not yet implemented." ) - supported_probe_types = probe.ProbeType.fetch("probe_type") - if acq_software == "SpikeGLX": for meta_filepath in ephys_meta_filepaths: spikeglx_meta = spikeglx.SpikeGLXMeta(meta_filepath) @@ -483,6 +495,18 @@ def make(self, key): f"Processing ephys files from acquisition software of type {acq_software} is not yet implemented." ) + return econfig_entry, econfig_electrodes, ephys_recording_entry, ephys_file_entries, ephys_channel_entries + + def make_insert( + self, + key: dict, + econfig_entry: Dict[str, Any], + econfig_electrodes: List[Dict[str, Any]], + ephys_recording_entry: Dict[str, Any], + ephys_file_entries: List[Dict[str, Any]], + ephys_channel_entries: List[Dict[str, Any]], + ) -> None: + """Insert computed data into database tables.""" # Insert into probe.ElectrodeConfig (recording configuration) if not probe.ElectrodeConfig & { "electrode_config_hash": econfig_entry["electrode_config_hash"] From 3eba39cbada0c31e71c44a6f2513e5dbaa8e8d4f Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Fri, 5 Dec 2025 15:39:45 -0600 Subject: [PATCH 3/4] fix: update probe model assignment in SpikeGLXMeta class --- element_array_ephys/readers/spikeglx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/element_array_ephys/readers/spikeglx.py b/element_array_ephys/readers/spikeglx.py index 214b70b9..1cdbd51f 100644 --- a/element_array_ephys/readers/spikeglx.py +++ b/element_array_ephys/readers/spikeglx.py @@ -281,7 +281,7 @@ def __init__(self, meta_filepath): elif probe_model == 24: self.probe_model = "neuropixels 2.0 - MS" else: - self.probe_model = str(probe_model) + self.probe_model = self.probe_PN # Get recording time self.recording_time = datetime.strptime( From aaa6e1a66b6125bbd75d9ba52257fec8c8daf6e0 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Fri, 5 Dec 2025 14:42:27 -0600 Subject: [PATCH 4/4] Merge branch 'main_external-storage' of https://github.com/dj-sciops/nei_nienborg_element-array-ephys into main_external-storage --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6c88c1e0..14366465 100644 --- a/setup.py +++ b/setup.py @@ -35,8 +35,7 @@ "openpyxl", "plotly", "seaborn", - "neo @ git+https://github.com/NeuralEnsemble/python-neo.git", # install neo from source until 0.14.1 release - "spikeinterface", + "spikeinterface @ git+https://github.com/SpikeInterface/spikeinterface.git", "scikit-image>=0.20", "nbformat>=4.2.0", "pyopenephys>=1.1.6",