navigate.model.devices.daq.ni.NIDAQ
- class navigate.model.devices.daq.ni.NIDAQ(configuration: Dict[str, Any])
Bases:
DAQBase
NIDAQ class for Control of NI Data Acquisition Cards.
- __init__(configuration: Dict[str, Any]) → None
Initialize NIDAQ class.
- Parameters:
configuration (Dict[str, Any]) – Configuration dictionary.
Methods
__init__
(configuration)Initialize NIDAQ class.
calculate_all_waveforms
(microscope_name, ...)Pre-calculates all waveforms necessary for the acquisition and organizes in a dictionary format.
create_analog_output_tasks
(channel_key)Create analog output tasks for each board.
create_camera_task
(channel_key)Set up the camera trigger task.
Set up the DO master trigger task.
enable_microscope
(microscope_name)Enable microscope.
prepare_acquisition
(channel_key)Prepare the acquisition.
Restart analog task callback function.
Run DAQ Acquisition.
set_external_trigger
([external_trigger])Set trigger mode.
Stop Acquisition.
update_analog_task
(board_name)Update analog task.
wait_for_external_trigger
(trigger_channel[, ...])Wait for a digital external trigger.
Attributes
Configuration dictionary.
NI DAQmx task for camera trigger
NI DAQmx task for master trigger
NI DAQmx task for laser switching
Trigger mode.
NI DAQmx port for laser switching
Analog outputs.
NI DAQmx tasks for analog output.
Number of samples.
Current channel key.
Flag for updating analog task.
Flag for waiting to run.
- calculate_all_waveforms(microscope_name, exposure_times, sweep_times)
Pre-calculates all waveforms necessary for the acquisition and organizes in a dictionary format.
- Parameters:
microscope_name (str) – Name of the active microscope
exposure_times (dict) – Dictionary of exposure times for each selected channel
sweep_times (dict) – Dictionary of sweep times for each selected channel
- Returns:
self.waveform_dict – Dictionary of waveforms to pass to galvo and ETL, plus a camera waveform for display purposes.
- Return type:
dict
- create_analog_output_tasks(channel_key: str) → None
Create analog output tasks for each board.
Create a single analog output task for all channels per board. Most NI DAQ cards have only one clock for analog output sample timing, and as such all channels must be grouped here.
- Parameters:
channel_key (str) – Channel key for analog output.
- create_camera_task(channel_key: str) → None
Set up the camera trigger task.
TTL for triggering the camera. TTL is 4 ms in duration. Channel that the TTL is delivered from, and its delay (typically ~10 ms), are specified in the configuration.yaml file.
- Parameters:
channel_key (str) – Channel key for current channel.
- create_master_trigger_task() → None
Set up the DO master trigger task.
- enable_microscope(microscope_name: str) → None
Enable microscope.
- Parameters:
microscope_name (str) – Name of microscope to enable.
- prepare_acquisition(channel_key: str) → None
Prepare the acquisition.
Creates and configures the DAQ tasks. Writes the waveforms to each task.
- Parameters:
channel_key (str) – Channel key for current channel.
- static restart_analog_task_callback_func(task: Task) → callable
Restart analog task callback function.
- Parameters:
task (nidaqmx.Task) – Analog output task.
- Returns:
callback_func – Callback function
- Return type:
function
- run_acquisition() → None
Run DAQ Acquisition.
Run the tasks for triggering, analog and counter outputs. The master trigger initiates all other tasks via a shared trigger For this to work, all analog output and counter tasks have to be started so that they are waiting for the trigger signal.
- set_external_trigger(external_trigger=None) → None
Set trigger mode.
- Parameters:
external_trigger (nidaqmx.Task) – Task for external triggering
- stop_acquisition() → None
Stop Acquisition.
Stop all tasks and close them.
- update_analog_task(board_name: str) → Optional[bool]
Update analog task.
- Parameters:
board_name (str) – Name of board to update.
- Returns:
True if task is updated, False otherwise.
- Return type:
bool, None
- static wait_for_external_trigger(trigger_channel: str, wait_internal=0.001, timeout=-1) → bool
Wait for a digital external trigger.
- Parameters:
trigger_channel (str) – The name of the DAQ PFI digital input.
wait_internal (float) – The internal waiting time to check the trigger
timeout (float) – Continue on anyway if timeout is reached. timeout < 0 will run forever.
- Returns:
result – True for the trigger, False for no trigger.
- Return type:
bool
- analog_output_tasks
NI DAQmx tasks for analog output.
- Type:
dict
- analog_outputs
Analog outputs.
- Type:
dict
- camera_delay
Camera delay percentage
- Type:
float
- camera_trigger_task
NI DAQmx task for camera trigger
- Type:
obj
- configuration
Configuration dictionary.
- Type:
dict
- current_channel_key
Current channel key.
- Type:
str
- daq_parameters
Dictionary of DAQ parameters
- Type:
dict
- exposure_times
exposure times for different channels
- Type:
dict
- external_trigger
NI DAQmx port for laser switching
- Type:
str
- is_updating_analog_task
Flag for updating analog task.
- Type:
bool
- laser_switching_task
NI DAQmx task for laser switching
- Type:
obj
- master_trigger_task
NI DAQmx task for master trigger
- Type:
obj
- microscope_name
Name of the active microscope
- Type:
str
- n_sample
Number of samples.
- Type:
float
- sample_rate
Sample rate of the DAQ
- Type:
float
- sweep_times
Sweep times for different channels
- Type:
dict
- trigger_mode
Trigger mode. Self-trigger or external-trigger.
- Type:
str
- wait_to_run_lock
Flag for waiting to run.
- Type:
bool
- waveform_constants
Dictionary of waveform constants
- Type:
dict
- waveform_dict
Dictionary of waveforms.
- Type:
dict
- waveform_expand_num
Number of times to expand the waveform
- Type:
int
- waveform_repeat_num
Number of times to repeat the waveform
- Type:
int