nitypes.xy_data.XYData
- class nitypes.xy_data.XYData(x_data: numpy.typing.NDArray[TOtherData], y_data: numpy.typing.NDArray[TOtherData], *, x_units: str = '', y_units: str = '', extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = None, copy_extended_properties: bool = True)
Bases:
Generic[TData]Two axes (sequences) of numeric values with units information.
Constructing
To construct an XYData object, use the
XYDataclass:>>> XYData(np.array([1.1], np.float64), np.array([4.1], np.float64)) nitypes.xy_data.XYData(x_data=array([1.1]), y_data=array([4.1])) >>> XYData(np.array([1, 2]), np.array([4, 5]), x_units="A", y_units="V") nitypes.xy_data.XYData(x_data=array([1, 2]), y_data=array([4, 5]), x_units='A', y_units='V')
To construct an XYData object using built-in lists, use from_arrays_1d():
>>> XYData.from_arrays_1d([1, 2], [5, 6], np.int32) nitypes.xy_data.XYData(x_data=array([1, 2], dtype=int32), y_data=array([5, 6], dtype=int32)) >>> XYData.from_arrays_1d([1.0, 1.1], [1.2, 1.3], np.float64) nitypes.xy_data.XYData(x_data=array([1. , 1.1]), y_data=array([1.2, 1.3]))
- __slots__ = ['_x_data', '_y_data', '_extended_properties']
- classmethod from_arrays_1d(x_array: numpy.typing.NDArray[TOtherData], y_array: numpy.typing.NDArray[TOtherData], dtype: None = ..., *, x_units: str = ..., y_units: str = ..., copy: bool = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ...) XYData[TOtherData]
- classmethod from_arrays_1d(x_array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], y_array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], dtype: type[TOtherData] | numpy.dtype[TOtherData], *, x_units: str = ..., y_units: str = ..., copy: bool = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ...) XYData[TOtherData]
- classmethod from_arrays_1d(x_array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], y_array: numpy.typing.NDArray[Any] | collections.abc.Sequence[Any], dtype: numpy.typing.DTypeLike | None = ..., *, x_units: str = ..., y_units: str = ..., copy: bool = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None = ...) XYData[Any]
Construct an XYData from two one-dimensional arrays or sequences.
- Parameters:
x_array – The x-axis data as a one-dimensional array or a sequence.
y_array – The y-axis data as a one-dimensional array or a sequence.
dtype – The NumPy data type for the XYdata axes. This argument is required when x_array and y_array are sequences.
x_units – The units string associated with x_array.
y_units – The units string associated with y_array
copy – Specifies whether to copy the arrays or save references to them.
extended_properties – The extended properties of the XYData.
- Returns:
An XYData object containing the specified data.
- property x_data: numpy.typing.NDArray[TData]
The x-axis data of this XYData.
- Return type:
numpy.typing.NDArray[TData]
- property y_data: numpy.typing.NDArray[TData]
The y-axis data of this XYData.
- Return type:
numpy.typing.NDArray[TData]
- property dtype: numpy.dtype[TData]
The NumPy dtype for the XYData.
- Return type:
- property extended_properties: nitypes.waveform.ExtendedPropertyDictionary
The extended properties for the XYData.
Note
Data stored in the extended properties dictionary may not be encrypted when you send it over the network or write it to a TDMS file.
- Return type:
- Parameters:
x_data (numpy.typing.NDArray[TOtherData])
y_data (numpy.typing.NDArray[TOtherData])
x_units (str)
y_units (str)
extended_properties (collections.abc.Mapping[str, nitypes.waveform.typing.ExtendedPropertyValue] | None)
copy_extended_properties (bool)