-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Labels
preprocessingRelated to preprocessing moduleRelated to preprocessing module
Description
from #4170 (comment)
Maybe related, for some reason using set_probe on an unsigned recording changes the value returned by get_traces, this does not happen if I call set_probe first and then convert to signed. I don't see anything in the probe mapping that would change the gain or offset.
recs = dict()
recs['raw'] = se.read_binary(
ephys_path / f"np2-{prb_suffix}-ephys_{suffix}.raw",
sampling_frequency=fs_hz,
dtype=np.uint16,
num_channels=num_channels,
)
recs['unsigned_from_raw'] = si.unsigned_to_signed(recs['raw'], bit_depth=bit_depth)
print(recs['raw'].dtype)
recs['probe_from_unsigned'] = recs['unsigned_from_raw'].set_probe(npx_mapping, in_place=False)
# The other way round
recs['probe_from_raw']= recs['raw'].set_probe(npx_mapping, in_place=False)
recs['unsigned_from_probe']= si.unsigned_to_signed(recs['probe_from_raw'], bit_depth=bit_depth)
for k, rec in recs.items():
trace = rec.get_traces(start_frame=0, end_frame=2, return_in_uV=False, channel_ids=[30])
print(f"{k}: {trace[0,0]} (dtype: {rec.dtype})")
Prints:
raw: 3847 (dtype: uint16). [expected]
unsigned_from_raw: 1799 (dtype: int16) [expected]
probe_from_unsigned: -28921 (dtype: int16) [BAD expected is 1799]
probe_from_raw: 3847 (dtype: uint16) [expected]
unsigned_from_probe: 1799 (dtype: int16) [expected]
Metadata
Metadata
Assignees
Labels
preprocessingRelated to preprocessing moduleRelated to preprocessing module