dj_helper_fn.py
Helper functions for manipulating information from DataJoint fetch calls.
deprecated_factory(classes, old_module='')
¶
Creates a list of classes and logs a warning when instantiated
Parameters:
Name | Type | Description | Default |
---|---|---|---|
classes |
list
|
list of tuples containing old_class, new_class |
required |
Returns:
Type | Description |
---|---|
list
|
list of classes that will log a warning when instantiated |
Source code in src/spyglass/utils/dj_helper_fn.py
dj_replace(original_table, new_values, key_column, replace_column)
¶
Given the output of a fetch() call from a schema and a 2D array made up of (key_value, replace_value) tuples, find each instance of key_value in the key_column of the original table and replace the specified replace_column with the associated replace_value. Key values must be unique.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
original_table |
Result of a datajoint .fetch() call on a schema query. |
required | |
new_values |
list
|
List of tuples, each containing (key_value, replace_value). |
required |
replace_column |
str
|
The name of the column where to-be-replaced values are located. |
required |
Returns:
Type | Description |
---|---|
original_table
|
Structured array of new table entries that can be inserted back into the schema |
Source code in src/spyglass/utils/dj_helper_fn.py
fetch_nwb(query_expression, nwb_master, *attrs, **kwargs)
¶
Get an NWB object from the given DataJoint query.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query_expression |
query
|
A DataJoint query expression (e.g., join, restrict) or a table to call fetch on. |
required |
nwb_master |
tuple
|
Tuple (table, attr) to get the NWB filepath from. i.e. absolute path to NWB file can be obtained by looking up attr column of table table is usually Nwbfile or AnalysisNwbfile; attr is usually 'nwb_file_abs_path' or 'analysis_file_abs_path' |
required |
*attrs |
list
|
Attributes from normal DataJoint fetch call. |
()
|
**kwargs |
dict
|
Keyword arguments from normal DataJoint fetch call. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
nwb_objects |
list
|
List of dicts containing fetch results and NWB objects. |