Skip to content

Commit cf33c45

Browse files
committed
updated tests for acquisition description files using daqami sync mode
1 parent fdfaba9 commit cf33c45

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

iblrig/neurophotometrics.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ def _validate_neurophotometrics_description(
256256
ix = [i for i, loc in enumerate(locations) if loc == location]
257257
assert len(ix) <= 2, 'there are only 2 possible bands'
258258
rois_per_loc = [rois[i] for i in ix]
259-
# check that each band is present only once
260-
assert sum(True for roi in rois_per_loc if roi.startswith('G')) == 1, 'duplicate green band'
261-
assert sum(True for roi in rois_per_loc if roi.startswith('R')) == 1, 'duplicate red band'
259+
# check that each band is present once or none
260+
assert sum(True for roi in rois_per_loc if roi.startswith('G')) in [0, 1], 'duplicate green band'
261+
assert sum(True for roi in rois_per_loc if roi.startswith('R')) in [0, 1], 'duplicate red band'
262262
assert sync_mode in ('bpod', 'daqami'), 'sync mode must be either bpod or daqami'
263263

264264

@@ -326,7 +326,6 @@ def neurophotometrics_description(
326326
sync_metadata:
327327
acquisition_software: daqami
328328
collection: raw_photometry_data
329-
sampling_rate: 1000
330329
frameclock_channel: 0
331330
332331
"""

iblrig/test/test_neurophotometrics.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77
class TestExperimentDescription(unittest.TestCase):
88
def test_neurophotometrics_description(self):
9+
# tests the generation of the acquisition description
910
dt = datetime.datetime.fromisoformat('2024-10-11T11:11:00')
11+
12+
# for bpod based sync
1013
d = neurophotometrics_description(
1114
rois=['G0', 'G1'], locations=['SI', 'VTA'], sync_channel=1, start_time=dt, sync_mode='bpod'
1215
)
@@ -22,3 +25,25 @@ def test_neurophotometrics_description(self):
2225
}
2326
}
2427
self.assertEqual(dexpected, d)
28+
29+
# for daqami sync
30+
d = neurophotometrics_description(
31+
rois=['G0', 'G1'], locations=['SI', 'VTA'], sync_channel=1, start_time=dt, sync_mode='daqami'
32+
)
33+
dexpected = {
34+
'devices': {
35+
'neurophotometrics': {
36+
'sync_channel': 1,
37+
'datetime': '2024-10-11T11:11:00',
38+
'collection': 'raw_photometry_data',
39+
'fibers': {'G0': {'location': 'SI'}, 'G1': {'location': 'VTA'}},
40+
'sync_mode': 'daqami',
41+
'sync_metadata': {
42+
'acquisition_software': 'daqami',
43+
'collection': 'raw_photometry_data',
44+
'frameclock_channel': 0,
45+
},
46+
}
47+
}
48+
}
49+
self.assertEqual(dexpected, d)

0 commit comments

Comments
 (0)