Qudi
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
counter_logic.CounterLogic Class Reference

This logic module gathers data from a hardware counting device. More...

Inheritance diagram for counter_logic.CounterLogic:
Inheritance graph
[legend]
Collaboration diagram for counter_logic.CounterLogic:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, config, kwargs)
 Create CounterLogic object with connectors. More...
 
def on_activate (self)
 Initialisation performed during activation of the module.
 
def on_deactivate (self)
 Deinitialisation performed during deactivation of the module.
 
def get_hardware_constraints (self)
 Retrieve the hardware constrains from the counter device. More...
 
def set_counting_samples (self, samples=1)
 
def set_count_length (self, length=300)
 Sets the time trace in units of bins. More...
 
def set_count_frequency (self, frequency=50)
 Sets the frequency with which the data is acquired. More...
 
def get_count_length (self)
 Returns the currently set length of the counting array. More...
 
def get_count_frequency (self)
 Returns the currently set frequency of counting (resolution). More...
 
def get_counting_samples (self)
 Returns the currently set number of samples counted per readout. More...
 
def get_saving_state (self)
 Returns if the data is saved in the moment. More...
 
def start_saving (self, resume=False)
 
def save_data (self, to_file=True, postfix='')
 Save the counter trace data and writes it to a file. More...
 
def draw_figure (self, data)
 Draw figure to save with data file. More...
 
def set_counting_mode (self, mode='CONTINUOUS')
 Set the counting mode, to change between continuous and gated counting. More...
 
def get_counting_mode (self)
 Retrieve the current counting mode. More...
 
def startCount (self)
 This is called externally, and is basically a wrapper that redirects to the chosen counting mode start function. More...
 
def stopCount (self)
 Set a flag to request stopping counting.
 
def count_loop_body (self)
 This method gets the count data from the hardware for the continuous counting mode (default). More...
 
def save_current_count_trace (self, name_tag='')
 The currently displayed counttrace will be saved. More...
 
def get_channels (self)
 Shortcut for hardware get_counter_channels. More...
 

Public Attributes

 threadlock
 
 countdata
 
 countdata_smoothed
 
 rawdata
 
 stopRequested
 

Static Public Attributes

 sigCounterUpdated = QtCore.Signal()
 
 sigCountDataNext = QtCore.Signal()
 
 sigGatedCounterFinished = QtCore.Signal()
 
 sigGatedCounterContinue = QtCore.Signal(bool)
 
 sigCountingSamplesChanged = QtCore.Signal(int)
 
 sigCountLengthChanged = QtCore.Signal(int)
 
 sigCountFrequencyChanged = QtCore.Signal(float)
 
 sigSavingStatusChanged = QtCore.Signal(bool)
 
 sigCountStatusChanged = QtCore.Signal(bool)
 
 sigCountingModeChanged = QtCore.Signal(CountingMode)
 
 counter1 = Connector(interface='SlowCounterInterface')
 declare connectors
 
 savelogic = Connector(interface='SaveLogic')
 

Detailed Description

This logic module gathers data from a hardware counting device.

sigCounterUpdate: there is new counting data available sigCountContinuousNext: used to simulate a loop in which the data acquisition runs. sigCountGatedNext: ???

Returns
error: 0 is OK, -1 is error

Constructor & Destructor Documentation

◆ __init__()

def counter_logic.CounterLogic.__init__ (   self,
  config,
  kwargs 
)

Create CounterLogic object with connectors.

Parameters
dictconfig: module configuration
dictkwargs: optional parameters

Member Function Documentation

◆ count_loop_body()

def counter_logic.CounterLogic.count_loop_body (   self)

This method gets the count data from the hardware for the continuous counting mode (default).

It runs repeatedly in the logic module event loop by being connected to sigCountContinuousNext and emitting sigCountContinuousNext through a queued connection.

◆ draw_figure()

def counter_logic.CounterLogic.draw_figure (   self,
  data 
)

Draw figure to save with data file.

Parameters

◆ get_channels()

def counter_logic.CounterLogic.get_channels (   self)

Shortcut for hardware get_counter_channels.

Returns
list(str): return list of active counter channel names

◆ get_count_frequency()

def counter_logic.CounterLogic.get_count_frequency (   self)

Returns the currently set frequency of counting (resolution).

Returns
float: count_frequency

◆ get_count_length()

def counter_logic.CounterLogic.get_count_length (   self)

Returns the currently set length of the counting array.

Returns
int: count_length

◆ get_counting_mode()

def counter_logic.CounterLogic.get_counting_mode (   self)

Retrieve the current counting mode.

Returns
str: one of the possible counting options: 'CONTINUOUS' = counts continuously 'GATED' = bins the counts according to a gate signal 'FINITE_GATED' = finite measurement with predefined number of samples

◆ get_counting_samples()

def counter_logic.CounterLogic.get_counting_samples (   self)

Returns the currently set number of samples counted per readout.

Returns
int: counting_samples

◆ get_hardware_constraints()

def counter_logic.CounterLogic.get_hardware_constraints (   self)

Retrieve the hardware constrains from the counter device.

Returns
SlowCounterConstraints: object with constraints for the counter

◆ get_saving_state()

def counter_logic.CounterLogic.get_saving_state (   self)

Returns if the data is saved in the moment.

Returns
bool: saving state

◆ save_current_count_trace()

def counter_logic.CounterLogic.save_current_count_trace (   self,
  name_tag = '' 
)

The currently displayed counttrace will be saved.

Parameters
strname_tag: optional, personal description that will be appended to the file name
Returns
: dict data: Data which was saved str Filepath dict Experiment parameters str Filelabel
This method saves the already displayed counts to file and does not
accumulate them. The counttrace variable will be saved to file with the
provided name!

◆ save_data()

def counter_logic.CounterLogic.save_data (   self,
  to_file = True,
  postfix = '' 
)

Save the counter trace data and writes it to a file.

Parameters
boolto_file: indicate, whether data have to be saved to file
strpostfix: an additional tag, which will be added to the filename upon save
Returns
dict parameters: Dictionary which contains the saving parameters

◆ set_count_frequency()

def counter_logic.CounterLogic.set_count_frequency (   self,
  frequency = 50 
)

Sets the frequency with which the data is acquired.

Parameters
floatfrequency: the desired frequency of counting in Hz
Returns
float: the actual frequency of counting in Hz

This makes sure, the counter is stopped first and restarted afterwards.

◆ set_count_length()

def counter_logic.CounterLogic.set_count_length (   self,
  length = 300 
)

Sets the time trace in units of bins.

Parameters
intlength: time trace in units of bins (positive int).
Returns
int: length of time trace in units of bins

This makes sure, the counter is stopped first and restarted afterwards.

◆ set_counting_mode()

def counter_logic.CounterLogic.set_counting_mode (   self,
  mode = 'CONTINUOUS' 
)

Set the counting mode, to change between continuous and gated counting.

Possible options are: 'CONTINUOUS' = counts continuously 'GATED' = bins the counts according to a gate signal 'FINITE_GATED' = finite measurement with predefined number of samples

Returns
str: counting mode

◆ startCount()

def counter_logic.CounterLogic.startCount (   self)

This is called externally, and is basically a wrapper that redirects to the chosen counting mode start function.

Returns
error: 0 is OK, -1 is error

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