generated from ni/github-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Report
Testing with nidaqmx in ni/nidaqmx-python#828 revealed that AnalogWaveform.scaled_data always copies the data array.
Repro or Code Sample
>>> import numpy as np
>>> x = np.linspace(0.0, 5.0, 10, dtype=np.float64)
>>> y = x[::2]
>>> from nitypes.waveform import AnalogWaveform
>>> w = AnalogWaveform(raw_data=y)
>>> w.raw_data.flags
C_CONTIGUOUS : False
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
>>> w.scaled_data.flags
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
>>> w.raw_data.astype(np.float64).flags
C_CONTIGUOUS : True
F_CONTIGUOUS : True
OWNDATA : True
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : False
>>> w.raw_data.astype(np.float64, copy=False).flags
C_CONTIGUOUS : False
F_CONTIGUOUS : False
OWNDATA : False
WRITEABLE : True
ALIGNED : True
WRITEBACKIFCOPY : FalseExpected Behavior
When raw_data.dtype == np.float64 and scale_mode == NO_SCALING, scaled_data returns raw_data without making a copy.
Current Behavior
scaled_data always makes a copy.
Possible Solution
Add copy=False to the astype call in _convert_data.
Context
Reviewing nidaqmx changes.
Your Environment
N/A
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working