mahos.inst.daq.AnalogIn#
- class mahos.inst.daq.AnalogIn(name, conf=None, prefix=None)#
A configurable DAQ Task class for Analog Input voltage channel.
This class supports buffered clock-mode and on-demand-mode. In clock-mode, readings are synchronized to a clock, buffered, and read at each cb_samples. In on-demand-mode, data are read on get(“data”) request.
- Parameters:
lines (list[str]) – list of strings to designate DAQ’s physical channels.
queue_size (int) – (default: 10000) Software buffer (queue) size for acquired data.
silent (bool) – (default: False) Enable silent mode. Don’t message warning on queue overflow.
clock_mode (bool) – If True (False), configures as clock-mode (on-demand-mode).
bounds (list[tuple[float, float]]) – bounds (min, max) values of the expected input voltages per channels.
clock (str) – DAQ terminal for clock.
cb_samples (int) – The number of samples for each callback.
samples (int) – The number of samples. In infinite mode (finite=False), this is used for automatic buffer allocation.
buffer_size (int | None) – The input buffer size. If not given, buffer size is not set manually (automatic buffer allocation is used).
rate (float) – (default: 10000.0) Estimated sampling rate.
clock_dir (bool) – (default: True) True (False) for rising (falling) edge clock.
finite (bool) – (default: True) Switch if finite mode or infinite mode.
every (bool) – (default: False) Switch if every1 mode or not.
stamp (bool) – (default: False) Attach timestamp for each samples.
drop_first (int) – (default: 0) drop the data on first N callbacks.
oversample (int) – (default: 1) cb_samples, samples, and buffer_size are multiplied by oversample, and everyN_handler is passed mean of oversample readings.
Finite or Infinite mode#
In finite mode (finite=True), task is finished with samples. In inifinite mode (finite=False), task continues infinitely but it can be stopped by stop().
On some device, we cannot call EveryNCallBack at arbitrary cb_samples in infinite mode. (For example, buffer size must be even integer multiple of cb_samples.) Setting buffer_size explicitly, or every=True may resolve such a situation.
Callback handlers#
You’d pass three callback handler functions: every1_handler, everyN_handler, and done_handler. If every1 mode (every=True), EveryNCallBack is called with N=1 regardress of cb_samples. And every1_handler is called at each callbacks. EveryNCallBack aquires data and call everyN_handler at each cb_samples callbacks. If every1 mode is inactive (every=False), EveryNCallBack is called after acquiring cb_samples, and everyN_handler is called for each callback. In this mode every1_handler is never called.
- __init__(name, conf=None, prefix=None)#
Methods
__init__
(name[, conf, prefix])configure
(params[, label])Configure the instrument settings.
configure_clock
(params)configure_on_demand
(params)get
(key[, args, label])Get an instrument setting or measurement data.
get_buffer_size
()get_data_transfer
(channel)Get current transfer mechanism of channel.
get_max_rate
()pop_all_block
()Get all data from buffer as list.
pop_all_opt
()Get all data from buffer as list.
pop_block
()Get data from buffer.
pop_opt
()Get data from buffer.
read_on_demand
([oversample])Read out analog voltages on demand.
set_buffer_size
(size)set_data_transfer
(channel, mode)Set current transfer mechanism of channel.