Skip to content

Wave.resample changes the dtype! #31

@j9ac9k

Description

@j9ac9k
  • signalworks version: 0.3.1
  • Python version: 3.7.5
  • Operating System: macOS

Description

When calling tracking.wave.resample(some_freq), I get a new track back, but the dtype of the new_track was floating point (when the original track dtype was int16). This of course causes all sorts of havok with wave.min and wave.max, and thus plotting

Here is the code for resampling:

https://github.com/TimeViewers/signalworks/blob/master/signalworks/tracking/wave.py#L189-L202

In the end, it calls the Wave constructor, with the new values from resample_poly.

The thing to do here would be to convert the returned values into the dtype of the original array, something along the lines of

return type(self)(resample_poly(self._value, 1, int(self._fs / fs).astype(self._value.dtype), fs)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions