npc-sync 0.2.3__tar.gz → 0.2.5__tar.gz
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.
- {npc_sync-0.2.3/src/npc_sync.egg-info → npc_sync-0.2.5}/PKG-INFO +1 -1
- {npc_sync-0.2.3 → npc_sync-0.2.5}/pyproject.toml +1 -1
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync/sync.py +11 -6
- {npc_sync-0.2.3 → npc_sync-0.2.5/src/npc_sync.egg-info}/PKG-INFO +1 -1
- npc_sync-0.2.5/tests/test_core.py +30 -0
- npc_sync-0.2.3/tests/test_core.py +0 -5
- {npc_sync-0.2.3 → npc_sync-0.2.5}/LICENSE +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/README.md +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/setup.cfg +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync/__init__.py +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync/py.typed +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync.egg-info/SOURCES.txt +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync.egg-info/dependency_links.txt +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync.egg-info/entry_points.txt +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync.egg-info/requires.txt +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/src/npc_sync.egg-info/top_level.txt +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/tests/test_known_files.py +0 -0
- {npc_sync-0.2.3 → npc_sync-0.2.5}/tests/test_plots.py +0 -0
|
@@ -222,8 +222,8 @@ class SyncDataset:
|
|
|
222
222
|
stim_paths: Iterable[npc_io.PathLike] | None = None,
|
|
223
223
|
) -> None:
|
|
224
224
|
if isinstance(path, self.__class__):
|
|
225
|
-
self = path
|
|
226
|
-
self.dfile = path
|
|
225
|
+
self.path = path.path
|
|
226
|
+
self.dfile = path.dfile
|
|
227
227
|
else:
|
|
228
228
|
self.path = npc_io.from_pathlike(path)
|
|
229
229
|
self.dfile = self.load(path)
|
|
@@ -360,10 +360,7 @@ class SyncDataset:
|
|
|
360
360
|
|
|
361
361
|
@property
|
|
362
362
|
def meta_data(self) -> dict[str, Any]:
|
|
363
|
-
|
|
364
|
-
return eval(self.dfile["meta"][()])
|
|
365
|
-
except AttributeError:
|
|
366
|
-
return eval(self["meta"][()])
|
|
363
|
+
return eval(self.dfile["meta"][()])
|
|
367
364
|
|
|
368
365
|
@property
|
|
369
366
|
def line_labels(self) -> Sequence[str]:
|
|
@@ -1315,6 +1312,14 @@ class SyncDataset:
|
|
|
1315
1312
|
|
|
1316
1313
|
rising, falling = split_flips(flips, is_first_frame_on)
|
|
1317
1314
|
|
|
1315
|
+
if self.block_index_to_stim_path[block_idx] is None and os.getenv(
|
|
1316
|
+
"SYNC_ALLOW_MISSING_STIM_FILES"
|
|
1317
|
+
):
|
|
1318
|
+
logger.debug(
|
|
1319
|
+
f"Block {block_idx} has no stim file available to verify number of vsyncs. Skipping."
|
|
1320
|
+
)
|
|
1321
|
+
frame_display_time_blocks.append(fallback_or_none)
|
|
1322
|
+
continue
|
|
1318
1323
|
assert self.block_index_to_stim_path[block_idx] is not None
|
|
1319
1324
|
|
|
1320
1325
|
# script_frame_intervals = h5py.File(self.block_index_to_stim_path[block_idx])['frameIntervals'][:]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import npc_sync
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_import_package():
|
|
5
|
+
pass
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_no_stim_paths_and_meta_data() -> None:
|
|
9
|
+
"""Constructing SyncDataset without stim_paths leaves stim_paths as None,
|
|
10
|
+
and meta_data is accessible and contains expected keys."""
|
|
11
|
+
s = npc_sync.SyncDataset(
|
|
12
|
+
"s3://aind-ephys-data/ecephys_662892_2023-08-21_12-43-45/behavior/20230821T124345.h5"
|
|
13
|
+
)
|
|
14
|
+
assert s.stim_paths is None
|
|
15
|
+
meta = s.meta_data
|
|
16
|
+
assert isinstance(meta, dict)
|
|
17
|
+
assert "line_labels" in meta
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_init_from_instance_and_meta_data() -> None:
|
|
21
|
+
"""Constructing SyncDataset from an existing instance reuses it,
|
|
22
|
+
and meta_data is still accessible with expected keys."""
|
|
23
|
+
s = npc_sync.SyncDataset(
|
|
24
|
+
"s3://aind-ephys-data/ecephys_662892_2023-08-21_12-43-45/behavior/20230821T124345.h5"
|
|
25
|
+
)
|
|
26
|
+
s2 = npc_sync.SyncDataset(s)
|
|
27
|
+
assert s2.stim_paths is None
|
|
28
|
+
meta = s2.meta_data
|
|
29
|
+
assert isinstance(meta, dict)
|
|
30
|
+
assert "line_labels" in meta
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|