ocssw
V2022
|
StringifyBytesConverter
Inheritance diagram for StringifyBytesConverter:
Collaboration diagram for StringifyBytesConverter:
Public Member Functions | |
def | __init__ (self, format="hex") |
def | convert (self, field_array) |
![]() | |
def | __init__ (self) |
Detailed Description
Post-processing conversion which converts byte arrays or multi-byte numbers to strings in numeric representations such as binary, hexadecimal, or octal. To convert individual bytes, the input field should be defined as a `~ccsdspy.PacketArray` constructed with `data_type="uint"` and `bit_length=8`. Otherwise, each element is converted as a single entity. If the field is an array, the shape of the array is retained. The strings generated are not padded to a fixed length. The converted strings contain prefixes such as `0b` (binary), `0x` (hex), or `0o` (octal). If the number is signed and negative, the prefixes change to `-0b` (binary), `-0x` (hex), or `-0o` (octal).
Definition at line 285 of file converters.py.
Constructor & Destructor Documentation
◆ __init__()
def __init__ | ( | self, | |
format = "hex" |
|||
) |
Instantiate a StringifyBytesConverter object Parameters ---------- format : {"bin", "hex", "oct"} Format used to encode the bytes in a string.
Definition at line 302 of file converters.py.
Member Function Documentation
◆ convert()
def convert | ( | self, | |
field_array | |||
) |
Apply the conversion. Parameters ---------- field_array : NumPy array decoded packet field values, must have at least two dimensions Returns ------- converted : NumPy array converted form of the converted packet field values
Reimplemented from Converter.
Definition at line 338 of file converters.py.
The documentation for this class was generated from the following file:
- /gfs-oceanweb/web/ocssw/ocssw_src/src/scripts/telemetry/ccsdspy/converters.py