Skip to content

Commit 8893fc8

Browse files
Merge pull request #7 from ttngu207/main
update docstring for function `activate`
2 parents ec58e20 + 071bf35 commit 8893fc8

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

elements_ephys/ephys.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,24 @@
1212

1313
schema = dj.schema()
1414

15-
_required_module = None
15+
_linking_module = None
1616

1717

1818
def activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True,
19-
create_tables=True, required_module=None):
19+
create_tables=True, linking_module=None):
2020
"""
21-
activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True, create_tables=True, dependency=None)
22-
:param ephys_schema_name: schema name to activate the `ephys` element
23-
:param probe_schema_name: schema name to activate the `probe` element
21+
activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True, create_tables=True, linking_module=None)
22+
:param ephys_schema_name: schema name on the database server to activate the `ephys` element
23+
:param probe_schema_name: schema name on the database server to activate the `probe` element
2424
- may be omitted if the `probe` element is already activated
25-
:param create_schema: create the schema if not yet existed (default = True)
26-
:param create_tables: create the tables if not yet existed (default = True)
27-
:param required_module: a module name or a module containing the
25+
:param create_schema: when True (default), create schema in the database if it does not yet exist.
26+
:param create_tables: when True (default), create tables in the database if they do not yet exist.
27+
:param linking_module: a module name or a module containing the
2828
required dependencies to activate the `ephys` element:
2929
Upstream tables:
3030
+ Session: parent table to ProbeInsertion, typically identifying a recording session
31-
+ SkullReference:
31+
+ SkullReference: Reference table for InsertionLocation, specifying the skull reference
32+
used for probe insertion location (e.g. Bregma, Lambda)
3233
Functions:
3334
+ get_neuropixels_data_directory(probe_insertion_key: dict) -> str
3435
Retrieve the recorded Neuropixels data directory for a given ProbeInsertion
@@ -44,17 +45,17 @@ def activate(ephys_schema_name, probe_schema_name=None, *, create_schema=True,
4445
:return: int specifying the `paramset_idx`
4546
"""
4647

47-
if isinstance(required_module, str):
48-
required_module = importlib.import_module(required_module)
49-
assert inspect.ismodule(required_module), "The argument 'dependency' must be a module's name or a module"
48+
if isinstance(linking_module, str):
49+
linking_module = importlib.import_module(linking_module)
50+
assert inspect.ismodule(linking_module), "The argument 'dependency' must be a module's name or a module"
5051

51-
global _required_module
52-
_required_module = required_module
52+
global _linking_module
53+
_linking_module = linking_module
5354

5455
# activate
5556
probe.schema.activate(probe_schema_name, create_schema=create_schema, create_tables=create_tables)
5657
schema.activate(ephys_schema_name, create_schema=create_schema,
57-
create_tables=create_tables, add_objects=_required_module.__dict__)
58+
create_tables=create_tables, add_objects=_linking_module.__dict__)
5859

5960

6061
# -------------- Functions required by the elements-ephys ---------------
@@ -67,7 +68,7 @@ def get_neuropixels_data_directory(probe_insertion_key: dict) -> str:
6768
:param probe_insertion_key: a dictionary of one ProbeInsertion `key`
6869
:return: a string for full path to the resulting Neuropixels data directory
6970
"""
70-
return _required_module.get_neuropixels_data_directory(probe_insertion_key)
71+
return _linking_module.get_neuropixels_data_directory(probe_insertion_key)
7172

7273

7374
def get_kilosort_output_directory(clustering_task_key: dict) -> str:
@@ -77,7 +78,7 @@ def get_kilosort_output_directory(clustering_task_key: dict) -> str:
7778
:param clustering_task_key: a dictionary of one ClusteringTask `key`
7879
:return: a string for full path to the resulting Kilosort output directory
7980
"""
80-
return _required_module.get_kilosort_output_directory(clustering_task_key)
81+
return _linking_module.get_kilosort_output_directory(clustering_task_key)
8182

8283

8384
def get_paramset_idx(ephys_rec_key: dict) -> int:
@@ -87,7 +88,7 @@ def get_paramset_idx(ephys_rec_key: dict) -> int:
8788
:param ephys_rec_key: a dictionary of one EphysRecording `key`
8889
:return: int specifying the `paramset_idx`
8990
"""
90-
return _required_module.get_paramset_idx(ephys_rec_key)
91+
return _linking_module.get_paramset_idx(ephys_rec_key)
9192

9293

9394
# ----------------------------- Table declarations ----------------------

elements_ephys/probe.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99

1010
def activate(schema_name, create_schema=True, create_tables=True):
11+
"""
12+
activate(schema_name, create_schema=True, create_tables=True)
13+
:param schema_name: schema name on the database server to activate the `probe` element
14+
:param create_schema: when True (default), create schema in the database if it does not yet exist.
15+
:param create_tables: when True (default), create tables in the database if they do not yet exist.
16+
"""
1117
schema.activate(schema_name, create_schema=create_schema, create_tables=create_tables)
1218

1319

0 commit comments

Comments
 (0)