licel_tr_tcpip¶
Class Holding methods to communicate with transient recorder
- class Licel.licel_tr_tcpip.TransientRecorder(commandSocket: socket, pushSocket: socket, killSocket: socket, socket_File)¶
- BufferSize: int = 0¶
Buffer size to receive MPUSH data
- MPushStartFromConfig(shots: int, Config: licel_Config.Config) str¶
Starts the MPUSH acquisition mode from configuration. Internally this function will:
Get the timestamp endianness
Get hardware information for each active transient recorder in Config.
Calculate the expected number of bytes to be received.
Generate the MPUSH command depending on the Config.
Sends the generated MPUSH command to the controller.
- Parameters:
shots (int) – number of shots to be acquired
Config (Licel.licel_acq.Config()) – system configuration
- Returns:
ethernet controller response
- Return type:
str
- MPushStop() str¶
stops the push/mpush mode. Internally it sends a
SLAVEcommand. for more information: https://licel.com/manuals/ethernet_pmt_tr.pdf#TCPIP.SLAVE :raises Exception: if the stop command is not executed.- Returns:
Controller response.
- Return type:
str
- TRtype() dict[str, int | float | str]¶
Get transient recorder hardware information for the selected transient recorder. Old TR produced before Oct. 2009 will not support this command If this command is not supported default values for a TR20-160 are filled in
- Returns:
dictionary containing hardware info
- Return type:
dict{‘ADC Bits’ : ‘ ‘, ‘PC Bits’ : ‘ ‘ , ‘FIFOLength’: ‘ ‘ , binWidth’ : ‘ ‘,’ID’ : ‘ ‘, ‘HWCAP’ : ‘ ‘, ‘binShift’: ‘ ‘, ‘raw’: ‘ ‘}
- blockRackTrigger(trig: str) str¶
Block a trigger related to the acquisition at the specified Memory = A, B, C, or D. The typical use case is when the rack trigger A and B are driven but a certain channel should be active only when trigger A or B arrives To unblock Trigger see
unblockRackTrigger- Parameters:
trig (str) – trigger to be blocked, possible value are
A,B,C,D
- clearMemory() str¶
Clear both memories (A and B) of the previously selected device. For more info visit: https://licel.com/manuals/ethernet_pmt_tr.pdf#TCPIP.CLEAR
- configureHardware(Config: licel_Config.Config) None¶
Configure the active transient recorders hardware as specified in config.
currently configuers following parameters : - Threshold mode
Pretrigger
Discriminator level
Frequency divider
Input range
Max shots
Block global trigger.
- Parameters:
Config (Licel.licel_acq.Config()) – holds the acquisition configuration information
- Returns:
None
- continueAcquisition() str¶
Continue the recording process for the previously specified device without reinitializing the memory.
- disablePretrigger() str¶
Disable the pretrigger for a selected TR
- enablePretrigger() str¶
Enable the pretrigger for a selected TR. In TR20-16bit this will be 128 bins long shipped till 2018, since 2018 the TR40-16bit-3U will have 1/16 of the trace length. This means for a 16k the pretrigger will be 1024 bins long. The TR will power up with pretrigger off. TR devices supporting pretrigger indicate it by bit 3 in the HWCAP field of the TRTYPE? command.
- exceptedByte: int = 0¶
number of byte expected to be received for a complete data set
- getCombinedRawAnalogueData(TRType: dict[str, int | float | str], dataParser: licel_data.DataParser, bins: int, shots: int, device: int, memory: str) tuple[ndarray[Any, dtype[uint32]], ndarray[Any, dtype[uint32]]]¶
get the combined raw analogue data set.
- Parameters:
TRType (dict{'ADC Bits' :" " , 'PC Bits' : " ", 'FIFOLength': " ", 'binWidth' :" " , 'ID' : " ", 'HWCAP' : " ", 'binShift': " "}) – dict holding information about the transient recorder hardware
dataParser (Licel.licel_data.DataParser) – Class holding method for processing and parsing raw data
bins (int) – number of bins to read.
shots (int) – number of acquired shots.
device (int) – transient recorder address
memory (str can be: 'MEM_A', 'MEM_B', 'MEM_C', 'MEM_D') – memory to read.
- Returns:
combined analogue data set and the clipping information for each data point.
- Return type:
[Analogue data set: numpy.ndarray(dtype=uint32, ndim =1), Clipping information: numpy.ndarray(dtype=uint32, ndim =1)]
- getCombinedRawAnalogueSquaredData(dataParser: licel_data.DataParser, binsSqd: int, device: int, memory: str) ndarray[Any, dtype[uint64]]¶
get the combined raw analogue squared data
- Parameters:
dataParser (Licel.licel_data.DataParser) – Class holding method for processing and parsing raw data
binsSqd – number of bins to read.
device (int) – transient recorder address
memory (str can be: 'MEM_A', 'MEM_B', 'MEM_C', 'MEM_D') – memory to read.
- Returns:
the combined raw analogue squared data
- Return type:
numpy.ndarray(dtype=uint64, ndim =1)
- getID() str¶
Get the identification string from the controller
- Returns:
ethernet controller identification number
- Return type:
str
- getMultipleShots() str¶
Return the shotnumber for each memory, there is one clearing cycle at the start.
- getMultipleShotsAB() str¶
Return the shotnumber for each memory, there is one clearing cycle at the start.
- getRawPhotonCountingData(TRType: dict[str, int | str | float], dataParser: licel_data.DataParser, bins: int, shots: int, device: int, memory: str) ndarray[Any, dtype[uint32]]¶
get the raw photon data set.
- Parameters:
TRType (dict{'ADC Bits' :" " , 'PC Bits' : " ", 'FIFOLength': " ", 'binWidth' :" " , 'ID' : " ", 'HWCAP' : " ", 'binShift': " "}) – dict holding information about the transient recorder hardware
dataParser (Licel.licel_data.DataParser) – Class holding method for processing and parsing raw data
bins (int) – number of bins to read.
shots (int) – number of acquired shots.
device (int) – transient recorder address
memory (str can be: 'MEM_A', 'MEM_B', 'MEM_C', 'MEM_D') – memory to read.
- Returns:
photon data set.
- Return type:
numpy.ndarray(dtype=uint32, ndim =1)
- getRawPhotonCountingSquaredData(dataParser: licel_data.DataParser, binsSqd: int, device: int, memory: str) ndarray[Any, dtype[uint64]]¶
get the photon counting raw squared data
- Parameters:
dataParser (Licel.licel_data.DataParser) – Class holding method for processing and parsing raw data
binsSqd – number of bins to read.
device (int) – transient recorder address
memory (str can be: 'MEM_A', 'MEM_B', 'MEM_C', 'MEM_D') – memory to read.
- Returns:
the combined photon counting raw squared data
- Return type:
numpy.ndarray(dtype=uint64, ndim =1)
- getShotsAB() str¶
Return the shot number for each memory, there is one clearing cycle at the start.
- getStatus() tuple[bool, bool, str, int]¶
Return the shot number for each memory, there is one clearing cycle at the start.
- listInstalledTr() dict[str, str]¶
attempts to communicate with transient recorder with adresse 0 .. 15 and lists all installed transient recorders.
- Raises:
RuntimeError – if no transient recorder is detected
- Returns:
dictionary containing information about installed Transient recorder
- Return type:
{‘TR0’: ‘(not)installed’, ‘TR1’: ‘(not)installed’, ‘TR2’: ‘(not)installed’, ‘TR3’: ‘(not)installed’, ………………….. ‘TR15’: ‘(not)installed’}
- multipleClearMemory() str¶
Clears both memories (A and B) of the currently selected devices.
- multipleContinueAcquisition() str¶
The acquisition process of the selected multiple devices will be restarted without clearing their memories.
- multipleStartAcquisition() str¶
The acquisition process will be started with the next received trigger for multiple devices
- multipleStopAcquisition() str¶
The acquisition process will be stoped after the next received trigger for multiple devices
- multipleWaitForReady(milliSec: int) str¶
Wait milliSec until all devices returned from the armed state.
- Parameters:
milliSec (int) – milliseconds to wait, maximum is 400ms
- Returns:
controller response containing executed if successful else failed.
- Return type:
string
- multiplyBinwidth(multiplier: int) str¶
Multiply the the transient recorder base binwidth by
multiplier. This will reduce the range resolution by actually reducing the sampling rate of the transient recorder before the data summation. multiplier possible value are between 0, 1, 2 ,4, 8, 16, 32, 64, 128.- Parameters:
deviceNumber (int) – transient recorder adresse
multiplier – possible value are 0, 1, 2 ,4, 8, 16, 32, 64, 128.
int
- recvPushData() None¶
read push/mpush data from the ethernet controller push port.
used for reading push/mpush from transient recorder.
fills
self.pushBuffer. If after a certain time not data is recived, checks if counterpart is still reachable by sending*IDN?on the command socket.- Raises:
ConnectionResetError if the counter part closes the connection
- Raises:
socketTimeout if counter part is unreachable
- Raises:
ConnectionError if error is written.
- selectMultipleTR(devicelist: list[int]) str¶
The TR corresponding to the numbers in the device list will be selected which means that they will become sensitive to all future commands that do not require a device number input. The devices will be deselected if another select command is issued.
- selectTR(numTR: int) str¶
select transient recorder to communicate with.
- Parameters:
numTR (int) – transient recorder adresse between 0 .. 15
- Returns:
select numTR executedorDevice ID ``numTR` is currently not supported- Return type:
str
- setDiscriminatorLevel(discriminatorLevel: int) str¶
Set the discriminator level between 0 and 63 for the selected transient recorders. When the threshold mode is activated, a discriminator level of 63 outputs -100mV When the threshold mode is deactivated, a discriminator level of 63 outputs -25mV
- setInputRange(Range: str) str¶
Change the input voltage range.
permissable parameters are:
“-500mV”
“-100mV”
“-20mV”
- setMaxBins(numMaxBins: int) str¶
Sets the tracelength if the memory configuraton switch 5 is in the ON Position. A user defined tracelength allows a better usage of the acquisition time for high repetition rate systems.
- setMaxShots(maxShots: int) str¶
Set the maxmimum shotnumber of the TR this can be an arbitrary number between 2 and 65335, the startup default is 4096. This will work with newer TR. If this command fails and the unit claims that it supports 64k shots then Licel_TCPIP_SetShotLimit will work.
- setShotLimit(limit: str) str¶
Switch between 4k and 64k maxshots. permissable arguments are :
limit = str “64K”
limit = str “4K”
- setSlaveMode() str¶
Set slave mode. End push mode for more information: https://licel.com/manuals/ethernet_pmt_tr.pdf#TCPIP.SLAVE
- setThresholdMode(thresholdMode: str) str¶
Sets the damping state to either on or off. If a value of 1 is sent then damping is turned on. If a value of 0 is sent, the damping is turned off. When the damping is set to low, a discriminator level of 63 outputs -25mV When the damping is set to High, a discriminator level of 63 outputs -100mV
- singleShot() str¶
Start the currently selected transient recorder.
- startAcquisition() str¶
Start the currently selected transient recorder.
- stopAcquisition() str¶
Stops the currently selected transient recorder.
- totalnumBins: int = 0¶
holds the total number of bins to be read.
- unblockRackTrigger() str¶
To unblock previously blocked triggers by
blockRackTrigger
- waitForReady(delay: int) str¶
Waits for return of the device from the armed state. If the waiting time is longer than the time specified by delay than the device remains armed and will be return to the idle state with next reading of binary data a stop command should have been sent before to the transient recorder. :param delay: delay in ms :type delay: int
- Returns:
if timeout occurs
timeoutelse ‘’Device returned from armed state’’- Return type:
str