Qudi
Public Member Functions | Public Attributes | List of all members
national_instruments_x_series.NationalInstrumentsXSeries Class Reference

A National Instruments device that can count and control microvave generators. More...

Inheritance diagram for national_instruments_x_series.NationalInstrumentsXSeries:
Inheritance graph
[legend]
Collaboration diagram for national_instruments_x_series.NationalInstrumentsXSeries:
Collaboration graph
[legend]

Public Member Functions

def on_activate (self)
 Starts up the NI Card at activation.
 
def on_deactivate (self)
 Shut down the NI card.
 
def get_constraints (self)
 Get hardware limits of NI device. More...
 
def set_up_clock (self, clock_frequency=None, clock_channel=None, scanner=False, idle=False)
 Configures the hardware clock of the NiDAQ card to give the timing. More...
 
def set_up_counter (self, counter_channels=None, sources=None, clock_channel=None, counter_buffer=None)
 Configures the actual counter with a given clock. More...
 
def get_counter_channels (self)
 Returns the list of counter channel names. More...
 
def get_counter (self, samples=None)
 Returns the current counts per second of the counter. More...
 
def close_counter (self, scanner=False)
 Closes the counter or scanner and cleans up afterwards. More...
 
def close_clock (self, scanner=False)
 Closes the clock and cleans up afterwards. More...
 
def reset_hardware (self)
 Resets the NI hardware, so the connection is lost and other programs can access it. More...
 
def get_scanner_axes (self)
 Scanner axes depends on how many channels tha analog output task has.
 
def get_scanner_count_channels (self)
 Return list of counter channels.
 
def get_position_range (self)
 Returns the physical range of the scanner. More...
 
def set_position_range (self, myrange=None)
 Sets the physical range of the scanner. More...
 
def set_voltage_range (self, myrange=None)
 Sets the voltage range of the NI Card. More...
 
def set_up_scanner_clock (self, clock_frequency=None, clock_channel=None)
 Configures the hardware clock of the NiDAQ card to give the timing. More...
 
def set_up_scanner (self, counter_channels=None, sources=None, clock_channel=None, scanner_ao_channels=None)
 Configures the actual scanner with a given clock. More...
 
def scanner_set_position (self, x=None, y=None, z=None, a=None)
 Move stage to x, y, z, a (where a is the fourth voltage channel). More...
 
def get_scanner_position (self)
 Get the current position of the scanner hardware. More...
 
def scan_line (self, line_path=None, pixel_clock=False)
 Scans a line and return the counts on that line. More...
 
def close_scanner (self)
 Closes the scanner and cleans up afterwards. More...
 
def close_scanner_clock (self)
 Closes the clock and cleans up afterwards. More...
 
def set_up_odmr_clock (self, clock_frequency=None, clock_channel=None)
 Configures the hardware clock of the NiDAQ card to give the timing. More...
 
def set_up_odmr (self, counter_channel=None, photon_source=None, clock_channel=None, odmr_trigger_channel=None)
 Configures the actual counter with a given clock. More...
 
def set_odmr_length (self, length=100)
 Sets up the trigger sequence for the ODMR and the triggered microwave. More...
 
def count_odmr (self, length=100)
 Sweeps the microwave and returns the counts on that sweep. More...
 
def close_odmr (self)
 Closes the odmr and cleans up afterwards. More...
 
def get_odmr_channels (self)
 
def close_odmr_clock (self)
 Closes the odmr and cleans up afterwards. More...
 
def get_status (self)
 Receives the current status of the Fast Counter and outputs it as return value. More...
 
def set_up_gated_counter (self, buffer_length, read_available_samples=False)
 Initializes and starts task for external gated photon counting. More...
 
def start_gated_counter (self)
 Actually start the preconfigured counter task. More...
 
def get_gated_counts (self, samples=None, timeout=None, read_available_samples=False)
 Returns latest count samples acquired by gated photon counting. More...
 
def stop_gated_counter (self)
 Actually start the preconfigured counter task. More...
 
def close_gated_counter (self)
 Clear tasks, so that counters are not in use any more. More...
 
def digital_channel_switch (self, channel_name, mode=True)
 
- Public Member Functions inherited from core.module.BaseMixin
def __init__ (self, manager, name, config=None, callbacks=None, kwargs)
 Initialise Base class object and set up its state machine. More...
 
def log (self)
 Returns a logger object.
 
def is_module_threaded (self)
 Returns whether the module shall be started in a thread.
 
def on_activate (self)
 Method called when module is activated. More...
 
def on_deactivate (self)
 Method called when module is deactivated. More...
 
def getStatusVariables (self)
 Return a dict of variable names and their content representing the module state for saving. More...
 
def setStatusVariables (self, variableDict)
 Give a module a dict of variable names and their content representing the module state. More...
 
def getConfiguration (self)
 Return the configration dictionary for this module. More...
 
def get_connector (self, connector_name)
 Return module connected to the given named connector. More...
 
- Public Member Functions inherited from core.module.ModuleMeta
def __new__ (cls, name, bases, attrs)
 Collect declared Connectors, ConfigOptions and StatusVars into dictionaries. More...
 

Public Attributes

 digital_out_task
 
 digital_data
 
 digital_read
 
 digital_samples_channel
 
- Public Attributes inherited from core.module.BaseMixin
 module_state
 
 connectors
 

Detailed Description

A National Instruments device that can count and control microvave generators.

!!!!!! NI USB 63XX, NI PCIe 63XX and NI PXIe 63XX DEVICES ONLY !!!!!!

See National Instruments X Series Documentation for details.

stable Kay Jahnke, Alexander Stark

Example config for copy-paste:

nicard_6343: module 'national_instruments_x_series.NationalInstrumentsXSeries' photon_sources:

clock_channel '/Dev1/Ctr0' default_clock_frequency 100 # optional, in Hz counter_channels:

odmr_trigger_channel '/Dev1/PFI7'

gate_in_channel '/Dev1/PFI9' default_samples_number 50 max_counts 3e7 read_write_timeout 10 counting_edge_rising True

Member Function Documentation

◆ close_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.close_clock (   self,
  scanner = False 
)

Closes the clock and cleans up afterwards.

Parameters
boolscanner: specifies if the counter- or scanner- function should be used to close the device. True = scanner False = counter
Returns
int: error code (0:OK, -1:error)

◆ close_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.close_counter (   self,
  scanner = False 
)

Closes the counter or scanner and cleans up afterwards.

Parameters
boolscanner: specifies if the counter- or scanner- function will be excecuted to close the device. True = scanner False = counter
Returns
int: error code (0:OK, -1:error)

◆ close_gated_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.close_gated_counter (   self)

Clear tasks, so that counters are not in use any more.

Returns
int: error code (0:OK, -1:error)

◆ close_odmr()

def national_instruments_x_series.NationalInstrumentsXSeries.close_odmr (   self)

Closes the odmr and cleans up afterwards.

Returns
int: error code (0:OK, -1:error)

◆ close_odmr_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.close_odmr_clock (   self)

Closes the odmr and cleans up afterwards.

Returns
int: error code (0:OK, -1:error)

◆ close_scanner()

def national_instruments_x_series.NationalInstrumentsXSeries.close_scanner (   self)

Closes the scanner and cleans up afterwards.

Returns
int: error code (0:OK, -1:error)

◆ close_scanner_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.close_scanner_clock (   self)

Closes the clock and cleans up afterwards.

Returns
int: error code (0:OK, -1:error)

◆ count_odmr()

def national_instruments_x_series.NationalInstrumentsXSeries.count_odmr (   self,
  length = 100 
)

Sweeps the microwave and returns the counts on that sweep.

Parameters
intlength: length of microwave sweep in pixel
Returns
float[]: the photon counts per second

◆ get_constraints()

def national_instruments_x_series.NationalInstrumentsXSeries.get_constraints (   self)

Get hardware limits of NI device.

Returns
SlowCounterConstraints: constraints class for slow counter

FIXME ask hardware for limits when module is loaded

◆ get_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.get_counter (   self,
  samples = None 
)

Returns the current counts per second of the counter.

Parameters
intsamples: if defined, number of samples to read in one go. How many samples are read per readout cycle. The readout frequency was defined in the counter setup. That sets also the length of the readout array.
Returns
float [samples]: array with entries as photon counts per second

◆ get_counter_channels()

def national_instruments_x_series.NationalInstrumentsXSeries.get_counter_channels (   self)

Returns the list of counter channel names.

Returns
tuple(str): channel names

Most methods calling this might just care about the number of channels, though.

◆ get_gated_counts()

def national_instruments_x_series.NationalInstrumentsXSeries.get_gated_counts (   self,
  samples = None,
  timeout = None,
  read_available_samples = False 
)

Returns latest count samples acquired by gated photon counting.

Parameters
intsamples: if defined, number of samples to read in one go. How many samples are read per readout cycle. The readout frequency was defined in the counter setup. That sets also the length of the readout array.
inttimeout: Maximal timeout for the read process. Since nidaq waits for all samples to be acquired, make sure this is long enough.
boolread_available_samples : if False, NiDaq waits for the sample you asked for to be in the buffer before, True it returns what is in buffer until 'samples' is full.

◆ get_position_range()

def national_instruments_x_series.NationalInstrumentsXSeries.get_position_range (   self)

Returns the physical range of the scanner.

Returns
float [4][2]: array of 4 ranges with an array containing lower and upper limit. The unit of the scan range is meters.

◆ get_scanner_position()

def national_instruments_x_series.NationalInstrumentsXSeries.get_scanner_position (   self)

Get the current position of the scanner hardware.

Returns
float[]: current position in (x, y, z, a).

◆ get_status()

def national_instruments_x_series.NationalInstrumentsXSeries.get_status (   self)

Receives the current status of the Fast Counter and outputs it as return value.

0 = unconfigured 1 = idle 2 = running 3 = paused -1 = error state

◆ reset_hardware()

def national_instruments_x_series.NationalInstrumentsXSeries.reset_hardware (   self)

Resets the NI hardware, so the connection is lost and other programs can access it.

Returns
int: error code (0:OK, -1:error)

◆ scan_line()

def national_instruments_x_series.NationalInstrumentsXSeries.scan_line (   self,
  line_path = None,
  pixel_clock = False 
)

Scans a line and return the counts on that line.

Parameters
float[c][m]line_path: array of c-tuples defining the voltage points (m = samples per line)
boolpixel_clock: whether we need to output a pixel clock for this line
Returns
float[m][n]: m (samples per line) n-channel photon counts per second

The input array looks for a xy scan of 5x5 points at the position z=-2 like the following: [ [1, 2, 3, 4, 5], [1, 1, 1, 1, 1], [-2, -2, -2, -2] ] n is the number of scanner axes, which can vary. Typical values are 2 for galvo scanners, 3 for xyz scanners and 4 for xyz scanners with a special function on the a axis.

◆ scanner_set_position()

def national_instruments_x_series.NationalInstrumentsXSeries.scanner_set_position (   self,
  x = None,
  y = None,
  z = None,
  a = None 
)

Move stage to x, y, z, a (where a is the fourth voltage channel).

#FIXME: No volts

Parameters
floatx: postion in x-direction (volts)
floaty: postion in y-direction (volts)
floatz: postion in z-direction (volts)
floata: postion in a-direction (volts)
Returns
int: error code (0:OK, -1:error)

◆ set_odmr_length()

def national_instruments_x_series.NationalInstrumentsXSeries.set_odmr_length (   self,
  length = 100 
)

Sets up the trigger sequence for the ODMR and the triggered microwave.

Parameters
intlength: length of microwave sweep in pixel
Returns
int: error code (0:OK, -1:error)

◆ set_position_range()

def national_instruments_x_series.NationalInstrumentsXSeries.set_position_range (   self,
  myrange = None 
)

Sets the physical range of the scanner.

Parameters
float[4][2] myrange: array of 4 ranges with an array containing lower and upper limit. The unit of the scan range is meters.
Returns
int: error code (0:OK, -1:error)

◆ set_up_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_clock (   self,
  clock_frequency = None,
  clock_channel = None,
  scanner = False,
  idle = False 
)

Configures the hardware clock of the NiDAQ card to give the timing.

Parameters
floatclock_frequency: if defined, this sets the frequency of the clock in Hz
stringclock_channel: if defined, this is the physical channel of the clock within the NI card.
boolscanner: if set to True method will set up a clock function for the scanner, otherwise a clock function for a counter will be set.
boolidle: set whether idle situation of the counter (where counter is doing nothing) is defined as True = 'Voltage High/Rising Edge' False = 'Voltage Low/Falling Edge'
Returns
int: error code (0:OK, -1:error)

◆ set_up_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_counter (   self,
  counter_channels = None,
  sources = None,
  clock_channel = None,
  counter_buffer = None 
)

Configures the actual counter with a given clock.

Parameters
list(str)counter_channels: optional, physical channel of the counter
list(str)sources: optional, physical channel where the photons are to count from
strclock_channel: optional, specifies the clock channel for the counter
intcounter_buffer: optional, a buffer of specified integer length, where in each bin the count numbers are saved.
Returns
int: error code (0:OK, -1:error)

◆ set_up_gated_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_gated_counter (   self,
  buffer_length,
  read_available_samples = False 
)

Initializes and starts task for external gated photon counting.

Parameters
intbuffer_length: Defines how long the buffer to be filled with samples should be. If buffer is full, program crashes, so use upper bound. Some reference calculated with sample_rate (in Samples/second) divided by Buffer_size: sample_rate/Buffer_size = no rate / 10kS, (0-100S/s) / 10kS (101-10kS/s)/ 1kS, (10k-1MS/s) / 100kS, (>1MS/s) / 1Ms
boolread_available_samples: if False, NiDaq waits for the sample you asked for to be in the buffer before, if True it returns what is in buffer until 'samples' is full

◆ set_up_odmr()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_odmr (   self,
  counter_channel = None,
  photon_source = None,
  clock_channel = None,
  odmr_trigger_channel = None 
)

Configures the actual counter with a given clock.

Parameters
stringcounter_channel: if defined, this is the physical channel of the counter
stringphoton_source: if defined, this is the physical channel where the photons are to count from
stringclock_channel: if defined, this specifies the clock for the counter
stringodmr_trigger_channel: if defined, this specifies the trigger output for the microwave
Returns
int: error code (0:OK, -1:error)

◆ set_up_odmr_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_odmr_clock (   self,
  clock_frequency = None,
  clock_channel = None 
)

Configures the hardware clock of the NiDAQ card to give the timing.

Parameters
floatclock_frequency: if defined, this sets the frequency of the clock
stringclock_channel: if defined, this is the physical channel of the clock
Returns
int: error code (0:OK, -1:error)

◆ set_up_scanner()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_scanner (   self,
  counter_channels = None,
  sources = None,
  clock_channel = None,
  scanner_ao_channels = None 
)

Configures the actual scanner with a given clock.

The scanner works pretty much like the counter. Here you connect a created clock with a counting task. That can be seen as a gated counting, where the counts where sampled by the underlying clock.

Parameters
list(str)counter_channels: this is the physical channel of the counter
list(str)sources: this is the physical channel where the photons are to count from
stringclock_channel: optional, if defined, this specifies the clock for the counter
list(str)scanner_ao_channels: optional, if defined, this specifies the analog output channels
Returns
int: error code (0:OK, -1:error)

◆ set_up_scanner_clock()

def national_instruments_x_series.NationalInstrumentsXSeries.set_up_scanner_clock (   self,
  clock_frequency = None,
  clock_channel = None 
)

Configures the hardware clock of the NiDAQ card to give the timing.

Parameters
floatclock_frequency: if defined, this sets the frequency of the clock
stringclock_channel: if defined, this is the physical channel of the clock
Returns
int: error code (0:OK, -1:error)

◆ set_voltage_range()

def national_instruments_x_series.NationalInstrumentsXSeries.set_voltage_range (   self,
  myrange = None 
)

Sets the voltage range of the NI Card.

Parameters
float[n][2] myrange: array containing lower and upper limit
Returns
int: error code (0:OK, -1:error)

◆ start_gated_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.start_gated_counter (   self)

Actually start the preconfigured counter task.

Returns
int: error code (0:OK, -1:error)

◆ stop_gated_counter()

def national_instruments_x_series.NationalInstrumentsXSeries.stop_gated_counter (   self)

Actually start the preconfigured counter task.

Returns
int: error code (0:OK, -1:error)

The documentation for this class was generated from the following file: