datajoint/element-array-ephys

Add assertions to ensure relevant functions in `linking_module`

CBroz1 opened this issue · 0 comments

Currently, the schema activation function can be called with any valid module name as long as the tables already exist.

from element_array_ephys import ephys
ephys.activate(ephys_schema_name='test_ephys', probe_schema_name='test_probe', linking_module=__name__)
ephys.get_ephys_root_data_dir()  # AttributeError: module '__main__' has no attribute 'get_ephys_root_data_dir'

We could do more to check for the relevant functions on activation. For example,

assert hasattr(_linking_module, 'get_ephys_root_data_dir'), "Linking module must specify a root directory"
assert hasattr(_linking_module, 'get_session_directory'), "Linking module must specify a session directory lookup function"