You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The culprit appears to be on line 657 of phylib/io/traces.py, where the dtype of the waveforms is inferred if sample2unit is None, else set to float. The phy command extract-waveforms never sets sample2unit, so it always defaults to 1.0, and hence the written waveforms have dtype float, which on most modern python installations means float64. If raw data file from which the waveforms are loaded is of integer type, the multiplication by 1.0 will coerce them to float64, hence they will be written correctly. If the raw data file is of type float32, however, no such coercion will take place and the NpyWriter will byte-copy the float32-encoded waveforms to the waveforms .npy file that claims to have dtype float64 in its header.
The text was updated successfully, but these errors were encountered:
phy extract-waveforms saves waveforms with the wrong dtype if the raw data file is encoded as float32.
Steps to reproduce:
phy extract-waveforms params.py
Expected behaviour:
The waveforms are loaded
Actual behaviour:
Environment info:
OS: Windows 10 x64
Python verison: 3.11.9
Conda verison: 23.3.1
phy version: 2.0b5
phylib version: 2.4.3
Additional info:
The culprit appears to be on line 657 of
phylib/io/traces.py
, where the dtype of the waveforms is inferred ifsample2unit
is None, else set to float. The phy commandextract-waveforms
never setssample2unit
, so it always defaults to 1.0, and hence the written waveforms have dtypefloat
, which on most modern python installations means float64. If raw data file from which the waveforms are loaded is of integer type, the multiplication by 1.0 will coerce them to float64, hence they will be written correctly. If the raw data file is of type float32, however, no such coercion will take place and theNpyWriter
will byte-copy the float32-encoded waveforms to the waveforms .npy file that claims to have dtypefloat64
in its header.The text was updated successfully, but these errors were encountered: