eegdash 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of eegdash might be problematic. Click here for more details.
- eegdash/SignalStore/__init__.py +0 -0
- eegdash/SignalStore/signalstore/__init__.py +3 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/abstract_read_adapter.py +13 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/domain_modeling/schema_read_adapter.py +16 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/domain_modeling/vocabulary_read_adapter.py +19 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/handmade_records/excel_study_organizer_read_adapter.py +114 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/axona/axona_read_adapter.py +912 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/ReadIntanSpikeFile.py +140 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/intan_read_adapter.py +29 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/__init__.py +0 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/data_to_result.py +62 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/get_bytes_per_data_block.py +36 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/notch_filter.py +50 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/qstring.py +41 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/read_header.py +135 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/intanutil/read_one_data_block.py +45 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhd_format/load_intan_rhd_format.py +204 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/__init__.py +0 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/data_to_result.py +60 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/get_bytes_per_data_block.py +37 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/notch_filter.py +50 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/qstring.py +41 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/read_header.py +153 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/intanutil/read_one_data_block.py +47 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/intan/load_intan_rhs_format/load_intan_rhs_format.py +213 -0
- eegdash/SignalStore/signalstore/adapters/read_adapters/recording_acquisitions/neurodata_without_borders/neurodata_without_borders_read_adapter.py +14 -0
- eegdash/SignalStore/signalstore/operations/__init__.py +4 -0
- eegdash/SignalStore/signalstore/operations/handler_executor.py +22 -0
- eegdash/SignalStore/signalstore/operations/handler_factory.py +41 -0
- eegdash/SignalStore/signalstore/operations/handlers/base_handler.py +44 -0
- eegdash/SignalStore/signalstore/operations/handlers/domain/property_model_handlers.py +79 -0
- eegdash/SignalStore/signalstore/operations/handlers/domain/schema_handlers.py +3 -0
- eegdash/SignalStore/signalstore/operations/helpers/abstract_helper.py +17 -0
- eegdash/SignalStore/signalstore/operations/helpers/neuroscikit_extractor.py +33 -0
- eegdash/SignalStore/signalstore/operations/helpers/neuroscikit_rawio.py +165 -0
- eegdash/SignalStore/signalstore/operations/helpers/spikeinterface_helper.py +100 -0
- eegdash/SignalStore/signalstore/operations/helpers/wrappers/neo_wrappers.py +21 -0
- eegdash/SignalStore/signalstore/operations/helpers/wrappers/nwb_wrappers.py +27 -0
- eegdash/SignalStore/signalstore/store/__init__.py +8 -0
- eegdash/SignalStore/signalstore/store/data_access_objects.py +1181 -0
- eegdash/SignalStore/signalstore/store/datafile_adapters.py +131 -0
- eegdash/SignalStore/signalstore/store/repositories.py +928 -0
- eegdash/SignalStore/signalstore/store/store_errors.py +68 -0
- eegdash/SignalStore/signalstore/store/unit_of_work.py +97 -0
- eegdash/SignalStore/signalstore/store/unit_of_work_provider.py +67 -0
- eegdash/SignalStore/signalstore/utilities/data_adapters/spike_interface_adapters/si_recording.py +1 -0
- eegdash/SignalStore/signalstore/utilities/data_adapters/spike_interface_adapters/si_sorter.py +1 -0
- eegdash/SignalStore/signalstore/utilities/testing/data_mocks.py +513 -0
- eegdash/SignalStore/signalstore/utilities/tools/dataarrays.py +49 -0
- eegdash/SignalStore/signalstore/utilities/tools/mongo_records.py +25 -0
- eegdash/SignalStore/signalstore/utilities/tools/operation_response.py +78 -0
- eegdash/SignalStore/signalstore/utilities/tools/purge_orchestration_response.py +21 -0
- eegdash/SignalStore/signalstore/utilities/tools/quantities.py +15 -0
- eegdash/SignalStore/signalstore/utilities/tools/strings.py +38 -0
- eegdash/SignalStore/signalstore/utilities/tools/time.py +17 -0
- eegdash/SignalStore/tests/conftest.py +799 -0
- eegdash/SignalStore/tests/data/valid_data/data_arrays/make_fake_data.py +59 -0
- eegdash/SignalStore/tests/unit/store/conftest.py +0 -0
- eegdash/SignalStore/tests/unit/store/test_data_access_objects.py +1235 -0
- eegdash/SignalStore/tests/unit/store/test_repositories.py +1309 -0
- eegdash/SignalStore/tests/unit/store/test_unit_of_work.py +7 -0
- eegdash/SignalStore/tests/unit/test_ci_cd.py +8 -0
- eegdash/__init__.py +1 -0
- eegdash/aws_ingest.py +29 -0
- eegdash/data_utils.py +213 -0
- eegdash/main.py +17 -0
- eegdash/signalstore_data_utils.py +280 -0
- eegdash-0.0.1.dist-info/LICENSE +20 -0
- eegdash-0.0.1.dist-info/METADATA +72 -0
- eegdash-0.0.1.dist-info/RECORD +72 -0
- eegdash-0.0.1.dist-info/WHEEL +5 -0
- eegdash-0.0.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Base Errors for the Store
|
|
2
|
+
|
|
3
|
+
class StoreError(Exception):
|
|
4
|
+
"""
|
|
5
|
+
Base class for all store errors
|
|
6
|
+
"""
|
|
7
|
+
pass
|
|
8
|
+
|
|
9
|
+
# Specific Base Errors for the Store
|
|
10
|
+
# These are used to make polymorphisms
|
|
11
|
+
# for the Data Access Objects and Repositories
|
|
12
|
+
# so that error typing is consistent across
|
|
13
|
+
# data layers
|
|
14
|
+
|
|
15
|
+
class NotFoundError(StoreError):
|
|
16
|
+
"""
|
|
17
|
+
Raised when a resource is not found
|
|
18
|
+
"""
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
class AlreadyExistsError(StoreError):
|
|
22
|
+
"""
|
|
23
|
+
Raised when a resource already exists
|
|
24
|
+
"""
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
class RangeError(StoreError):
|
|
28
|
+
"""
|
|
29
|
+
Raised when a resource is out of range
|
|
30
|
+
"""
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
class ValidationError(StoreError):
|
|
34
|
+
"""
|
|
35
|
+
Raised when a resource fails validation
|
|
36
|
+
"""
|
|
37
|
+
pass
|
|
38
|
+
|
|
39
|
+
class ArgumentTypeError(StoreError):
|
|
40
|
+
"""
|
|
41
|
+
Raised when a resource fails validation
|
|
42
|
+
"""
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
class ArgumentNameError(StoreError):
|
|
46
|
+
"""
|
|
47
|
+
Raised when a resource fails validation
|
|
48
|
+
"""
|
|
49
|
+
pass
|
|
50
|
+
|
|
51
|
+
class ArgumentValueError(StoreError):
|
|
52
|
+
"""
|
|
53
|
+
Raised when a resource fails validation
|
|
54
|
+
"""
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
class ConfigError(StoreError):
|
|
58
|
+
"""
|
|
59
|
+
Raised when a resource fails validation
|
|
60
|
+
"""
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
class UncaughtError(StoreError):
|
|
64
|
+
"""
|
|
65
|
+
Raised when a resource fails validation
|
|
66
|
+
"""
|
|
67
|
+
pass
|
|
68
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
|
|
5
|
+
import xarray as xr
|
|
6
|
+
|
|
7
|
+
class AbstractUnitOfWork(ABC):
|
|
8
|
+
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def __enter__(self):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def __exit__(self, type, value, traceback):
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
@abstractmethod
|
|
18
|
+
def commit(self):
|
|
19
|
+
pass
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def rollback(self):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
class UnitOfWorkContextError(Exception):
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
class UnitOfWork:
|
|
29
|
+
def __init__(self, domain_model_repo, data_repo, in_memory_object_repo):
|
|
30
|
+
self._domain_models = domain_model_repo
|
|
31
|
+
self._data = data_repo
|
|
32
|
+
self._memory = in_memory_object_repo
|
|
33
|
+
self._in_context = False
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def domain_models(self):
|
|
37
|
+
if not self._in_context:
|
|
38
|
+
raise UnitOfWorkContextError("You must use a UnitOfWork as a context manager, i.e. use 'with unit_of_work as uow:'")
|
|
39
|
+
return self._domain_models
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def data(self):
|
|
43
|
+
if not self._in_context:
|
|
44
|
+
raise UnitOfWorkContextError("You must use a UnitOfWork as a context manager, i.e. use 'with unit_of_work as uow:'")
|
|
45
|
+
return self._data
|
|
46
|
+
|
|
47
|
+
@property
|
|
48
|
+
def memory(self):
|
|
49
|
+
if not self._in_context:
|
|
50
|
+
raise UnitOfWorkContextError("You must use a UnitOfWork as a context manager, i.e. use 'with unit_of_work as uow:'")
|
|
51
|
+
return self._memory
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def in_conxtext(self):
|
|
55
|
+
return self._in_context
|
|
56
|
+
|
|
57
|
+
def __enter__(self):
|
|
58
|
+
# reset the operations history for each repository
|
|
59
|
+
self._in_context = True
|
|
60
|
+
self._clear_operation_history()
|
|
61
|
+
return self
|
|
62
|
+
|
|
63
|
+
def __exit__(self, type, value, traceback):
|
|
64
|
+
self.rollback()
|
|
65
|
+
self._in_context = False
|
|
66
|
+
|
|
67
|
+
def rollback(self):
|
|
68
|
+
self.domain_models.undo_all()
|
|
69
|
+
self.data.undo_all()
|
|
70
|
+
self.memory.undo_all()
|
|
71
|
+
|
|
72
|
+
def commit(self):
|
|
73
|
+
operations = self._get_all_operations()
|
|
74
|
+
self._clear_operation_history()
|
|
75
|
+
return operations
|
|
76
|
+
|
|
77
|
+
def purge(self, time_threshold=None):
|
|
78
|
+
self.domain_models.purge(time_threshold)
|
|
79
|
+
self.data.purge(time_threshold)
|
|
80
|
+
self.memory.purge(time_threshold)
|
|
81
|
+
|
|
82
|
+
def _clear_operation_history(self):
|
|
83
|
+
self.domain_models.clear_operation_history()
|
|
84
|
+
self.data.clear_operation_history()
|
|
85
|
+
self.memory.clear_operation_history()
|
|
86
|
+
|
|
87
|
+
def _get_all_operations(self):
|
|
88
|
+
# (timestamp, report{operation, kwargs, result})
|
|
89
|
+
# TODO document operation_history entries more clearly
|
|
90
|
+
return {
|
|
91
|
+
'domain_models': self.domain_models._operation_history,
|
|
92
|
+
'data': self.data._operation_history,
|
|
93
|
+
'memory': self.memory._operation_history,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
from eegdash.SignalStore.signalstore.store.data_access_objects import (
|
|
2
|
+
MongoDAO,
|
|
3
|
+
FileSystemDAO,
|
|
4
|
+
InMemoryObjectDAO,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from eegdash.SignalStore.signalstore.store.repositories import (
|
|
8
|
+
DomainModelRepository,
|
|
9
|
+
DataRepository,
|
|
10
|
+
InMemoryObjectRepository
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from eegdash.SignalStore.signalstore.store.datafile_adapters import (
|
|
14
|
+
AbstractDataFileAdapter,
|
|
15
|
+
XarrayDataArrayNetCDFAdapter,
|
|
16
|
+
XarrayDataArrayZarrAdapter
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
from eegdash.SignalStore.signalstore.store.unit_of_work import UnitOfWork
|
|
21
|
+
|
|
22
|
+
class UnitOfWorkProvider:
|
|
23
|
+
def __init__(self, mongo_client, filesystem, memory_store, default_filetype='netcdf'):
|
|
24
|
+
self._mongo_client = mongo_client
|
|
25
|
+
self._filesystem = filesystem
|
|
26
|
+
self._memory_store = memory_store
|
|
27
|
+
self._default_file_type = default_filetype
|
|
28
|
+
self._file_adapter_options = {
|
|
29
|
+
'netcdf': XarrayDataArrayNetCDFAdapter(),
|
|
30
|
+
'zarr': XarrayDataArrayZarrAdapter()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def __call__(self, project_name):
|
|
34
|
+
if not isinstance(project_name, str):
|
|
35
|
+
raise ValueError("project_name must be a string")
|
|
36
|
+
model_dao = MongoDAO(client=self._mongo_client,
|
|
37
|
+
database_name=project_name,
|
|
38
|
+
collection_name='domain_models',
|
|
39
|
+
index_fields=['schema_name'])
|
|
40
|
+
|
|
41
|
+
record_dao = MongoDAO(client=self._mongo_client,
|
|
42
|
+
database_name=project_name,
|
|
43
|
+
collection_name='records',
|
|
44
|
+
index_fields=['schema_ref', 'data_name', 'version_timestamp']
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
file_system_dao = FileSystemDAO(
|
|
48
|
+
filesystem=self._filesystem,
|
|
49
|
+
project_dir=project_name,
|
|
50
|
+
default_data_adapter=self._file_adapter_options[self._default_file_type]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
in_memory_object_dao = InMemoryObjectDAO(memory_store=self._memory_store)
|
|
54
|
+
|
|
55
|
+
domain_model_repo = DomainModelRepository(model_dao=model_dao)
|
|
56
|
+
|
|
57
|
+
data_repo = DataRepository(record_dao=record_dao,
|
|
58
|
+
file_dao=file_system_dao,
|
|
59
|
+
domain_repo=domain_model_repo)
|
|
60
|
+
|
|
61
|
+
in_memory_object_repo = InMemoryObjectRepository(memory_dao=in_memory_object_dao)
|
|
62
|
+
|
|
63
|
+
return UnitOfWork(
|
|
64
|
+
domain_model_repo=domain_model_repo,
|
|
65
|
+
data_repo=data_repo,
|
|
66
|
+
in_memory_object_repo=in_memory_object_repo,
|
|
67
|
+
)
|
eegdash/SignalStore/signalstore/utilities/data_adapters/spike_interface_adapters/si_recording.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from spikeinterface.core import BaseRecording, BaseRecordingSegment
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from spikeinterface.sorters import BaseSorter
|