Asynchronous instruments implementation¶
Asynchronous extension of fluidlab.interfaces.QueryInterface
(pymanip.interfaces.aiointer
)¶
This module defines AsyncQueryInterface
as the default subclass for fluidlab.interfaces.QueryInterface
.
The default implementation simply runs the methods of QueryInterface
into an executor, therefore in a separate thread. Because the parent class is probably not thread-safe, each call is protected by a lock to prevent concurrent calls to the instrument. However, the main thread is released and other tasks can be run on other instruments.
The methods that are defined in this way are __aenter__()
, __aexit__()
, _aread()
, _awrite()
, _aquery()
and await_for_srq()
. The higher lever co-routine methods aread()
, awrite()
and aquery()
simply checks that the interface is opened, and then awaits the low-level method, in a similar fashion as in the QueryInterface
class.
Therefore, concrete subclass such as pymanip.interfaces.aioserial.AsyncSerialInterface
, or pymanip.interfaces.aiovisa.AsyncVISAInterface
only have to override the low-level co-routine methods (if necessary).
-
class
pymanip.interfaces.aiointer.
AsyncQueryInterface
[source]¶ This class represents an asynchronous Query interface. It is a subclass of the synchronous QueryInterface defined in FluidLab. The input parameters are those of QueryInterface.
Concrete subclasses may replace the
lock
attribute, and replace it by a global board lock if necessary.-
async
_aquery
(command, time_delay=0.1, **kwargs)[source]¶ Low-level co-routine to write/read a query. This method does not check whether the interface is opened. There are two cases:
-
async
_aread
(*args, **kwargs)[source]¶ Low-level co-routine to read data from the instrument. This method does not check whether the interface is opened. In this basic class, it simply acquires the interface lock and runs the
_read()
method in an executor.
-
async
_awrite
(*args, **kwargs)[source]¶ Low-level co-routine to send data to the instrument. This method does not check whether the interface is opened. In this basic class, it simply acquires the interface lock and runs the
_write()
method in an executor.
-
async
aquery
(command, time_delay=0.1, **kwargs)[source]¶ This co-routine method queries the instrument. The parameters are identical to those of the
query()
method.
-
async
Asynchronous extension of fluidlab.interfaces.SerialInterface
(pymanip.interfaces.aioserial
)¶
This module defines AsyncSerialInterface
as a subclass of fluidlab.interfaces.serial_inter.SerialInterface
and
pymanip.interface.aiointer.AsyncQueryInterface
.
-
class
pymanip.interfaces.aioserial.
AsyncSerialInterface
(port, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False, eol=None, multilines=False, autoremove_eol=False)[source]¶ This class is an asynchronous extension of
fluidlab.interfaces.serial_inter.SerialInterface
. It inherits all its methods from the parent classes.
Asynchronous extension of fluidlab.interfaces.VISAInterface
(pymanip.interfaces.aiovisa
)¶
This module defines AsyncVISAInterface
as a subclass of fluidlab.interfaces.visa_inter.VISAInterface
and
pymanip.interface.aiointer.AsyncQueryInterface
.
Asynchronous instruments module (pymanip.aioinstruments
)¶
This module auto-imports all the asynchronous instrument classes.
Asynchronous Instrument drivers (pymanip.aioinstruments.aiodrivers
)¶
This module defines a subclass of fluidlab.instruments.drivers.Driver
where
the QueryInterface attribute is replaced by the corresponding AsyncQueryInterface
instance. The asynchronous context manager is bound to the interface asynchronous context
manager.
-
pymanip.aioinstruments.aiodrivers.
interface_from_string
(name, default_physical_interface=None, **kwargs)[source]¶ This function is similar to
fluidlab.interfaces.interface_from_string()
except that it returns an instance ofAsyncQueryInterface
instead ofQueryInterface
.
-
class
pymanip.aioinstruments.aiodrivers.
AsyncDriver
(interface=None)[source]¶ This class is an asynchronous extension of
fluidlab.instruments.drivers.Driver
.
Asynchronous Instrument features (pymanip.aioinstruments.aiofeatures
)¶
Asynchronous extension of fluidlab instrument features. The main difference is that they
define aget()
and aset()
co-routine methods. The original get()
and
set()
are not overridden, and may still be used.
-
class
pymanip.aioinstruments.aiofeatures.
AsyncQueryCommand
(name, doc='', command_str='', parse_result=None)[source]¶
-
class
pymanip.aioinstruments.aiofeatures.
AsyncValue
(name, doc='', command_set=None, command_get=None, check_instrument_value=True, pause_instrument=0.0, channel_argument=False)[source]¶
-
class
pymanip.aioinstruments.aiofeatures.
AsyncNumberValue
(name, doc='', command_set=None, command_get=None, limits=None, check_instrument_value=True, pause_instrument=0.0, channel_argument=False)[source]¶
-
class
pymanip.aioinstruments.aiofeatures.
AsyncFloatValue
(name, doc='', command_set=None, command_get=None, limits=None, check_instrument_value=True, pause_instrument=0.0, channel_argument=False)[source]¶
-
class
pymanip.aioinstruments.aiofeatures.
AsyncBoolValue
(name, doc='', command_set=None, command_get=None, check_instrument_value=True, pause_instrument=0.0, channel_argument=False, true_string='1', false_string='0')[source]¶
Asynchronous IEC60488 instrument driver (pymanip.aioinstruments.aioiec60488
)¶
This module defines an asynchronous subclass of
fluidlab.instruments.iec60488.IEC60488
.
-
class
pymanip.aioinstruments.aioiec60488.
AsyncIEC60488
(interface=None)[source]¶ -
aclear_status
= <function AsyncWriteCommand._build_driver_class.<locals>.func>¶
-
aquery_esr
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
aquery_stb
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
aquery_identification
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
areset_device
= <function AsyncWriteCommand._build_driver_class.<locals>.func>¶
-
aperform_internal_test
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
await_till_completion_of_operations
= <function AsyncWriteCommand._build_driver_class.<locals>.func>¶
-
aget_operation_complete_flag
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
await_continue
= <function AsyncQueryCommand._build_driver_class.<locals>.func>¶
-
async
aclear_status
() Clears the data status structure
-
async
aget_operation_complete_flag
() Get operation complete flag
-
async
aperform_internal_test
() Perform internal self-test
-
async
aquery_esr
() Query the event status register
-
async
aquery_identification
() Identification query
-
async
aquery_stb
() Query the status register
-
async
areset_device
() Perform a device reset
-
async
await_continue
() Wait to continue
-
async
await_till_completion_of_operations
() Return “1” when all operation are completed
-
event_status_enable_register
= <pymanip.aioinstruments.aiofeatures.AsyncRegisterValue object>¶
-
status_enable_register
= <pymanip.aioinstruments.aiofeatures.AsyncRegisterValue object>¶
-