utils package#
Submodules#
utils.binary_ops module#
binary_ops.py
file |
sturdr/utils/binary_ops.py |
brief |
Binary operations. |
date |
October 2024 |
- utils.binary_ops.CheckBit(data: uint32, idx: uint32)#
- utils.binary_ops.ClearBit(data: uint32, idx: uint32)#
- utils.binary_ops.FlipBit(data: uint32, idx: uint32)#
- utils.binary_ops.GetDataBit(data: uint32, idx: uint32)#
- utils.binary_ops.GetDataBits(data: uint32, beg: uint32, end: uint32)#
- utils.binary_ops.RotL(data: uint32, size: uint32)#
- utils.binary_ops.SetBit(data: uint32, idx: uint32)#
- utils.binary_ops.SetBitTo(data: uint32, idx: uint32, val: bool)#
- utils.binary_ops.SetDataBitTo(data: uint32, idx: uint32, val: bool)#
- utils.binary_ops.TwosCompliment(data: uint32, size: uint32)#
utils.constants module#
constants.py
file |
sturdr/utils/constants.py |
brief |
Satellite navigation constants. |
date |
October 2024 |
refs |
|
utils.enums module#
enums.py
file |
sturdr/utils/enums.py |
brief |
Satellite navigation enumerations. |
date |
October 2024 |
- class utils.enums.ChannelState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Enumeration class for channel state according to the defined state machine architecture.
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- ACQUIRING = 2#
- IDLE = 1#
- OFF = 0#
- TRACKING = 3#
- class utils.enums.GnssSignalTypes(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Enumeration class for GNSS satellite broadcast signal types.
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- GALILEO_E1 = 5#
- GALILEO_E5 = 7#
- GALILEO_E5a = 8#
- GALILEO_E5b = 9#
- GALILEO_E6 = 6#
- GPS_L1C = 2#
- GPS_L1CA = 1#
- GPS_L2C = 3#
- GPS_L5 = 4#
- UNKNOWN = 0#
- class utils.enums.GnssSystem(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Enumeration class for GNSS signal constellations.
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- BEIDOU = 4#
- GALILEO = 2#
- GLONASS = 3#
- GPS = 1#
- IRNSS = 6#
- QZSS = 5#
- SBAS = 7#
- UNKNOWN = 0#
- class utils.enums.LoopLockState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Enumeration class for signal lock state of internal tracking loops
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- NARROW_TRACK = 3#
- PULL_IN = 1#
- UNKNOWN = 0#
- WIDE_TRACK = 2#
- class utils.enums.MeasurementType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Enumeration class for measurement types in the navigator.
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- CN0 = 4#
- DOPPLER = 2#
- PHASE = 3#
- PSEUDORANGE = 1#
- UNKNOWN = 0#
- class utils.enums.TrackingFlags(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
IntEnum
Tracking flags to represent the current stage of tracking. They are to be intepreted in binary format, to allow multiple state represesented in one decimal number. Similar to states in https://developer.android.com/reference/android/location/GnssMeasurement
- Attributes:
denominator
the denominator of a rational number in lowest terms
imag
the imaginary part of a complex number
numerator
the numerator of a rational number in lowest terms
real
the real part of a complex number
Methods
as_integer_ratio
(/)Return a pair of integers, whose ratio is equal to the original int.
bit_count
(/)Number of ones in the binary representation of the absolute value of self.
bit_length
(/)Number of bits necessary to represent self in binary.
conjugate
Returns self, the complex conjugate of any int.
from_bytes
(/, bytes[, byteorder, signed])Return the integer represented by the given array of bytes.
is_integer
(/)Returns True.
to_bytes
(/[, length, byteorder, signed])Return an array of bytes representing an integer.
- BIT_SYNC = 2#
- CODE_LOCK = 1#
- EPH_DECODED = 16#
- EPH_KNOWN = 64#
- FINE_LOCK = 128#
- SUBFRAME_SYNC = 4#
- TOW_DECODED = 8#
- TOW_KNOWN = 32#
- UNKNOWN = 0#
utils.rf_data_buffer module#
rf_data_buffer.py
file |
sturdr/rcvr/rf_data_buffer.py |
brief |
Helper for reading RF signal data across multiple processes. |
date |
October 2024 |
- class utils.rf_data_buffer.RfDataBuffer(*args)#
Bases:
object
Owner of the RF signal file.
Implemtation of a circular buffer utilizing
multiprocessing.shared_memory.SharedMemory
to quickly and easily share data between python instances!- Attributes:
- bittype
- buffer
- chunk_size_ms
- dtype
- file_id
- filepath
- is_complex
- memory
- nbytes
- samples_per_ms
- size
- write_ptr
Methods
Pull
(read_ptr, nsamples)Pull data from the circular buffer.
Push
(nms)Push new data into the circular buffer.
fclose
()Close open signal file
fread
(sample_length[, skip])Read specified amount of samples from the signal file
ftell
()Tell the current file location
GetNumUnreadSamples
UpdateWritePtr
fseek
- GetNumUnreadSamples(read_ptr: int)#
- Pull(read_ptr: int, nsamples: int)#
Pull data from the circular buffer.
- Parameters:
- read_ptrint
Starting index of the requested array
- nsamplesint
Size of the requested array
- Returns:
- np.ndarray
Requested array
- Push(nms: int)#
Push new data into the circular buffer. Shift the write index/pointer. NOTE: This should only get executed by the ChannelController/Receiver
- Parameters:
- datanp.ndarray
New data to be added to the buffer
- nmsint
Number of milliseconds to push
- Raises:
- ValueError
CircularBuffer.maxsize % data.size should be 0!
- UpdateWritePtr(shift: int)#
- bittype: dtype#
- buffer: ndarray#
- chunk_size_ms: int#
- dtype: dtype#
- fclose()#
Close open signal file
- file_id: BufferedReader#
- filepath: str#
- fread(sample_length: int, skip: int = 0)#
Read specified amount of samples from the signal file
- Parameters:
- time_lengthint
Number of milliseconds to read
- skipint, optional
Number of samples to skip, by GENERAL 0
- Returns:
- rfdatanp.ndarray
Data from the file read
- fseek(samp, offset)#
- ftell()#
Tell the current file location
- Returns:
- int
Current sample index
- Raises:
- Warning
No signal file open
- is_complex: bool#
- memory: SharedMemory#
- nbytes: int#
- samples_per_ms: int#
- size: int#
- write_ptr: int#