main package: muonic¶
The muonic package
Provide a connection to the QNet DAQ cards via python-serial. For software testing and development, (very) dumb DAQ card simulator is available.
Control the two I/O threads which communicate with the DAQ. If the simulated DAQ is used, there is only one thread.
Provides the public interfaces to read from and send to a DAQ card
Base class defining the public API and helpers for the DAQ provider implementations
Parameters: | logger (logging.Logger) – logger object |
---|
Validate line against pattern. Returns None it the provided line is invalid or the line if it is valid.
Parameters: | line (str) – line to validate |
---|---|
Returns: | str or None |
DAQClient
Raises DAQMissingDependencyError if zmq is not installed.
Parameters: |
|
---|---|
Raises: | DAQMissingDependencyError |
DAQProvider
Parameters: |
|
---|
The module provides a class which uses python-serial to open a connection over the usb ports to the daq card. Since on LINUX systems the used usb device ( which is usually /dev/tty0 ) might change during runtime, this is catched automatically by DaqConnection. Therefore a shell script is invoked.
Provides DAQ server and connection classes to interface with the serial port.
Base DAQ Connection class.
Raises SystemError if serial connection cannot be established.
Parameters: | logger (logging.Logger) – logger object |
---|---|
Raises: | SystemError |
Client connection with DAQ card
Parameters: |
|
---|
DAQ server
Raises DAQMissingDependencyError if zmq is not installed.
Parameters: |
|
---|---|
Raises: | DAQMissingDependencyError |
This module provides a dummy class which simulates DAQ I/O which is read from the file “simdaq.txt”. The simulation is only useful if the software-gui should be tested, but no DAQ card is available
Provides a simple DAQ card simulation, so that software can be tested.
Base class for a simulated connection to DAQ card.
Parameters: | logger (logging.Logger) – logger object |
---|
Simulates reading from and writing to DAQ card.
Parameters: |
|
---|
This routine will increase the scalars variables using predefined rates. Rates are drawn from Poisson distributions.
Returns: | None |
---|
Simulated client connection to DAQ card.
Parameters: |
|
---|
Simulated DAQ server.
Raises DAQMissingDependencyError if zmq is not installed.
Parameters: |
|
---|---|
Raises: | DAQMissingDependencyError |
This package contains all gui relevant classes like dialogboxes and tabwidgets. Every item in the global menu is utilizes a “Dialog” class. The “Canvas” classes contain plot routines for displaying measurements in the TabWidget.
The gui of the programm, written with PyQt4
The main application
Parameters: |
|
---|
Show a link to the online documentation.
Returns: | None |
---|
Adds widget to the store.
Raises WidgetWithNameExistsError if a widget of that name already exists and TypeError if widget is no subclass of QtGui.QWidget.
Parameters: |
|
---|---|
Returns: | None |
Raises: | WidgetWithNameExistsError, TypeError |
Show a config dialog for advanced options, ie. gate width, interval for the rate measurement, options for writing pulse file and the write_daq_status option.
Returns: | None |
---|
Runs the calculate function of pulse widgets if they are active and pulses are available.
Returns: | None |
---|
Is triggered when it is attempted to close the application. Will perform some cleanup before closing.
Parameters: | ev (QtGui.QCloseEvent) – event |
---|---|
Returns: | None |
Show the channel config dialog.
Returns: | None |
---|
Explicitly scan message for channel information.
Return True if found, False otherwise.
DC gives:
DC C0=23 C1=71 C2=0A C3=00
Which has the meaning:
MM - 00 -> 8bits for channel enable/disable, coincidence and veto
bits | |||||||
---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
veto | veto | coincidence | coincidence | channel3 | channel2 | channel1 | channel0 |
Set bits for veto |
---|
00 - ch0 is veto |
01 - ch1 is veto |
10 - ch2 is veto |
11 - ch3 is veto |
Set bits for coincidence |
---|
00 - singles |
01 - twofold |
10 - threefold |
11 - fourfold |
Parameters: | msg (str) – daq message |
---|---|
Returns: | bool |
Get the initial threshold and channel configuration from the DAQ card.
Returns: | None |
---|
Explicitly scan message for threshold information.
Return True if found, False otherwise.
Parameters: | msg (str) – daq message |
---|---|
Returns: | bool |
Retrieved a widget from the store.
Parameters: | name (str) – widget name |
---|---|
Returns: | object |
Returns true if widget with name exists, False otherwise.
Parameters: | name (str) – widget name |
---|---|
Returns: | bool |
Show a simple help dialog.
Returns: | None |
---|
Returns True if the widget exists and is active, False otherwise
Parameters: | name (str) – widget name |
---|---|
Returns: | bool |
Show the manual that comes with muonic in a pdf viewer.
Returns: | None |
---|
Opens the folder with the data files. Usually in $HOME/muonic_data
This functions gets everything out of the daq.
Handles all the messages currently in the daq and passes the results to the corresponding widgets.
Returns: | None |
---|
Setup the menu bar and populate menus.
Returns: | None |
---|
Setup the plot style depending on screen size.
Returns: | None |
---|
Creates the widgets and adds tabs
Returns: | None |
---|
Show the sphinx documentation that comes with muonic in a browser.
Returns: | None |
---|
Shows thresholds dialog.
Returns: | None |
---|
Update dynamic widgets.
Returns: | None |
---|
Contains the “main” gui application. It Provides the MainWindow, which initializes the different tabs and draws a menu.
Provides the main window for the gui part of muonic
The main application
Parameters: |
|
---|
Show a link to the online documentation.
Returns: | None |
---|
Adds widget to the store.
Raises WidgetWithNameExistsError if a widget of that name already exists and TypeError if widget is no subclass of QtGui.QWidget.
Parameters: |
|
---|---|
Returns: | None |
Raises: | WidgetWithNameExistsError, TypeError |
Show a config dialog for advanced options, ie. gate width, interval for the rate measurement, options for writing pulse file and the write_daq_status option.
Returns: | None |
---|
Runs the calculate function of pulse widgets if they are active and pulses are available.
Returns: | None |
---|
Is triggered when it is attempted to close the application. Will perform some cleanup before closing.
Parameters: | ev (QtGui.QCloseEvent) – event |
---|---|
Returns: | None |
Show the channel config dialog.
Returns: | None |
---|
Explicitly scan message for channel information.
Return True if found, False otherwise.
DC gives:
DC C0=23 C1=71 C2=0A C3=00
Which has the meaning:
MM - 00 -> 8bits for channel enable/disable, coincidence and veto
bits | |||||||
---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
veto | veto | coincidence | coincidence | channel3 | channel2 | channel1 | channel0 |
Set bits for veto |
---|
00 - ch0 is veto |
01 - ch1 is veto |
10 - ch2 is veto |
11 - ch3 is veto |
Set bits for coincidence |
---|
00 - singles |
01 - twofold |
10 - threefold |
11 - fourfold |
Parameters: | msg (str) – daq message |
---|---|
Returns: | bool |
Get the initial threshold and channel configuration from the DAQ card.
Returns: | None |
---|
Explicitly scan message for threshold information.
Return True if found, False otherwise.
Parameters: | msg (str) – daq message |
---|---|
Returns: | bool |
Retrieved a widget from the store.
Parameters: | name (str) – widget name |
---|---|
Returns: | object |
Returns true if widget with name exists, False otherwise.
Parameters: | name (str) – widget name |
---|---|
Returns: | bool |
Show a simple help dialog.
Returns: | None |
---|
Returns True if the widget exists and is active, False otherwise
Parameters: | name (str) – widget name |
---|---|
Returns: | bool |
Show the manual that comes with muonic in a pdf viewer.
Returns: | None |
---|
This functions gets everything out of the daq.
Handles all the messages currently in the daq and passes the results to the corresponding widgets.
Returns: | None |
---|
Setup the menu bar and populate menus.
Returns: | None |
---|
Show the sphinx documentation that comes with muonic in a browser.
Returns: | None |
---|
Shows thresholds dialog.
Returns: | None |
---|
The functionality of the software
Provides the different physics widgets
Base widget class
Parameters: |
|
---|
Getter and setter for active state.
Parameters: | value (bool or None) – value for the new state |
---|---|
Returns: | bool |
Get the last DAQ message received by the parent, if present.
Returns: | str or None |
---|
Send message to DAQ cards. Reuses the connection of the parent widget if present.
Returns True if operation was successful.
Parameters: | msg (str) – message to send to the DAQ card |
---|---|
Returns: | bool |
Gets called upon closing application. Implement cleanup routines like closing files here.
Returns: | None |
---|
Shows the DAQ message log. The message log can be written to a file. This widget has a command line to issue DAQ commands.
Parameters: |
|
---|
Shows the muon decay plot
Parameters: |
|
---|
Trigger muon decay
Parameters: | pulses (list) – extracted pulses |
---|---|
Returns: | None |
Starts or stops the muon decay check depending on checkbox state
Returns: | None |
---|
Shows GPS information
Parameters: |
|
---|
Provides a widget which is able to show a plot of triggered pulses.
Parameters: |
|
---|
Calculates the pulse widths.
Parameters: | pulses (list) – extracted pulses |
---|---|
Returns: | None |
Widget for displaying a rate plot
Parameters: |
|
---|
Get the rates from the observed counts by dividing by the measurement interval.
Returns True if last DAQ message was valid and could be processed.
Returns: | bool |
---|
Extracts the scalar values for channel 0-3 and the trigger channel from daq message
Parameters: | msg – DAQ message |
---|---|
Type: | str |
Returns: | list of ints |
Provide a widget which shows the status information of the DAQ and the software.
Parameters: |
|
---|
Shows the muon velocity plot
Parameters: |
|
---|
Trigger muon flight
Parameters: | pulses (list) – extracted pulses |
---|---|
Returns: | None |
Provide the dialog fields for user interaction
Dialog to set advanced configuration options.
Parameters: |
|
---|
Abstract base class for all dialogs
Parameters: | window_title (str) – the title of the window |
---|
Create a custom button for cancel/apply.
Parameters: |
|
---|
Create a group of choices.
Parameters: |
|
---|
Dialog to set the configuration
Parameters: |
|
---|
Dialog to configure the fit range
Parameters: |
|
---|---|
Type: | tuple of float |
Type: | tuple of float |
Provides the canvases for plots in muonic
A base class for all canvases with a histogram
Parameters: |
|
---|
Plot the fit onto the diagram
Parameters: |
|
---|---|
Returns: | None |
Base class for plot canvases
Parameters: |
|
---|
A simple histogram for the use with mu lifetime measurement
Parameters: |
|
---|
Canvas to display pulses
Parameters: |
|
---|
A simple histogram for the use with pulse width measurement
Parameters: |
|
---|
A plot canvas to display scalars
Parameters: |
|
---|
A simple histogram for the use with mu velocity measurement
Parameters: |
|
---|
scripts and classes used for data analysis
Transformation of ASCII DAQ data. Combination of Pulses to events as well as implementation of software triggers for the muon decay and the muon velocity measurement
Get the absolute timing of the pulses by use of the gps time Calculate also a non hex representation of leading and falling edges of the pulses.
Get the pulses out of a daq line. Speed is important here. If a pulse file is given, all the extracted pulses will be written into it.
Parameters: |
|
---|
get the leading and falling edges of the pulses Use counter diff for getting pulse times in subsequent lines of the trigger flag
Parameters: |
|
---|---|
Returns: | None |
Get the absolute event time in seconds since day start If gps is not available, only relative event time based on counts is returned
Parameters: |
|
---|---|
Returns: | float |
Remove pulses which have a leading edge later in time than a falling edge and do a bit of sorting Remove also single leading or falling edges NEW: We add virtual falling edges!
Returns: | dict of lists |
---|
Trigger on a set of extracted pulses and look for decayed muons.
We demand a second pulse in the same channel where the muon got stuck. Should operate for a 10mu sec trigger window.
Parameters: | logger (logging.Logger) – logger object |
---|
Trigger on a certain combination of single and double pulses
Parameters: |
|
---|---|
Returns: | int or None |