th260 package

th260.th260controller module

class th260.th260controller.TH260Controller[source]

Bases: sphinx.ext.autodoc.importer._MockObject

TH260 controller class to configure and monitor a TH260 P card

TH260Controller is meant to access a PicoQuant TimeHarp 260 Pico via TH260LIB.DLL v 3.1. for application to positron annihilation lifetime spectroscopy. It is derived from QtCore.QObject to allow the use of signals and slots logic to communicate between thread workers (usually a GUI application and a sorter worker).

ACQTMAX = 360000000
ACQTMIN = 1
ACQ_ENDED

obj – pyqtsignal() Signal send to the sorter worker to force the sorting of last events.

CFDLVLMAX = 0
CFDLVLMIN = -1200
CFDZCMAX = 0
CFDZCMIN = -40
CHANOFFSMAX = 99999
CHANOFFSMIN = -99999
DATA

obj – pyqtsignal(obj, int) Signal to share data object with the sorter worker of TH260 module. The first argument is the data object itself, here a c_type array buffer. The second argument is the number of records contained in the data buffer.

DEVINIT

obj – pyqtsignal() Sent by the initialization method when the device is successfuly initialised.

ERROR

obj – pyqtsignal(tuple) Not yet in use.

FLAG_FIFOFULL = 2
FLAG_OVERFLOW = 1
LIB_VERSION = '3.1'
MAXDEVNUM = 4
MAXINPCHAN = 2
MAXLENCODE = 5
MODE_T2 = 2
MODE_T3 = 3
NEW_OUTPUT

obj – pyqtsignal(str) message to be printed in a console or GUI output

PROGRESS

obj – pyqtsignal(str, int) Signal to share the progress status of the on-going acquisition. The first argument should always be ‘file’ when use together with the Pals3D GUI application. ‘file’ refer to the status of a single acquisition file in opposition to ‘acq’ that relate to the totale acquisition programm, and that is sent by the acquisition worker of the GUI application. This can be changed when used with an external application.

TH260LIB = <MagicMock name='mock()' id='140107619395568'>
TTREADMAX = 131072
UPDATECountRate

obj – pyqtsignal() Sent to the GUI application to force the update of these values in the GUI application.

WARNING

obj – pyqtsignal(str) Warming messages for message box in GUI

closeDevices()[source]

Close the currently opened devices

configureSetting()[source]

Set the card paramaters before starting a measurement

Parameters are either changed in the init function, or acquired through an external script or GUI. Here, we only set CFD parameters and channel offsets and the device resolution should always be 25 ns as we are running in T2 mode only.

getCountRates()[source]

Get the count rates for each channels and store them

initialization()[source]

Initialize communication with TH260 pico card

When initializationg is successfuly done, emit a DEVINIT signal.

printOutput(text)[source]

Print a message to console output.

Meant to be used as slot for the NEW_OUTPUT and WARNING signals when no other slot (e.g. GUI application) is defined.

Parameters:text (str) – Message to be printed to console output
searchDevices()[source]

Search and list available devices on the host computer

startAcquisition()[source]

Start data collection with current settings

Launch measurement according to current settings. Emit signals to communicate with other workers. Data buffers are emitted through a signal for being sorted by the TH260sorter module. Output messages and countrates are also sent over signals.

stoptttr()[source]

Stop the ongoing TTTR measurement

tacq = None

Measurement time in millisec,

tryfunc(retcode, funcName, measRunning=False)[source]

Check for errors when executing a function

If an error is raised, print the corresponding error message, stop the TTTR measurement if needed and close the device.

Parameters:
  • retcode (int) – code return by the function funcName (0 = success, <0 = failed)
  • funcName (str) – Name of the function being executed
  • measRunning (bool, default False) – specify if TTTR measurement is running. If True, the measurement will be stopped when an error occured, and then the device is closed

th260.th260sorter module

class th260.th260sorter.SortingWorker(**kwargs)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Data sorting class for data received from a TH260 PicoQuant card

Inherit from QObect to use Qt signal and slot logic for receiving and sorting data. Can then be easily used in a GUI application

Parameters:kwargs (kwargs) – Keyword arguments passed from the main thread
dataArray

dict

dataDeck

deque

islastEvent

bool

globRes

double

resultArray_01

list

resultArray_02

list

resultArray_12

list

Keyword Arguments:
 
  • sortingType (str) – ‘2C’ or ‘3C’
  • timeGate (int) – Long time gate for positron lifetime (in ps)
  • timeRes (int) – Short time gate for 511 MeV photons (in ps)
  • filename (str) – Filename base for output file
  • CFDset (dict) – Dictionnary of all the CFD settings for all channels
  • acqTime (int) – Acquisition time (in min)
  • nftot (int) – Total number of files during current measurement
COINCRATE

obj – pyqtSignal(int)

NEW_OUTPUT

obj – pyqtSignal(str)

T2WRAPAROUND_V1 = 33552000

int – Wraparound for version 1

T2WRAPAROUND_V2 = 33554432

int – Wraparound for version 2

VERSION = 2

int – Version ==> remove?

newMeasurement(noFile)[source]

Initialise class attributes for new measurement

Parameters:noFile (int) – File numero in case of multiple file acquisition
processLastEvents()[source]

Force the processing of the last events to empty dataDeck

saveData(noFile, **kwargs)[source]

Do histogramming of the whole data set and save to files

Parameters:noFile (int) – Numero of the current acquisition file to be appended to the filename base.
sortBuffer(buffer, nrecords)[source]

Decode buffer individual events to produce a time tagged event

Parameters:
  • buffer (object - ctype array buffer) – Raw data buffer received over a signal from the acquisition thread.
  • nrecords (int) – Total number of records in the buffer
sortDeck()[source]

Check if the data deque is full to start the sorting according to the sortingType (‘2C’ or ‘3C’)