rewrite.lib.daq package

Submodules

rewrite.lib.daq.Connection module

class rewrite.lib.daq.Connection.DAQConnection(in_queue, out_queue, logger=None)[source]

Bases: object

DAQ Connection class.

Raises SystemError if serial connection cannot be established.

Parameters:
  • logger (logging.Logger) – logger object
  • in_queue – input queue
  • out_queue – output queue
Raises:

SystemError

get_serial_port()[source]

Check out which device (/dev/tty) is used for DAQ communication.

Raises OSError if binary ‘which_tty_daq’ cannot be found.

Returns:serial.Serial – serial connection port
Raises:OSError
read()[source]

Gets Data from the DAQ card. Read it from the provided queue.

Returns:None
write()[source]

Writes messages from the in queue to the DAQ card

Returns:None

rewrite.lib.daq.DAQServer module

class rewrite.lib.daq.DAQServer.DAQServer[source]

Bases: object

check_pressure_msg(msg)[source]

Check message for pressure information.

clear_queues()[source]

Clear all the queues filled in process_incoming().

do(msg)[source]

Send a command to the DAQ card and remove repeated responses from the outqueue if data taking is turned off. Otherwise just send the command to the card.

get_gps_info()[source]
get_scalars(msg=None)[source]

If running=True, read out scalars from the counterqueue. Otherwise, read scalars from given message. Returns the scalar values.

get_temp_and_pressure()[source]

Read out temperature and pressure data. Pressure data in unit counts and mBar. If no measurement is running returns temperature, pressure, pressure_mbar

measure_pulses(meastime=None)[source]

Measure pulses (rising and falling edge times) of trigger events. Using PulseExtractor from muonic. :param meastime: Total measurement time in minutes. Default is None.

process_incoming()[source]

Sort messages received from the DAQ card and store them in separate queues.

read_scalars()[source]

Read the scalars of all channels. If no measurement is running, returns scalar values: ch0, ch1, ch2, ch3, trigger

reset_scalars()[source]

Reset the scalars of all channels.

run()[source]
setRunning(isRunning)[source]
set_threashold(th_0=300, th_1=300, th_2=300, th_3=300)[source]

Set the threasholds for the channels of the DAQ card. Default value for all channels is 300.

setup_channel(ch0=False, ch1=False, ch2=False, ch3=False, coincidence='single')[source]

Enable/Disable channels of the DAQ card and set coincidence settings.

start_reading_data()[source]

Start receiving data from the DAQ card and storing it in self.dataqueue.

stop()[source]
stop_reading_data()[source]

Stop receiving data from the DAQ card.

rewrite.lib.daq.Exceptions module

Utility classes and functions needed by DAQ related modules

exception rewrite.lib.daq.Exceptions.DAQIOError[source]

Bases: OSError

DAQ IOError Exception class

exception rewrite.lib.daq.Exceptions.DAQMissingDependencyError[source]

Bases: Exception

Exception class which is thrown if runtime dependencies are not met

rewrite.lib.daq.Provider module

class rewrite.lib.daq.Provider.DAQProvider(logger=None)[source]

Bases: object

Class providing the public API and helpers for the communication with the DAQ card

LINE_PATTERN = re.compile("^[a-zA-Z0-9+-.,:()=$/#?!%_@*|~' ]*[\n\r]*$")
data_available()[source]

Tests if data is available from the DAQ card.

Returns:int or bool
get(*args)[source]

Get data from the DAQ card.

Raises DAQIOError if the queue is empty.

Parameters:args (list) – queue arguments
Returns:str or None – next item from the queue
Raises:DAQIOError
put(*args)[source]

Senf data to the DAQ card.

Parameters:args (list) – queue arguments
Returns:None
validate_line(line)[source]

Validate line againt regex pattern. Returns None if the provided line is invalid or the line if it is valid.

Parameters:line (str) – line to validate
Returns:str or None

rewrite.lib.daq.getDevice module

rewrite.lib.daq.getDevice.get_Device()[source]

Reads dmesg and searches for the daq card. Then returns its name.

returns ttyUSB0 by default

Returns:name of the device file in /dev/ or ttyUSB0 by default

Module contents