Data Schema Classes#

The following classes encode keywords comprising the schema for the DATA segment ($DATATYPE, $BYTEORD, $PnB, $PnR, $PnDATATYPE).

Only certain data schema are valid for a given FCS version, summarized below:

Concrete Data Schema Classes#

Ordered Numeric Data#

Data schema encoded using numeric binary types (unsigned integer or float) using any byte order. Used for FCS 2.0 and 3.0.

class pyreflow.OrderedUintDataSchema(ranges, byte_width=4, byteord='little')#

Bases: OrderedDataSchema

An integer data schema with any byte order and a single width.

Variables:
  • ranges (list[IntRange]) – (read-only) The maximum value of each measurement. Corresponds to the $PnR keyword less one.

  • byte_width (ByteWidth) – (read-only) The width of the data schema in bytes. Must be an integer 1 to 8. All in ranges must be able to fit within the allotted bytes. Defaults to 4.

  • byteord (ByteOrd) – (read-only) The byte order to use when encoding values. Defaults to "little".

Raises:

InvalidKeywordValueError – if byteord is not "little", "big", or a list of unique integers in any order

datatype#

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return False.

Return type:

bool

class pyreflow.OrderedF32DataSchema(ranges, byteord='little')#

Bases: OrderedDataSchema

32-bit ordered float data schema.

Variables:
  • ranges (list[FloatRange]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally.

  • byteord (ByteOrd) – (read-only) The byte order to use when encoding values. Defaults to "little".

Raises:
byte_width#

The width of each measurement in bytes (read-only).

Will always return 4.

This corresponds to the value of $PnB divided by 8, which are all equal for this data schema.

Return type:

int

datatype#

The value of $DATATYPE (read-only).

Will always return "F".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return True.

Return type:

bool

class pyreflow.OrderedF64DataSchema(ranges, byteord='little')#

Bases: OrderedDataSchema

64-bit ordered float data schema.

Variables:
  • ranges (list[FloatRange]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally.

  • byteord (ByteOrd) – (read-only) The byte order to use when encoding values. Defaults to "little".

Raises:
byte_width#

The width of each measurement in bytes (read-only).

Will always return 8.

This corresponds to the value of $PnB divided by 8, which are all equal for this data schema.

Return type:

int

datatype#

The value of $DATATYPE (read-only).

Will always return "D".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return True.

Return type:

bool

Big/Little Numeric Data#

Data schema encoded using numeric binary types (unsigned integer or float) using either big or little endian. Used for FCS 3.1 and 3.2.

Note that VariableUintDataSchema() is special in that it has only datatype (according to the $DATATYPE keyword) but it is not considered a matrix data schema (ie does not subclass pyreflow.typing.MatrixDataSchema()) because its columns may be different widths and thus may be different primitive data types (ie u16 vs u32).

class pyreflow.BigLittleF32DataSchema(ranges, endian='little')#

Bases: MatrixDataSchema, BigLittleDataSchema

32-bit endian float data schema

Variables:
  • ranges (list[FloatRange]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally.

  • endian (Endian) – (read-only) If "big" use big endian (4,3,2,1) for encoding values; if "little" use little endian (1,2,3,4). Defaults to "little".

Raises:

InvalidKeywordValueError – if any in ranges is NaN, inf, -inf, or outside the bounds of a 32-bit float

byte_width#

The width of each measurement in bytes (read-only).

Will always return 4.

This corresponds to the value of $PnB divided by 8, which are all equal for this data schema.

Return type:

int

datatype#

The value of $DATATYPE (read-only).

Will always return "F".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return True.

Return type:

bool

class pyreflow.BigLittleF64DataSchema(ranges, endian='little')#

Bases: MatrixDataSchema, BigLittleDataSchema

64-bit endian float data schema

Variables:
  • ranges (list[FloatRange]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally.

  • endian (Endian) – (read-only) If "big" use big endian (4,3,2,1) for encoding values; if "little" use little endian (1,2,3,4). Defaults to "little".

Raises:

InvalidKeywordValueError – if any in ranges is NaN, inf, -inf, or outside the bounds of a 64-bit float

byte_width#

The width of each measurement in bytes (read-only).

Will always return 8.

This corresponds to the value of $PnB divided by 8, which are all equal for this data schema.

Return type:

int

datatype#

The value of $DATATYPE (read-only).

Will always return "D".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return True.

Return type:

bool

class pyreflow.SingleUintDataSchema(ranges, byte_width=4, endian='little')#

Bases: MatrixDataSchema, BigLittleDataSchema

A mixed-width integer data schema.

Variables:
  • ranges (list[IntRange]) – (read-only) The maximum value of each measurement. Corresponds to the $PnR keyword less one.

  • byte_width (ByteWidth) – (read-only) The width of the data schema in bytes. Must be an integer 1 to 8. All in ranges must be able to fit within the allotted bytes. Defaults to 4.

  • endian (Endian) – (read-only) If "big" use big endian (4,3,2,1) for encoding values; if "little" use little endian (1,2,3,4). Defaults to "little".

datatype#

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return False.

Return type:

bool

class pyreflow.VariableUintDataSchema(ranges, endian='little')#

Bases: BigLittleDataSchema, NumericDataSchema

A mixed-width integer data schema.

Variables:
  • ranges (list[VariableBitmask]) – (read-only) The width and range of each measurement.

  • endian (Endian) – (read-only) If "big" use big endian (4,3,2,1) for encoding values; if "little" use little endian (1,2,3,4). Defaults to "little".

byte_widths#

The width of each measurement in bytes (read-only).

This corresponds to the value of $PnB for each measurement divided by 8. Values for each measurement may be different.

Return type:

list[ByteWidth]

datatype#

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Datatype

is_float#

Denotes of numeric type is floating point (read-only).

Will always return False.

Return type:

bool

Mixed Data Schema#

Data schema which can include any type (character, float, unsigned integer). Only for FCS 3.2.

class pyreflow.MixedDataSchema(typed_ranges, endian='little')#

Bases: BigLittleDataSchema

A mixed-type data schema.

Variables:
  • typed_ranges (list[MixedRange]) – (read-only) The type and range for each measurement.

  • endian (Endian) – (read-only) If "big" use big endian (4,3,2,1) for encoding values; if "little" use little endian (1,2,3,4). Defaults to "little".

byte_widths#

The width of each measurement in bytes (read-only).

For numeric columns, this corresponds to the value of $PnB divided by 8. For ASCII columns, this corresponds to $PnB exactly.

Return type:

list[int]

ASCII data schema#

Data schema encoded using ASCII characters. Available in all FCS versions.

class pyreflow.FixedAsciiDataSchema(ranges)#

Bases: AsciiDataSchema

A fixed-width ASCII data schema.

Variables:

ranges (list[IntRange]) – (read-only) The range for each measurement. Equivalent to $PnR. The value of $PnB will be derived from these and will be equivalent to the number of digits for each value.

char_widths#

The width of each measurement (read-only).

Equivalent to $PnB, which is the number of chars/digits used to encode data for a given measurement.

Return type:

list[int]

datatype#

The value of $DATATYPE (read-only).

Will always return "A".

Return type:

Datatype

class pyreflow.DelimAsciiDataSchema(ranges)#

Bases: AsciiDataSchema

A delimited ASCII data schema.

Variables:

ranges (list[IntRange]) – (read-only) The range for each measurement. Equivalent to the $PnR keyword. This is not used internally.

datatype#

The value of $DATATYPE (read-only).

Will always return "A".

Return type:

Datatype

Abstract Superclasses#

The following classes are abstract interfaces for the concrete classes listed above. Their primary purpose is to provide a convenient way to filter each class by isinstance().

class pyreflow.typing.BigLittleDataSchema#

Bases: ABC

A data schema which can be either big or little endian.

abstract property endian: Endian#

The endian-ness of the encoded numeric values.

Corresponds to the value of the $BYTEORD keyword.

Only applies to non-ASCII schemas for FCS 3.1 and 3.2.

class pyreflow.typing.SingleTypedDataSchema#

Bases: ABC

A data schema defined by a single $DATATYPE value.

abstract property datatype: Datatype#

The value of the $DATATYPE keyword.

class pyreflow.typing.AsciiDataSchema#

Bases: SingleTypedDataSchema

A data schema which uses ASCII for the underlying encoding.

class pyreflow.typing.NumericDataSchema#

Bases: ABC

A data schema which uses binary-encoded numbers.

abstract property is_float: bool#

True if the numeric type is a floating point.

class pyreflow.typing.MatrixDataSchema#

Bases: SingleTypedDataSchema, NumericDataSchema

A data schema which has only one numeric value type.

abstract property byte_width: ByteWidth#

The width of each value in bytes.

This is the same as $PnB divided by 8 which should be the same for all measurement columns.

class pyreflow.typing.OrderedDataSchema#

Bases: MatrixDataSchema

A data schema which can be encoded with any byte order.

abstract property byteord: ByteOrd#

The order of bytes for each encoded value.

Corresponds to the value of the $BYTEORD keyword.

Only applies to non-ASCII schemas for FCS 2.0 and 3.0.