Layout Classes

The following classes encode keywords that describe the byte-layout of the DATA segment ($DATATYPE, $BYTEORD, $PnB, $PnR, $PnDATATYPE).

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

Layout

FCS2.0

FCS3.0

FCS3.1

FCS3.2

FixedAsciiLayout

X

X

X

X

DelimAsciiLayout

X

X

X

X

OrderedUint08Layout

X

X

OrderedUint16Layout

X

X

OrderedUint24Layout

X

X

OrderedUint32Layout

X

X

OrderedUint40Layout

X

X

OrderedUint48Layout

X

X

OrderedUint56Layout

X

X

OrderedUint64Layout

X

X

OrderedF32Layout

X

X

OrderedF64Layout

X

X

EndianF32Layout

X

X

EndianF64Layout

X

X

EndianUintLayout

X

X

MixedLayout

X

ASCII layouts

Layouts encoded using ASCII characters. Available in all FCS versions.

class pyreflow.FixedAsciiLayout(ranges)

A fixed-width ASCII layout.

Variables:

ranges (list[int]) – (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:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.DelimAsciiLayout(ranges)

A delimited ASCII layout.

Variables:

ranges (list[int]) – (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:

Literal[“A”, “I”, “F”, “D”]

Ordered Numeric Layouts

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

class pyreflow.OrderedUint08Layout(ranges)

8-bit ordered integer layout.

Variables:

ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

Raises:

InvalidKeywordValueError – if any in ranges is less than 0 or greater than 255

byte_width

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

Will always return 1.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint16Layout(ranges, endian='little')

16-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • endian (Literal[“little”, “big”]) – (read-only) If "big" use big endian (2,1) for encoding values; if "little" use little endian (1,2). Defaults to "little".

Raises:

InvalidKeywordValueError – if any in ranges is less than 0 or greater than 2**16-1

byte_width

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

Will always return 2.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint24Layout(ranges, byteord='little')

24-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 3.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint32Layout(ranges, byteord='little')

32-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint40Layout(ranges, byteord='little')

40-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 5.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint48Layout(ranges, byteord='little')

48-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 6.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint56Layout(ranges, byteord='little')

56-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 7.

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

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedUint64Layout(ranges, byteord='little')

64-bit ordered integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range for each measurement. Corresponds to $PnR - 1, which implies that the value for each measurement must be less than or equal to the values in ranges. A bitmask will be created which corresponds to one less the next power of 2.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedF32Layout(ranges, byteord='little')

32-bit ordered float layout.

Variables:
  • ranges (list[float]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally so only serves for users’ own purposes.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "F".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.OrderedF64Layout(ranges, byteord='little')

64-bit ordered float layout.

Variables:
  • ranges (list[float]) – (read-only) The range for each measurement. Corresponds to $PnR. This is not used internally so only serves for users’ own purposes.

  • byteord (Literal[“little”, “big”] | list[int]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "D".

Return type:

Literal[“A”, “I”, “F”, “D”]

Endian Numeric Layouts

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

class pyreflow.EndianF32Layout(ranges, endian='little')

32-bit endian float layout

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

  • endian (Literal[“little”, “big”]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "F".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.EndianF64Layout(ranges, endian='little')

64-bit endian float layout

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

  • endian (Literal[“little”, “big”]) – (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 layout.

Return type:

int

datatype

The value of $DATATYPE (read-only).

Will always return "D".

Return type:

Literal[“A”, “I”, “F”, “D”]

class pyreflow.EndianUintLayout(ranges, endian='little')

A mixed-width integer layout.

Variables:
  • ranges (list[int]) – (read-only) The range of each measurement. Corresponds to the $PnR keyword less one. The number of bytes used to encode each measurement ($PnB) will be the minimum required to express this value. For instance, a value of 1023 will set $PnB to 16, will set $PnR to 1024, and encode values for this measurement as 16-bit integers. The values of a measurement will be less than or equal to this value.

  • endian (Literal[“little”, “big”]) – (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[int]

datatype

The value of $DATATYPE (read-only).

Will always return "I".

Return type:

Literal[“A”, “I”, “F”, “D”]

Mixed Layouts

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

class pyreflow.MixedLayout(typed_ranges, endian='little')

A mixed-type layout.

Variables:
  • typed_ranges (list[tuple[Literal[“A”, “I”], int] | tuple[Literal[“F”, “D”], Decimal]]) – (read-only) The type and range for each measurement corresponding to $DATATYPE and/or $PnDATATYPE and $PnR respectively. These are given as 2-tuples like (<type>, <range>) where type is one of "A", "I", "F", or "D" corresponding to Ascii, Integer, Float, or Double datatypes respectively.

  • endian (Literal[“little”, “big”]) – (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 field 2 of typed_ranges is less than 0 or greater than 2**64-1 when field 1 is "A" or "I"

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[int]