1
1
import pathlib
2
2
import datetime
3
3
import datajoint as dj
4
- import typing as T
4
+ from . import probe
5
5
6
6
schema = dj .schema ()
7
7
8
8
ephys = None
9
9
10
10
11
11
def activate (schema_name , ephys_schema_name , * , create_schema = True , create_tables = True ):
12
+ """Activate the current schema.
13
+
14
+ Args:
15
+ schema_name (str): schema name on the database server to activate the `ephys_report` schema.
16
+ ephys_schema_name (str): schema name of the activated ephys element for which this ephys_report schema will be downstream from.
17
+ create_schema (bool, optional): If True (default), create schema in the database if it does not yet exist.
18
+ create_tables (bool, optional): If True (default), create tables in the database if they do not yet exist.
12
19
"""
13
- activate(schema_name, *, create_schema=True, create_tables=True, activated_ephys=None)
14
- :param schema_name: schema name on the database server to activate the `ephys_report` schema
15
- :param ephys_schema_name: schema name of the activated ephys element for which this ephys_report schema will be downstream from
16
- :param create_schema: when True (default), create schema in the database if it does not yet exist.
17
- :param create_tables: when True (default), create tables in the database if they do not yet exist.
18
- (The "activation" of this ephys_report module should be evoked by one of the ephys modules only)
19
- """
20
+
20
21
global ephys
21
22
ephys = dj .create_virtual_module ("ephys" , ephys_schema_name )
22
23
schema .activate (
@@ -29,6 +30,14 @@ def activate(schema_name, ephys_schema_name, *, create_schema=True, create_table
29
30
30
31
@schema
31
32
class ProbeLevelReport (dj .Computed ):
33
+ """Table for storing probe level figures.
34
+
35
+ Attributes:
36
+ ephys.CuratedClustering (foreign key): ephys.CuratedClustering primary key.
37
+ shank (tinyint unsigned): Shank of the probe.
38
+ drift_map_plot (attach): Figure object for drift map.
39
+ """
40
+
32
41
definition = """
33
42
-> ephys.CuratedClustering
34
43
shank : tinyint unsigned
@@ -38,7 +47,6 @@ class ProbeLevelReport(dj.Computed):
38
47
39
48
def make (self , key ):
40
49
41
- from . import probe
42
50
from .plotting .probe_level import plot_driftmap
43
51
44
52
save_dir = _make_save_dir ()
@@ -85,13 +93,23 @@ def make(self, key):
85
93
86
94
@schema
87
95
class UnitLevelReport (dj .Computed ):
96
+ """Table for storing unit level figures.
97
+
98
+ Attributes:
99
+ ephys.CuratedClustering (foreign key): ephys.CuratedClustering primary key.
100
+ ephys.ClusterQualityLabel (foreign key): ephys.ClusterQualityLabel primary key.
101
+ waveform_plotly (longblob): Figure object for unit waveform.
102
+ autocorrelogram_plotly (longblob): Figure object for an autocorrelogram.
103
+ depth_waveform_plotly (longblob): Figure object for depth waveforms.
104
+ """
105
+
88
106
definition = """
89
107
-> ephys.CuratedClustering.Unit
90
108
---
91
- cluster_quality_label : varchar(100)
92
- waveform_plotly : longblob
93
- autocorrelogram_plotly : longblob
94
- depth_waveform_plotly : longblob
109
+ -> ephys.ClusterQualityLabel
110
+ waveform_plotly : longblob
111
+ autocorrelogram_plotly : longblob
112
+ depth_waveform_plotly : longblob
95
113
"""
96
114
97
115
def make (self , key ):
@@ -142,7 +160,7 @@ def _make_save_dir(root_dir: pathlib.Path = None) -> pathlib.Path:
142
160
143
161
def _save_figs (
144
162
figs , fig_names , save_dir , fig_prefix , extension = ".png"
145
- ) -> T . Dict [str , pathlib .Path ]:
163
+ ) -> dict [str , pathlib .Path ]:
146
164
fig_dict = {}
147
165
for fig , fig_name in zip (figs , fig_names ):
148
166
fig_filepath = save_dir / (fig_prefix + "_" + fig_name + extension )
0 commit comments