Synchronous acquisition functions¶
This section describes the synchronous functions implemented in pymanip
for
signal acquisition on DAQmx and Scope boards.
New scripts should preferably use the newer pymanip.aiodaq
instead.
DAQmx acquisition module (pymanip.daq.DAQmx
)¶
The fluidlab.daq.daqmx
module is a simple functional front-end to
the third-party PyDAQmx
module. It mainly provides two simple one-liner functions:
The pymanip.daq.DAQmx
module is essentially based on its fluidlab counterpart, with
other choices for the default values of arguments, and an additionnal autoset feature for
the read_analog()
function.
It also adds a convenience function for printing the list of DAQmx devices, used by the
pymanip CLI interface.
A discovery function is also added, print_connected_devices()
, based
on the dedicated DAQDevice
class, which is used by the
list_daq sub-command on pymanip command line.
-
class
pymanip.daq.DAQmx.
DAQDevice
(device_name)[source]¶ This class is represents a DAQmx device.
- Parameters
device_name (str) – name of the DAQmx device, e.g. “Dev1”
It mostly implement a number of property getters, which are wrappers to the
PyDAQmx
low-level functions.In addition, it has a static method,
list_connected_devices()
to discover currently connected devices.-
property
ai_chans
¶ List of the analog input channels on the device
-
property
ao_chans
¶ List of the analog output channels on the device
-
property
bus_type
¶ Bus type connection to the device
-
property
di_lines
¶ List of digital input lines on the device
-
property
di_ports
¶ List of digital input ports on the device
-
property
do_lines
¶ List of digital output lines on the device
-
property
do_ports
¶ List of digital output ports on the device
-
static
list_connected_devices
()[source]¶ This static method discovers the connected devices.
- Returns
connected devices
- Return type
list of
pymanip.daq.DAQmx.DAQDevice
objects
-
property
location
¶ Description of the location (PCI bus and number, or PXI chassis and slot)
-
property
pci_busnum
¶ PCI Bus number
-
property
pci_devnum
¶ PCI Device number
-
property
product_category
¶ Device product category (str)
-
property
product_num
¶ Device product num
-
property
product_type
¶ Device product type
-
property
pxi_chassisnum
¶ PXI Chassis number
-
property
pxi_slotnum
¶ PXI Slot number
-
pymanip.daq.DAQmx.
print_connected_devices
()[source]¶ This function prints the list of connected DAQmx devices.
-
pymanip.daq.DAQmx.
read_analog
(resource_names, terminal_config, volt_min=None, volt_max=None, samples_per_chan=1, sample_rate=1, coupling_types='DC', output_filename=None, verbose=True)[source]¶ This function reads signal from analog input.
- Parameters
resources_names – names from MAX (Dev1/ai0)
terminal_config (str, or list) – “Diff”, “RSE”, “NRSE”
volt_min (float, or list, optional) – minimum voltage
volt_max (float, or list, optional) – maximum voltage
samples_per_chan (int) – Number of samples to be read per channel
sample_rate (float) – Clock frequency
coupling_type (str, or list) – Coupling of the channels (“DC”, “AC”, “GND”)
output_filename (str, optional) – If not None, file to write the acquired data
verbose (bool, optional) – Verbosity level. Defaults to True (unlike in Fluidlab)
If the channel range is not specified, a 5.0 seconds samples will first be acquired to determine appropriate channel range (autoset feature).
Scope acquisition module (pymanip.daq.Scope
)¶
This module implements a read_analog()
similar to that of the
DAQmx
module, but for Scope devices.
It uses the niScope
module from National Instruments.
-
pymanip.daq.Scope.
read_analog
(scope_name, channelList='0', volt_range=10.0, samples_per_chan=100, sample_rate=1000.0, coupling_type='DC')[source]¶ This function reads signal from a digital oscillosope.
- Parameters
scope_name – name of the NI-Scope device (e.g. ‘Dev3’)
channelList (str) – comma-separated string of channel number (e.g. “0”)
volt_range (float) – voltage range
samples_per_chan (int) – number of samples to read per channel
sample_rate (float) – for 5922 60e6/n avec n entre 4 et 1200
coupling_type (str) – ‘DC’, ‘AC’, ‘GND’