eyepy.io.utils
find_float(bytestring, value, endian=None, bits=None, rtol=1e-05, atol=1e-08)
Find all occurrences of a float in a byte string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bytestring |
bytes
|
The byte string to search. |
required |
value |
float
|
The float to search for. |
required |
endian |
Optional[str]
|
"l" for little and "b" for big, the endianness of the float. If not specified, the endianness is assumed to be the same as the endianness of the system. |
None
|
bits |
Optional[Union[int, list[int], str, list[str]]]
|
The number of bits in the float. If not specified, 16, 32 and 64 bit floats are searched for. |
None
|
rtol |
float
|
The relative tolerance parameter for matching a value (see numpy.isclose). |
1e-05
|
atol |
float
|
The absolute tolerance parameter for matching a value (see numpy.isclose). |
1e-08
|
Returns:
Type | Description |
---|---|
dict[str, list[int]]
|
A dictionary where the key is the type and the value, a list of offsets for which the searched value was found |
Source code in src/eyepy/io/utils.py
find_int(bytestring, value, signed=None, endian=None, bits=None, rtol=1e-05, atol=1e-08)
Find all occurrences of an integer in a byte string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bytestring |
bytes
|
The byte string to search. |
required |
value |
int
|
The integer to search for. |
required |
signed |
Optional[Union[bool, str, list[str]]]
|
Whether the integer is signed or not. If not specified, the integer is assumed to be signed if it is negative, otherwise signed and unsigned are searched for. |
None
|
endian |
Optional[str]
|
"l" for little and "b" for big, the endianness of the integer. If not specified, the endianness is assumed to be the same as the endianness of the system. |
None
|
bits |
Optional[Union[int, list[int], str, list[str]]]
|
The number of bits in the integer. If not specified, 8, 16, 24, 32, and 64 bit integers are searched for. |
None
|
rtol |
float
|
The relative tolerance parameter for matching a value (see numpy.isclose). |
1e-05
|
atol |
float
|
The absolute tolerance parameter for matching a value (see numpy.isclose). |
1e-08
|
Returns:
Type | Description |
---|---|
dict[str, list[int]]
|
A dictionary where the key is the type and the value, a list of offsets for which the searched value was found |