2121_linking_module = None
2222
2323
24- def activate (ephys_schema_name , probe_schema_name = None , * , create_schema = True ,
25- create_tables = True , linking_module = None ):
24+ def activate (
25+ ephys_schema_name : str ,
26+ probe_schema_name : str = None ,
27+ * ,
28+ create_schema : bool = True ,
29+ create_tables : bool = True ,
30+ linking_module : str = None ,
31+ ):
2632 """Activates the `ephys` and `probe` schemas.
2733
2834 Args:
@@ -31,6 +37,17 @@ def activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True,
3137 create_schema (bool): If True, schema will be created in the database.
3238 create_tables (bool): If True, tables related to the schema will be created in the database.
3339 linking_module (str): A string containing the module name or module containing the required dependencies to activate the schema.
40+
41+ Dependencies:
42+
43+ Upstream tables:
44+ Session: A parent table to ProbeInsertion
45+ Probe: A parent table to EphysRecording. Probe information is required before electrophysiology data is imported.
46+
47+ Functions:
48+ get_ephys_root_data_dir(): Returns absolute path for root data director(y/ies) with all electrophysiological recording sessions, as a list of string(s).
49+ get_session_direction(session_key: dict): Returns path to electrophysiology data for the a particular session as a list of strings.
50+ get_processed_data_dir(): Optional. Returns absolute path for processed data. Defaults to root directory.
3451 """
3552
3653 if isinstance (linking_module , str ):
@@ -71,7 +88,8 @@ def get_session_directory(session_key: dict) -> str:
7188 """Retrieve the session directory with Neuropixels for the given session.
7289
7390 Args:
74- session_key (dict): A dictionary mapping subject to an entry in the subject table, and session_datetime corresponding to a session in the database.
91+ session_key (dict): A dictionary mapping subject to an entry in the subject table, and session_datetime corresponding to a session in the database.
92+
7593 Returns:
7694 A string for the path to the session directory.
7795 """
@@ -216,8 +234,8 @@ class EphysRecording(dj.Imported):
216234
217235 Attributes:
218236 ProbeInsertion (foreign key): ProbeInsertion primary key.
219- probe.ElectrodeConfig (query ): probe.ElectrodeConfig primary key.
220- AcquisitionSoftware (query ): AcquisitionSoftware primary key.
237+ probe.ElectrodeConfig (dict ): probe.ElectrodeConfig primary key.
238+ AcquisitionSoftware (dict ): AcquisitionSoftware primary key.
221239 sampling_rate (float): sampling rate of the recording in Hertz (Hz).
222240 recording_datetime (datetime): datetime of the recording from this probe.
223241 recording_duration (float): duration of the entire recording from this probe in seconds.
@@ -238,7 +256,7 @@ class EphysFile(dj.Part):
238256 """Paths of electrophysiology recording files for each insertion.
239257
240258 Attributes:
241- master (foreign key): EphysRecording primary key.
259+ EphysRecording (foreign key): EphysRecording primary key.
242260 file_path (varchar(255) ): relative file path for electrophysiology recording.
243261 """
244262
@@ -384,7 +402,7 @@ class Electrode(dj.Part):
384402 """Saves local field potential data for each electrode.
385403
386404 Attributes:
387- master (foreign key): LFP primary key.
405+ LFP (foreign key): LFP primary key.
388406 probe.ElectrodeConfig.Electrode (foreign key): probe.ElectrodeConfig.Electrode primary key.
389407 lfp (longblob): LFP recording at this electrode in microvolts.
390408 """
@@ -496,7 +514,7 @@ class ClusteringParamSet(dj.Lookup):
496514
497515 Attributes:
498516 paramset_idx (foreign key): Unique ID for the clustering parameter set.
499- ClusteringMethod (query ): ClusteringMethod primary key.
517+ ClusteringMethod (dict ): ClusteringMethod primary key.
500518 paramset_desc (varchar(128) ): Description of the clustering parameter set.
501519 param_set_hash (uuid): UUID hash for the parameter set.
502520 params (longblob)
@@ -583,7 +601,7 @@ class ClusteringTask(dj.Manual):
583601 EphysRecording (foreign key): EphysRecording primary key.
584602 ClusteringParamSet (foreign key): ClusteringParamSet primary key.
585603 clustering_outdir_dir (varchar (255) ): Relative path to output clustering results.
586- task_mode (enum('load', 'trigger') ): Either loads or computes clustering.
604+ task_mode (enum): `Trigger` and `load` either computes clustering or imports existing clustering data, respectively .
587605 """
588606
589607 definition = """
@@ -596,7 +614,7 @@ class ClusteringTask(dj.Manual):
596614 """
597615
598616 @classmethod
599- def infer_output_dir (cls , key , relative = False , mkdir = False ):
617+ def infer_output_dir (cls , key : dict , relative : bool = False , mkdir : bool = False ):
600618 """Infer output directory if it is not provided.
601619
602620 Args:
@@ -626,7 +644,7 @@ def infer_output_dir(cls, key, relative=False, mkdir=False):
626644 return output_dir .relative_to (processed_dir ) if relative else output_dir
627645
628646 @classmethod
629- def auto_generate_entries (cls , ephys_recording_key , paramset_idx = 0 ):
647+ def auto_generate_entries (cls , ephys_recording_key : dict , paramset_idx : int = 0 ):
630648 """Autogenerate entries based on a particular ephys recording.
631649
632650 Args:
@@ -822,10 +840,10 @@ class Unit(dj.Part):
822840 """Single unit properties after clustering and curation.
823841
824842 Attributes:
825- master (foreign key): CuratedClustering primary key.
843+ CuratedClustering (foreign key): CuratedClustering primary key.
826844 unit (foreign key, int): Unique integer identifying a single unit.
827- probe.ElectrodeConfig.Electrode (query ): probe.ElectrodeConfig.Electrode primary key.
828- ClusteringQualityLabel (query ): CLusteringQualityLabel primary key.
845+ probe.ElectrodeConfig.Electrode (dict ): probe.ElectrodeConfig.Electrode primary key.
846+ ClusteringQualityLabel (dict ): CLusteringQualityLabel primary key.
829847 spike_count (int): Number of spikes in this recording for this unit.
830848 spike_times (longblob): Spike times of this unit, relative to start time of EphysRecording.
831849 spike_sites (longblob): Array of electrode associated with each spike.
@@ -918,7 +936,7 @@ class PeakWaveform(dj.Part):
918936 """Mean waveform across spikes for a given unit.
919937
920938 Attributes:
921- master (foreign key): WaveformSet primary key.
939+ WaveformSet (foreign key): WaveformSet primary key.
922940 CuratedClustering.Unit (foreign key): CuratedClustering.Unit primary key.
923941 peak_electrode_waveform (longblob): Mean waveform for a given unit at its representative electrode.
924942 """
@@ -935,7 +953,7 @@ class Waveform(dj.Part):
935953 """Spike waveforms for a given unit.
936954
937955 Attributes:
938- master (foreign key): WaveformSet primary key.
956+ WaveformSet (foreign key): WaveformSet primary key.
939957 CuratedClustering.Unit (foreign key): CuratedClustering.Unit primary key.
940958 probe.ElectrodeConfig.Electrode (foreign key): probe.ElectrodeConfig.Electrode primary key.
941959 waveform_mean (longblob): mean waveform across spikes of the unit in microvolts.
@@ -1051,7 +1069,7 @@ class Cluster(dj.Part):
10511069 """Cluster metrics for a unit.
10521070
10531071 Attributes:
1054- master (foreign key): QualityMetrics primary key.
1072+ QualityMetrics (foreign key): QualityMetrics primary key.
10551073 CuratedClustering.Unit (foreign key): CuratedClustering.Unit primary key.
10561074 firing_rate (float): Firing rate of the unit.
10571075 snr (float): Signal-to-noise ratio for a unit.
@@ -1095,7 +1113,7 @@ class Waveform(dj.Part):
10951113 """Waveform metrics for a particular unit.
10961114
10971115 Attributes:
1098- master (foreign key): QualityMetrics primary key.
1116+ QualityMetrics (foreign key): QualityMetrics primary key.
10991117 CuratedClustering.Unit (foreign key): CuratedClustering.Unit primary key.
11001118 amplitude (float): Absolute difference between waveform peak and trough in microvolts.
11011119 duration (float): Time between waveform peak and trough in milliseconds.
@@ -1150,7 +1168,7 @@ def make(self, key):
11501168
11511169# ---------------- HELPER FUNCTIONS ----------------
11521170
1153- def get_spikeglx_meta_filepath (ephys_recording_key ) :
1171+ def get_spikeglx_meta_filepath (ephys_recording_key : dict ) -> str :
11541172 """Get spikeGLX data filepath.
11551173 """
11561174 # attempt to retrieve from EphysRecording.EphysFile
@@ -1187,7 +1205,7 @@ def get_spikeglx_meta_filepath(ephys_recording_key):
11871205 return spikeglx_meta_filepath
11881206
11891207
1190- def get_openephys_probe_data (ephys_recording_key ) :
1208+ def get_openephys_probe_data (ephys_recording_key : dict ) -> list :
11911209 """Get OpenEphys probe data from file.
11921210 """
11931211 inserted_probe_serial_number = (ProbeInsertion * probe .Probe
@@ -1205,7 +1223,7 @@ def get_openephys_probe_data(ephys_recording_key):
12051223 return probe_data
12061224
12071225
1208- def get_neuropixels_channel2electrode_map (ephys_recording_key , acq_software ) :
1226+ def get_neuropixels_channel2electrode_map (ephys_recording_key : dict , acq_software : str ) -> dict :
12091227 """Get the channel map for neuropixels probe.
12101228 """
12111229 if acq_software == 'SpikeGLX' :
@@ -1243,12 +1261,13 @@ def get_neuropixels_channel2electrode_map(ephys_recording_key, acq_software):
12431261 return channel2electrode_map
12441262
12451263
1246- def generate_electrode_config (probe_type : str , electrodes : list ):
1264+ def generate_electrode_config (probe_type : str , electrodes : list ) -> dict :
12471265 """Generate and insert new ElectrodeConfig
12481266
12491267 Args:
12501268 probe_type (str): probe type (e.g. neuropixels 2.0 - SS)
12511269 electrodes (list): Electrode dict (keys of the probe.ProbeType.Electrode table)
1270+
12521271 Returns:
12531272 dict: representing a key of the probe.ElectrodeConfig table
12541273 """
@@ -1275,8 +1294,8 @@ def generate_electrode_config(probe_type: str, electrodes: list):
12751294 return electrode_config_key
12761295
12771296
1278- def get_recording_channels_details (ephys_recording_key ) :
1279- """Get details of recording channels for a givenn recording.
1297+ def get_recording_channels_details (ephys_recording_key : dict ) -> np . array :
1298+ """Get details of recording channels for a given recording.
12801299 """
12811300 channels_details = {}
12821301
0 commit comments