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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npc-sync
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Repackaging of AllenSDK.SyncDataset with extra functionality, compatible with data in the cloud.
5
5
  Author-email: Ben Hardcastle <ben.hardcastle@alleninstitue.org>
6
6
  License: MIT
@@ -16,7 +16,7 @@ dependencies = [
16
16
  "scipy>=1.13.1",
17
17
  "npc-stim>=0.1.14",
18
18
  ]
19
- version = "0.2.3"
19
+ version = "0.2.5"
20
20
  classifiers = [
21
21
  "Development Status :: 3 - Alpha",
22
22
  "Programming Language :: Python :: 3",
@@ -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
- try:
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'][:]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: npc-sync
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: Repackaging of AllenSDK.SyncDataset with extra functionality, compatible with data in the cloud.
5
5
  Author-email: Ben Hardcastle <ben.hardcastle@alleninstitue.org>
6
6
  License: MIT
@@ -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
@@ -1,5 +0,0 @@
1
- import npc_sync
2
-
3
-
4
- def test_import_package():
5
- pass
File without changes
File without changes
File without changes
File without changes
File without changes