Skip to content

unsigned_to_signed does not update recording offset_to_uV #4170

@ablot

Description

@ablot

If I read a raw binary file that is saved in uint16 and correctly set the offset, calling unsigned_to_signed returns a recording with an invalid offset.

raw_rec = se.read_binary(
        data_file,
        sampling_frequency=30000.,
        dtype=np.uint16,
        num_channels=384,
        gain_to_uV=3.05176,
        offset_to_uV=-2048*3.05176,
    )
# we can use get_traces with return_in_uV, all is good

unsigned = si.unsigned_to_signed(raw_rec, bit_depth=12)
# now the trace in uV have an offset, exactly 2048*3.05176

Shouldn't the unsigned_to_signed subtract 2**bit_depth / 2 * gain from the offset? Or is it expected that the offset is unset when using this function?

Metadata

Metadata

Assignees

Labels

preprocessingRelated to preprocessing module

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions