data_types

The different formats which are wrapped by a MeasuredData class.

Digitized

Bases: MeasuredData

flowchart LR tm_data_types.datum.data_types.Digitized[Digitized] tm_data_types.datum.data_types.MeasuredData[MeasuredData] tm_data_types.datum.data_types.MeasuredData --> tm_data_types.datum.data_types.Digitized click tm_data_types.datum.data_types.Digitized href "" "tm_data_types.datum.data_types.Digitized" click tm_data_types.datum.data_types.MeasuredData href "" "tm_data_types.datum.data_types.MeasuredData"

Data that has been converted to separate data streams along the 2nd axis.

append

append(new_measured_data: Union[MeasuredData, NDArray[PossibleTypes]]) -> MeasuredData

Append new values to the waveform which are automatically type converted.

Parameters:
  • new_measured_data (Union[MeasuredData, NDArray[PossibleTypes]]) –

    The data that should be appended.

calculate_offset

calculate_offset(known_offset: float = 0.0) -> float

Return 0.0, as this information is redundant.

Parameters:
  • known_offset (float, default: 0.0 ) –

    The known offset of the waveform.

Returns:

calculate_spacing

calculate_spacing() -> float

Return 1.0, as this information is redundant.

Returns:

FeatureScaled

Bases: MeasuredData

flowchart LR tm_data_types.datum.data_types.FeatureScaled[FeatureScaled] tm_data_types.datum.data_types.MeasuredData[MeasuredData] tm_data_types.datum.data_types.MeasuredData --> tm_data_types.datum.data_types.FeatureScaled click tm_data_types.datum.data_types.FeatureScaled href "" "tm_data_types.datum.data_types.FeatureScaled" click tm_data_types.datum.data_types.MeasuredData href "" "tm_data_types.datum.data_types.MeasuredData"

Data that has been scaled to (-1.0, 1.0).

append

append(new_measured_data: Union[MeasuredData, NDArray[PossibleTypes]]) -> MeasuredData

Append new values to the waveform which are automatically type converted.

Parameters:
  • new_measured_data (Union[MeasuredData, NDArray[PossibleTypes]]) –

    The data that should be appended.

calculate_offset

calculate_offset(known_offset: float = 0.0) -> float

Return the already known offset, as the value is maintained on conversion.

Parameters:
  • known_offset (float, default: 0.0 ) –

    The known offset of the waveform.

Returns:
  • float

    The known offset.

calculate_spacing

calculate_spacing() -> float

Return 1.0, as the range is between -1.0 and 1.0.

Returns:

MeasuredData

Bases: ndarray

flowchart LR tm_data_types.datum.data_types.MeasuredData[MeasuredData] click tm_data_types.datum.data_types.MeasuredData href "" "tm_data_types.datum.data_types.MeasuredData"

A wrapper class for np.ndarray which provides more functionality towards type conversion.

append

append(new_measured_data: Union[MeasuredData, NDArray[PossibleTypes]]) -> MeasuredData

Append new values to the waveform which are automatically type converted.

Parameters:
  • new_measured_data (Union[MeasuredData, NDArray[PossibleTypes]]) –

    The data that should be appended.

calculate_offset abstractmethod

calculate_offset(known_offset: float = 0.0) -> float

Calculate what the absolute offset is based on the current data and known offset.

Parameters:
  • known_offset (float, default: 0.0 ) –

    The known offset of the waveform.

Returns:
  • float

    The calculated offset.

calculate_spacing abstractmethod

calculate_spacing() -> float

Calculate the spacing based on information contained within the data.

Returns:
  • float

    The calculated spacing.

Normalized

Bases: MeasuredData

flowchart LR tm_data_types.datum.data_types.Normalized[Normalized] tm_data_types.datum.data_types.MeasuredData[MeasuredData] tm_data_types.datum.data_types.MeasuredData --> tm_data_types.datum.data_types.Normalized click tm_data_types.datum.data_types.Normalized href "" "tm_data_types.datum.data_types.Normalized" click tm_data_types.datum.data_types.MeasuredData href "" "tm_data_types.datum.data_types.MeasuredData"

Data that has been normalized to a provided offset and amplitude.

append

append(new_measured_data: Union[MeasuredData, NDArray[PossibleTypes]]) -> MeasuredData

Append new values to the waveform which are automatically type converted.

Parameters:
  • new_measured_data (Union[MeasuredData, NDArray[PossibleTypes]]) –

    The data that should be appended.

calculate_offset

calculate_offset(known_offset: float = 0.0) -> float

Return the known offset plus the mean, as the offset has been lost when converting.

Parameters:
  • known_offset (float, default: 0.0 ) –

    The known offset of the waveform.

Returns:
  • float

    The known offset plus the data mean.

calculate_spacing

calculate_spacing() -> float

Calculate the spacing using the range of values, as the spacing was lost when converting.

Returns:
  • float

    The calculated spacing.

RawSample

Bases: MeasuredData

flowchart LR tm_data_types.datum.data_types.RawSample[RawSample] tm_data_types.datum.data_types.MeasuredData[MeasuredData] tm_data_types.datum.data_types.MeasuredData --> tm_data_types.datum.data_types.RawSample click tm_data_types.datum.data_types.RawSample href "" "tm_data_types.datum.data_types.RawSample" click tm_data_types.datum.data_types.MeasuredData href "" "tm_data_types.datum.data_types.MeasuredData"

The raw digitized sample values that have been measured.

append

append(new_measured_data: Union[MeasuredData, NDArray[PossibleTypes]]) -> MeasuredData

Append new values to the waveform which are automatically type converted.

Parameters:
  • new_measured_data (Union[MeasuredData, NDArray[PossibleTypes]]) –

    The data that should be appended.

calculate_offset

calculate_offset(known_offset: float = 0.0) -> float

Return the already known offset, as the value is maintained on conversion.

Parameters:
  • known_offset (float, default: 0.0 ) –

    The known offset of the waveform.

Returns:
  • float

    The known offset.

calculate_spacing

calculate_spacing() -> float

Calculate the spacing based on the minimum and maximum of the dtype.

Returns:
  • float

    The calculated spacing.

type_max

type_max(data_format: Type[ByteData] | PossibleTypes | Type[PossibleTypes]) -> float | int

Get the maximum extent of a dtype.

Parameters:
  • data_format (Type[ByteData] | PossibleTypes | Type[PossibleTypes]) –

    The dtype to get the maximum extent of.

Returns:
  • float | int

    The maximum extent of the type.

type_min

type_min(data_format: Type[ByteData] | PossibleTypes | Type[PossibleTypes]) -> float | int

Get the minimum extent of a dtype.

Parameters:
  • data_format (Type[ByteData] | PossibleTypes | Type[PossibleTypes]) –

    The dtype to get the minimum extent of.

type_ratio

type_ratio(dtype_from: PossibleTypes, dtype_to: PossibleTypes) -> float

Calculate the ratio of ranges between two separate types.

Example

Converting from np.int16 to np.int8 will give you a ratio of 1/256.

Parameters:
  • dtype_from (PossibleTypes) –

    The current dtype that is being converted.

  • dtype_to (PossibleTypes) –

    The dtype that is being converted to.

Returns:
  • float

    The ratio between the two dtypes.