Device Group
- exception pyflind.group.FliDeviceGroupError
Bases:
ExceptionGeneral purpose exception for FliDeviceGroup errors.
- class pyflind.group.SyncState(*values)
Bases:
EnumState of stream synchronization for devices in a group.
- class pyflind.group.FliDeviceGroup
Bases:
objectGroup of FliDevice objects to be treated as a single unit.
A device group is primarily used to synchronize data streams from multiple FliDevice objects which are physically sharing a PPS signal. These devices may have PPS inputs and PPS outputs daisy-chained together, or they may be independently driven by PPS signals which themselves are synchronized, e.g. from GPS modules. The problem of clock drift between devices is not solved live, but the streams are synchronized to a common point in time after which blocks of samples can be read from all devices easily. The data streams can be resampled separately using the pps_clock_count stream as a reference against which device specific clock drifts can be computed and corrected for.
When using a device group to manage multiple FliDevice objects the streaming configuration should only be altered via the device group rather than configuring streams directly on the individual devices in the group.
- add_device(dev, stream_block_size=10)
Add a device to the group.
- Parameters:
dev – FliDevice object
stream_block_size – streaming data block size
- Returns:
device ID in group
- Return type:
str
- del_device(dev_id)
Delete a device from the group.
- Parameters:
dev_id – device ID to delete
- get_devices()
Get a list of devices in the group.
- Returns:
list of device IDs
- Return type:
list(str)
- get_sync_state()
Get the group synchronization state.
- Returns:
state of group sync
- Return type:
- stream_sync(timeout=10, additional_devices=[])
Perform a stream synchronization on all devices in the group.
- Parameters:
timeout – time in seconds to wait for sync
additional_devices – list of additional FliDevice objects to sync
- get_samples()
Read all buffered stream samples.
Stream blocks from all devices are collated by sample index and returned in one dict for all devices streams when this function is called.
- Returns:
key=dev_id:stream_id, value=np.array of samples
- Return type:
dict
- get_samplerate()
Get the streaming samplerate.
- Returns:
samplerate in Hz
- Return type:
float
- set_samplerate(fs)
Set the streaming samplerate of all devices.
- Parameters:
fs – requested samplerate in Hz
- configure_stream(sid, enable, timeout=10)
Configure a data stream on all devices.
- Parameters:
sid – stream name or id
enable – True to enable, False to disable
timeout – seconds to wait for stream, 0 for no wait
- reset_schedule()
Reset the streaming schedule on all devices.
- set_register(address, value)
Write a register value on all devices.
- Parameters:
address – register name or address
value – register value