- class TMSiSDK.device.devices.saga.saga_device.SagaDevice(id: int, dr_interface: DeviceInterfaceType, dr_serial_number: int, ds_interface: DeviceInterfaceType, ds_serial_number: int)#
Bases:
TMSiDevice
A class to represent and handle the Saga
- __init__(id: int, dr_interface: DeviceInterfaceType, dr_serial_number: int, ds_interface: DeviceInterfaceType, ds_serial_number: int)#
Initialize the Device
- Parameters:
id (int) – index of the device
dr_interface (DeviceInterfaceType) – interface DR-DS
dr_serial_number (int) – serial number of the DR
ds_interface (DeviceInterfaceType) – interface DS-computer
ds_serial_number (int) – serial number of the DS
Methods
__init__
(id, dr_interface, dr_serial_number, ...)Initialize the Device
apply_mask
(n_channels, masks)Apply a mask to the received channels
close
()Closes the connection to the device.
discover
(ds_interface[, num_retries])Discovers available devices.
download_file_from_device
(file_id[, filename])Creates a data stream to download the file from the device.
export_configuration
(filename)Exports the current configuration to an xml file.
Gets configuration for card recording.
Get card status
Gets the list of active channels.
Gets the list of active impedance channels.
Get bandwidths of the device
get_device_card_file_info
(file_id)Gets the information of the file on the device's card.
Function to be overridden by the child class.
Gets the list of channels.
get_device_data
(POINTER_received_data_array, ...)Gets data from the device during sampling.
Returns the value of the device handle.
Gets the list of impedance channels.
get_device_impedance_data
(**kwargs)Function to be overridden by the child class.
get_device_info_report
(**kwargs)Function to be overridden by the child class.
Get device interface
Gets the list of available devices.
Get name of the device
get_device_power_status
(**kwargs)Function to be overridden by the child class.
Get device references
Get device repair logging
get_device_sampling_config
(**kwargs)Function to be overridden by the child class.
get_device_sampling_frequency
([detailed])Gets the sampling frequency.
Gets the serial number of the device.
Gets the state of the device.
Get device sync out configuration
get_device_time
(**kwargs)Function to be overridden by the child class.
Get device triggers
Returns the device type.
get_dongle_list
(**kwargs)Function to be overridden by the child class.
get_dongle_serial_number
(**kwargs)Function to be overridden by the child class.
get_downloaded_percentage
(**kwargs)Function to be overridden by the child class.
Returns the interface of the device.
get_event
(**kwargs)Function to be overridden by the child class.
get_event_buffer
(**kwargs)Function to be overridden by the child class.
get_file_channels
(file_id)Gets the list of channels from the file.
get_id
()Gets the device id.
get_live_impedance
(**kwargs)Function to be overridden by the child class.
Returns the number of active channels of the device.
Returns the number of active impedance channels of the device.
Returns the number of channels of the device.
get_num_impedance_channels
(**kwargs)Function to be overridden by the child class.
get_sdk
()Gets the handle of the communication library
import_configuration
(filename)Imports the file configuration to the device.
open
()Opens the connection with the device.
pair_device
(**kwargs)Function to be overridden by the child class.
Reload information from device
Resets the memory card of the device.
Resets the incoming buffer.
reset_device_event_buffer
(**kwargs)Function to be overridden by the child class.
Reset masks
Resets the device to default configuration.
set_card_recording_config
(config)Sets the configuration for recording on card.
set_device_active_channels
(indices, activate)Set the activity of the channel.
set_device_backup_logging
([enable, ...])Set the backup logging during acquisition
set_device_channel_names
(names, indices)Sets the device channel names
set_device_download_file_request
(file_id[, ...])Sets the download file request to start or stop the download stream.
set_device_impedance_request
(measurement_request)Sets the impedance request to start or stop the acquisition.
set_device_interface
(device_interface)Set device interface DS-DR
set_device_references
([reference_method, ...])Set references for the device
set_device_repair_logging
([...])Set device repair logging
set_device_sampling_config
([...])Set sampling configuration for the device
set_device_sampling_request
(measurement_request)Sets the sampling request to start or stop the acquisition.
set_device_sync_out_config
([marker, ...])Set configuration sync out
set_device_time
(**kwargs)Function to be overridden by the child class.
set_device_triggers
(triggers)Set device triggers
start_download_file
(file_id[, filename, ...])Starts the download of the file requested.
start_measurement
(measurement_type[, ...])Starts the measurement requested.
Stops the download of the file.
Stops the measurement requested.
Interrupts the download after user abort command.
- apply_mask(n_channels, masks)#
Apply a mask to the received channels
- Parameters:
n_channels (int) – list of indices of channels
masks (function) – list of mask functions
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if wrogn arguments
- close()#
Closes the connection to the device.
- discover(ds_interface: DeviceInterfaceType, num_retries: int = 3)#
Discovers available devices.
- Parameters:
dr_interface (DeviceInterfaceType) – dr device interface to be searched. Allowed interfaces: docked, wifi and optical.
ds_interface (DeviceInterfaceType) – ds device interface to be searched. Allowed interfaces: usb and network.
num_retries – Number of retries, optional
- download_file_from_device(file_id: int, filename: str = None)#
Creates a data stream to download the file from the device.
- Parameters:
file_id (int) – id of the file to download.
filename (str, optional) – filename where to write the impedance report (if available), defaults to None
- Raises:
- export_configuration(filename: str)#
Exports the current configuration to an xml file.
- get_card_recording_config() TMSiDevRecCfg #
Gets configuration for card recording.
- Raises:
- Returns:
Configuration of the card recording.
- Return type:
- get_card_status() SagaCardStatus #
Get card status
- Raises:
TMSiError – TMSiErrorCode.device_not_connected if not connected.
- Returns:
saga card status
- Return type:
- get_device_active_channels()#
Gets the list of active channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[SagaChannel]
- get_device_active_impedance_channels()#
Gets the list of active impedance channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[SagaChannel]
- get_device_bandwidth()#
Get bandwidths of the device
- Returns:
Bandwidths of the device
- Return type:
dict
- get_device_card_file_info(file_id: int) dict #
Gets the information of the file on the device’s card.
- Parameters:
file_id (int) – Id of the file to be investigated.
- Raises:
- Returns:
A dictionary with file metadata and impedance report.
- Return type:
{“metadata”:TMSiDevRecDetails, “impedance_report”: [TMSiDevImpReport]}
- get_device_card_file_list()#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_channels() list #
Gets the list of channels.
- Raises:
- Returns:
The list of channels
- Return type:
list[SagaChannel]
- get_device_data(POINTER_received_data_array: pointer, buffer_size: int, POINTER_num_of_sets: pointer, POINTER_data_type: pointer) TMSiDeviceRetVal #
Gets data from the device during sampling.
- Parameters:
POINTER_received_data_array (pointer(array[c_float])) – array that will contain the received data.
buffer_size (int) – maximum size of the buffer.
POINTER_num_of_sets (pointer(c_uint)) – number of sets of data received.
POINTER_data_type (pointer(c_int)) – type of data received.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if device is notin samplin modeg
- Returns:
return value of the call
- Return type:
- get_device_handle_value() int #
Returns the value of the device handle.
- Returns:
Device handle.
- Return type:
int
- get_device_impedance_channels() list #
Gets the list of impedance channels.
- get_device_impedance_data(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_info_report(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_interface()#
Get device interface
- Returns:
device interface
- Return type:
- get_device_list() list #
Gets the list of available devices.
- Returns:
a list of available devices on the requested interface.
- Return type:
list[SagaDevice]
- get_device_name()#
Get name of the device
- Returns:
name of the device
- Return type:
str
- get_device_power_status(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_references()#
Get device references
- Returns:
A dictionary whith reference and autoreference
- Return type:
dict
- get_device_repair_logging()#
Get device repair logging
- Returns:
return if repair logging is enabled or not
- Return type:
bool
- get_device_sampling_config(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_sampling_frequency(detailed=False) int #
Gets the sampling frequency.
- Parameters:
detailed (bool, optional) – detailed frequency description, defaults to False
- Returns:
sampling frequency or frequencies.
- Return type:
int or dictionary if detailed
- get_device_serial_number() int #
Gets the serial number of the device.
- Returns:
serial number of the device.
- Return type:
int
- get_device_state() DeviceState #
Gets the state of the device.
- Returns:
the device state.
- Return type:
- get_device_sync_out_config()#
Get device sync out configuration
- Returns:
information about the sync out
- Return type:
dict
- get_device_time(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_device_triggers()#
Get device triggers
- Returns:
True if triggers enabled, False otherwise
- Return type:
boolean
- get_device_type() str #
Returns the device type.
- Returns:
the device type.
- Return type:
str
- get_dongle_list(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_dongle_serial_number(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_downloaded_percentage(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_dr_interface() DeviceInterfaceType #
Returns the interface of the device.
- Returns:
the interface of the device.
- Return type:
- get_event(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_event_buffer(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_file_channels(file_id)#
Gets the list of channels from the file.
- Parameters:
file_id (int) – id of the file
- Returns:
The list of channels
- Return type:
list[ApexChannel]
- get_id() int #
Gets the device id.
- Returns:
the device id.
- Return type:
int
- get_live_impedance(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_num_active_channels() int #
Returns the number of active channels of the device.
- Returns:
number of active channels of the device.
- Return type:
int
- get_num_active_impedance_channels() int #
Returns the number of active impedance channels of the device.
- Returns:
number of active impedance channels of the device.
- Return type:
int
- get_num_channels() int #
Returns the number of channels of the device.
- Returns:
number of channels of the device.
- Return type:
int
- get_num_impedance_channels(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- get_sdk() CDLL #
Gets the handle of the communication library
- Returns:
the handle of the communication library.
- Return type:
CDLL
- import_configuration(filename: str)#
Imports the file configuration to the device.
- open()#
Opens the connection with the device.
- pair_device(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- reload_device()#
Reload information from device
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if device is not in connected state
- reset_device_card()#
Resets the memory card of the device.
- reset_device_data_buffer()#
Resets the incoming buffer.
- reset_device_event_buffer(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- reset_masks()#
Reset masks
- reset_to_factory_default()#
Resets the device to default configuration. To fully complete the progress, please : 1. close the connection with the device, 2. undock your data recorder and remove batteries.
- set_card_recording_config(config: TMSiDevRecCfg) TMSiDevRecCfg #
Sets the configuration for recording on card.
- Parameters:
config (TMSiDevRecCfg) – configuration to be set.
- Raises:
- Returns:
the new available configuration for recording on card.
- Return type:
- set_device_active_channels(indices, activate)#
Set the activity of the channel.
- Parameters:
indices (list[int]) – list of indices to activate/deactivate
activate (bool) – True to activate, False to deactivate
- set_device_backup_logging(enable=True, prefix_filename: str = None)#
Set the backup logging during acquisition
- Parameters:
enable (bool, optional) – True if enabled, False otherwise, defaults to True
prefix_filename (str, optional) – Prefix for the file name to save on the device card, defaults to None
- set_device_channel_names(names: list, indices: list) list #
Sets the device channel names
- Parameters:
names (list[str]) – names to be set.
indices (list[int]) – index of the channels to edit.
- Raises:
- Returns:
list of new channels.
- Return type:
list[SagaChannel]
- set_device_download_file_request(file_id, download=True)#
Sets the download file request to start or stop the download stream.
- Parameters:
file_id (int) – id of the file to download
download (bool, optional) – True if to download, False to stop, defaults to True
- Raises:
- set_device_impedance_request(measurement_request: TMSiDevImpReq)#
Sets the impedance request to start or stop the acquisition.
- set_device_interface(device_interface)#
Set device interface DS-DR
- Parameters:
device_interface (DeviceInterfaceType) – Interface between DS and DR
- Raises:
ValueError – if interface is not of type DeviceInterfaceType
TMSiError – TMSiErrorCode.api_incompatible_configuration if interface is not allowed
- set_device_references(reference_method=None, auto_reference_method=None)#
Set references for the device
- Parameters:
reference_method (ReferenceMethod, optional) – reference method to apply to UNI channels, defaults to None
auto_reference_method (ReferenceSwitch, optional) – reference method to switch to UNI channels if common mode is disconnected, defaults to None
- set_device_repair_logging(enable_repair_logging=True)#
Set device repair logging
- Parameters:
enable_repair_logging (bool, optional) – enable or not the repair logging, defaults to True
- Raises:
TMSiError – device_not_connected if not in connected state.
- set_device_sampling_config(base_sample_rate=None, channel_type=None, channel_divider=1)#
Set sampling configuration for the device
- Parameters:
base_sample_rate (SagaBaseSampleRate, optional) – Base sample rate, defaults to None
channel_type (ChannelType, optional) – Channel type to set, defaults to None
channel_divider (int, optional) – channel divider to apply to this type of channels, defaults to 1. Possible numbers are 1, 2, 4 or 8
- set_device_sampling_request(measurement_request: TMSiDevSampleReq)#
Sets the sampling request to start or stop the acquisition.
- Parameters:
measurement_request (TMSiDevSampleRequest) – measurement request to configure the acquisition.
- Raises:
- set_device_sync_out_config(marker=False, frequency=None, duty_cycle=None)#
Set configuration sync out
- Parameters:
marker (bool, optional) – marker, defaults to False
frequency (float, optional) – frequency of the sync out, defaults to None
duty_cycle (float, optional) – duty cycle of the sync out, defaults to None
- Raises:
TMSiError – TMSiErrorCode.device_not_connected if not in connected state
- set_device_time(**kwargs)#
Function to be overridden by the child class.
- Raises:
NotImplementedError – Must be overridden by the child class.
- set_device_triggers(triggers)#
Set device triggers
- Parameters:
triggers (bool) – True if enabled, False otherwise
- Raises:
TMSiError – device_not_connected if not in connected state
- start_download_file(file_id: int, filename: str = None, n_of_samples: int = None)#
Starts the download of the file requested.
- Parameters:
file_id (int) – id of the file to download.
filename (str, optional) – filename where to write the impedance report (if available), defaults to None
- Raises:
- start_measurement(measurement_type: MeasurementType, thread_refresh=None)#
Starts the measurement requested.
- Parameters:
measurement_type (MeasurementType) – measurement to start
thread_refresh (float, optional.) – refresh time for sampling and conversion threads, defaults to None.
- Raises:
- stop_download_file()#
Stops the download of the file.
- Raises:
TMSiError – TMSiErrorCode.api_invalid_command if not sampling.
- stop_measurement()#
Stops the measurement requested.
- user_abort_download()#
Interrupts the download after user abort command.