Skip to content

Commit 816a0ed

Browse files
committed
update docstrings
1 parent 643637d commit 816a0ed

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

element_array_ephys/ephys_report.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import pathlib
22
import datetime
33
import datajoint as dj
4-
import typing as T
4+
from . import probe
55

66
schema = dj.schema()
77

88
ephys = None
99

1010

1111
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.
1219
"""
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+
2021
global ephys
2122
ephys = dj.create_virtual_module("ephys", ephys_schema_name)
2223
schema.activate(
@@ -29,6 +30,14 @@ def activate(schema_name, ephys_schema_name, *, create_schema=True, create_table
2930

3031
@schema
3132
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+
3241
definition = """
3342
-> ephys.CuratedClustering
3443
shank : tinyint unsigned
@@ -38,7 +47,6 @@ class ProbeLevelReport(dj.Computed):
3847

3948
def make(self, key):
4049

41-
from . import probe
4250
from .plotting.probe_level import plot_driftmap
4351

4452
save_dir = _make_save_dir()
@@ -85,13 +93,23 @@ def make(self, key):
8593

8694
@schema
8795
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+
88106
definition = """
89107
-> ephys.CuratedClustering.Unit
90108
---
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
95113
"""
96114

97115
def make(self, key):
@@ -142,7 +160,7 @@ def _make_save_dir(root_dir: pathlib.Path = None) -> pathlib.Path:
142160

143161
def _save_figs(
144162
figs, fig_names, save_dir, fig_prefix, extension=".png"
145-
) -> T.Dict[str, pathlib.Path]:
163+
) -> dict[str, pathlib.Path]:
146164
fig_dict = {}
147165
for fig, fig_name in zip(figs, fig_names):
148166
fig_filepath = save_dir / (fig_prefix + "_" + fig_name + extension)

0 commit comments

Comments
 (0)