Skip to content

Commit ec9063e

Browse files
committed
Add detailed stimulator diagnostics: print devinfo, try readevents
Print channeltype, channel, devepoch for the stimulator probe and try readevents_epochsamples directly to expose the actual error. Include ds/ts key sizes in failure message. https://claude.ai/code/session_01A7rAxYf5pSvs19iVJe3ncL
1 parent be25d12 commit ec9063e

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

tests/test_cloud_read_ingested.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,15 +268,53 @@ def test_stimulator_probe_timeseries(self, session):
268268
p_st = session.getprobes(type="stimulator")
269269
assert len(p_st) >= 1, "Expected at least 1 stimulator probe"
270270

271-
ds, ts, _ = p_st[0].readtimeseries(epoch=1, t0=10, t1=20)
271+
stim = p_st[0]
272+
print(f" Stimulator probe: {stim}")
273+
print(f" Stimulator class: {type(stim).__name__}")
274+
275+
# Diagnostic: check what getchanneldevinfo returns
276+
devinfo = stim.getchanneldevinfo(1)
277+
if devinfo is None:
278+
pytest.fail("stimulator getchanneldevinfo(1) returned None")
279+
print(f" devinfo keys: {list(devinfo.keys())}")
280+
dev = devinfo.get("daqsystem")
281+
devepoch = devinfo.get("device_epoch_number", devinfo.get("device_epoch_id"))
282+
ct = devinfo.get("channeltype", [])
283+
ch = devinfo.get("channel", [])
284+
print(f" dev={type(dev).__name__}, devepoch={devepoch}")
285+
print(f" channeltype={ct}, channel={ch}")
286+
287+
# Try readevents directly to see the error
288+
if dev is not None and ct:
289+
try:
290+
evt_result = dev.readevents_epochsamples(ct, ch, devepoch, 10, 20)
291+
print(f" readevents result type: {type(evt_result)}")
292+
if isinstance(evt_result, tuple):
293+
print(f" timestamps type: {type(evt_result[0])}")
294+
if isinstance(evt_result[0], list):
295+
print(f" timestamps count: {len(evt_result[0])}")
296+
elif hasattr(evt_result[0], "shape"):
297+
print(f" timestamps shape: {evt_result[0].shape}")
298+
except Exception as exc:
299+
pytest.fail(
300+
f"readevents_epochsamples raised {type(exc).__name__}: {exc}\n"
301+
f" channeltype={ct}, channel={ch}, devepoch={devepoch}"
302+
)
303+
304+
ds, ts, _ = stim.readtimeseries(epoch=1, t0=10, t1=20)
272305

273306
assert ds is not None, "readtimeseries returned None for data"
274307
assert ts is not None, "readtimeseries returned None for times"
275308

276309
# ds should be a dict with 'stimid'
277310
stimid = ds["stimid"]
278311
if hasattr(stimid, "size") and stimid.size == 0:
279-
pytest.fail("ds['stimid'] is empty — binary files may not be accessible from cloud")
312+
pytest.fail(
313+
f"ds['stimid'] is empty. ds keys={list(ds.keys())}, "
314+
f"ds values sizes={{ k: (v.size if hasattr(v, 'size') else len(v) if hasattr(v, '__len__') else v) for k, v in ds.items() }}, "
315+
f"ts keys={list(ts.keys())}, "
316+
f"ts values sizes={{ k: (v.size if hasattr(v, 'size') else len(v) if hasattr(v, '__len__') else v) for k, v in ts.items() }}"
317+
)
280318
if hasattr(stimid, "__len__") and not isinstance(stimid, (int, float)):
281319
stimid = int(stimid[0]) if len(stimid) > 0 else stimid
282320
assert stimid == 31, f"Expected stimid == 31, got {stimid}"

0 commit comments

Comments
 (0)