Generation

Generation#

The signal generation can also be added to the LDAQ.Core class. Here, an example using the National Instruments DAQmx driver is shown.

The signal must be prepared by the user (here we recommend to check pyExSi).

import numpy as np

fs = 25600 # output sample rate
t = np.arange(fs * 10) / fs
signal1 = np.sin(2*np.pi*800*t)
signal2 = np.sin(2*np.pi*450*t)

signal = np.array([signal1, signal2]).T # shape must be (n_samples, n_channels)

Signal array is then passed to the LDAQ.national_instruments.NIGeneration class. The first argument, task, must be either an AOTask object (see Output task) or an output task name string defined in NI MAX.

gen = LDAQ.national_instruments.NIGeneration(output_task_name, signal)

The gen object can then be added to the LDAQ.Core class:

ldaq = LDAQ.Core(acq, gen)

acq is the acquisition object, see first example.

When the .run() method is called, the signal is generated and the acquisition is started.

Note

For generating the signal on multiple channels, the signal must be a numpy array with the shape (n_samples, n_channels).