Skip to content
Snippets Groups Projects
Commit 5a2688df authored by Ronan Hamon's avatar Ronan Hamon
Browse files

Update Waveform.astype

parent a716ea6d
Branches
Tags
No related merge requests found
Pipeline #
......@@ -757,14 +757,15 @@ class Waveform(MadArray):
if np.issubdtype(dtype, np.floating):
int_range = src_iinfo.max - src_iinfo.min + 1
zero = src_iinfo.min + int_range // 2
y = ((super(type(y), y).astype(np.float64) - zero)
y = ((super(type(y), y).astype(dtype) - zero)
/ (int_range // 2))
y.clip(min_value=-1, max_value=1-np.finfo(dtype).eps)
y = y.astype(dtype)
y = np.array(y).astype(dtype)
elif np.issubdtype(dtype, np.integer):
y = y.astype(dtype=np.float64)
y = y.astype(dtype=dtype)
y = np.array(y)
elif np.issubdtype(dtype, np.complexfloating):
y = y.astype(dtype=np.float64)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment