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 |
|---|---|---|---|---|
X |
X |
X |
X |
|
X |
X |
X |
X |
|
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
X |
X |
|||
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.
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 inranges. A bitmask will be created which corresponds to one less the next power of 2.- Raises:
InvalidKeywordValueError – if any in
rangesis less than0or greater than255
- 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:
- 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 inranges. 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
rangesis less than0or greater than2**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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 3 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**32-1
- 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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 4 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**32-1
- 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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 5 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**64-1
- 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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 6 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**64-1
- 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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 7 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**64-1
- 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:
- 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 inranges. 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:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 8 in any orderInvalidKeywordValueError – if any in
rangesis less than0or greater than2**64-1
- 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:
- class pyreflow.OrderedF32Layout(ranges, byteord='little')¶
32-bit ordered float layout.
- Variables:
- Raises:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 4 in any orderInvalidKeywordValueError – if any in
rangesisNaN,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:
- class pyreflow.OrderedF64Layout(ranges, byteord='little')¶
64-bit ordered float layout.
- Variables:
- Raises:
InvalidKeywordValueError – if
byteordis not “little”, “big”, or a list of all integers from 1 to 8 in any orderInvalidKeywordValueError – if any in
rangesisNaN,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:
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:
- Raises:
InvalidKeywordValueError – if any in
rangesisNaN,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:
- class pyreflow.EndianF64Layout(ranges, endian='little')¶
64-bit endian float layout
- Variables:
- Raises:
InvalidKeywordValueError – if any in
rangesisNaN,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:
- 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 of1023will set $PnB to16, will set $PnR to1024, 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.
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>)wheretypeis 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_rangesis less than0or greater than2**64-1when field 1 is"A"or"I"