licel_data¶
class containing method to process rawData into physical data,and saving preprocessed data to file.
- class Licel.licel_data.DataParser¶
- getSquareRootBinary(combinedAnalogueRawData, combinedSqdData, iNumber, iShots)¶
Convert the squared data to binary number for the standard deviation calculation.
- Parameters:
combinedAnalogueRawData (numpy.ndarray(dtype=uint64, ndim =1)) – holds the combined analogue raw data
combinedSqdData – holds the combined squared data.
:param iNumber : number of bins. :type iNumber: uint
- Parameters:
iShots (uint) – number of shots
- Returns:
square root of (
combinedSqdData
*iShots
) - (combinedAnalogueRawData
^ 2 )- Return type:
numpy.ndarray(dtype=uint32, ndim =1)
- meanError(sampleStdDev, iShots)¶
convert the sample standard deviation to the more relevant error of the mean value.
- Parameters:
sampleStdDev (numpy.ndarray(dtype=double, ndim =1)) – the sample standard deviation.
iShots (uint) – number of shots.
- Returns:
error of the mean value
- Return type:
numpy.ndarray(dtype=double, ndim =1)
- normalizeData(accumulatedData, iNumber, iShots)¶
Normalizes the accumulated Data with respect to the number of shots For more info read: https://licel.com/manuals/programmingManual.pdf#subsection.5.3
- Parameters:
accumulatedData (numpy.ndarray(dtype=uint32, ndim =1)) – numpy array holding accumulated analogue data.
iNumber (uint) – number of bins.
iShots (uint) – number of shots.
- Returns:
normalized data.
- Return type:
numpy.ndarray(dtype=double, ndim =1)
- normalizeSquaredData(sqd_bin, iShots)¶
Normalizes the squared Data with respect to the number of shot
- Parameters:
sqd_bin – square root binary data
iShots (uint) – number of shots.
- Type:
numpy.ndarray(dtype=uint32, ndim =1)
- Returns:
the sample standard deviation.
- Return type:
numpy.ndarray(dtype=double, ndim =1)
- parseDataFromBuffer(Config, ethernetController, shots)¶
parse the
ethernetController.pushBuffer
, transfer the binary push data fromethernetController.pushBuffer
into thedataSet
to be later stored in data files. Binary push data will be transformed from raw binary data uint8 to preprocessed raw data uint32. If the data is valid, meaning no byte were lost during the transmission, we remove the raw binary, fromethernetController.pushBuffer
- Parameters:
ethernetController (licel_tcpip.EthernetController) – holds pushBuffer and TRHardwareinfo as members.
Config (Licel.licel_acq.Config()) – holds the acquisition configuration information
shots (int) – number of shots the user wishes to acquire
- Returns:
dataValid
(bool) - true if we parsed the binary data correctly.false if we did not successfully parsed the binary data for example byte were lost.
DataSet (list [numpy.ndarray(dtype=uint32, ndim =1)]
) - list holding the individual active data sets in the following order:[tr0 analogue mem A, tr0 analogue mem B, tr0 analogue mem C, tr0 analogue mem D, tr0 photon mem A, tr0 photon mem B, tr0 photon mem C, tr0 photon mem D, tr1 analogue mem A, tr1 analogue mem B …..]
if data set is not active in the configuration they will be omitted in the List
time_stamp
(int) - time stamp from the controller in millisecanalogue_shot_dict
(dict{Tr_number:{‘A’ : int, ‘B’: int, ‘C’: int, ‘D’: int}}) - hold the shot number for each analogue dataSet. if data set is not active in the configuration shot number will be omittedpc_shot_dict
(dict{Tr_number:{‘A’ : int, ‘B’: int, ‘C’: int, ‘D’: int}})- hold the shot number for each photon counting dataSet if data set is not active in the configuration shot number will be omitted
- pushDataLog(asciiFile_path, ethernetController, idn, startTime, Config)¶
write log file to spcified
asciiFile_path
- Parameters:
asciiFile_path (str) – path of the file to be written
pushBuffer (bytearray) – pushBuffer
idn (str) – controller identification string
timestamp (int) – controller timestamp in millisec
Config (Licel.licel_acq.Config()) – holds the acquisition configuration information
- removeInvalidDataFromBuffer(pushBuffer)¶
remove raw data from buffer until next occurrence of xff xff. this is used to clear the
`pushBuffer
if the data is invalid. In the example below we want to remove the first line containing invalid raw data until the next occurrence of the xff xff delimiter marking the start of new data set:``1- <xff xff> <timestamp> <shots> <INVALID raw data>
- saveAcquisDataToLicelFileFormat(prefix, shots, bins, Config, my_startTime, my_stopTime, TRHardwareInfo, deviceNumber, DataType, Memory, Data)¶
Save the acquired DataSet to the file path specified in the configuration in the Licel file format. for more information about licel file format see: https://licel.com/raw_data_format.html
- Parameters:
shots (int) – hold the shot number .
bins (int) – hold the number of acquired bins
Config (Licel.licel_acq.Config()) – holds the acquisition configuration information
my_startTime (datetime.datetime.now()) – acquisition start time.
my_stopTime (datetime.datetime.now()) – acquisition stop time.
TRHardwareInfo (dict{'ADC Bits' : ' ', 'PC Bits' : ' ' , 'FIFOLength': ' ' , 'binWidth' : ' ','ID' : ' ', 'HWCAP' : ' ', 'binShift': ' ', 'raw': ' '}) – holds information about transient hardware info
deviceNumber (int) – Transient recorder device number
DataType (str) – desribe the datatype of the acutal data. can either be PhotonCounting or Analogue
memory (str) – memory of the acquired data. can either be
MEM_A
orMEM_B
Data – holds the acquired dataset
- savePushDataToLicelFileFormat(DataSet, Config, startTime, stoptTime, TRHardwareInfo, time_stamp, analogue_shot_dict, pc_shot_dict, shots, ACQUISPERFILE)¶
Save the acquired DataSet to the file path specified in the configuration in the Licel file format. for more information about licel file format see: https://licel.com/raw_data_format.html
- Parameters:
DataSet (list[numpy.ndarray(dtype=uint32, ndim =1)]) – holds the acquired dataset
Config (Licel.licel_acq.Config()) – holds the acquisition configuration information
startTime (datetime.datetime.now()) – acquisition start time.
stopTime (datetime.datetime.now()) – acquisition stop time.
TRHardwareInfos (dict{Tr_number : {TRHardwareInfo}}) – dictionary holding TRHardwareinfo for each detected transient recorder.
time_stamp (int) – time stamp from the controller in millisec
analogue_shot_dict ((dict{'A' : int, 'B': int, 'C': int, 'D': int}) -) – hold the shot number for each memory. if data set is not active in the configuration shot number will be omitted
pc_shot_dict ((dict{'A' : int, 'B': int, 'C': int, 'D': int})-) – hold the shot number for each photon counting memory if data set is not active in the configuration shot number will be omitted
shots – number of acuqired shots.
:type shots
- scaleAnalogData(dNormalized, inputRange, TRHardwareInfo)¶
Scales the normalized data with respect to the input range. For more info read: https://licel.com/manuals/programmingManual.pdf#subsection.5.3
- Parameters:
dNormalized (numpy.ndarray(dtype=double, ndim =1)) – normalized data.
inputRange (str) – input range possible values are: ‘-500mV’ ‘-100mV’ ‘-20mV’
TRHardwareInfo (dict{'ADC Bits' : ' ', 'PC Bits' : ' ' , 'FIFOLength': ' ' , 'binWidth' : ' ','ID' : ' ', 'HWCAP' : ' ', 'binShift': ' ', 'raw': ' '}) – holds information about transient hardware info
- Returns:
scaled data
- Return type:
numpy.ndarray(dtype=double, ndim =1)
- scale_PhotonCounting(normalizedPhotonCount, binWidth)¶
Scales the normalized photon counting data with respect to the bin width For more info read: https://licel.com/manuals/programmingManual.pdf#subsection.5.3
- Parameters:
normalizedPhotonCount (numpy.ndarray(dtype=double, ndim =1)) – normalized photon counting data
binwidth (double) – bin width in meter.
- Returns:
scaled photon counting data
- Return type:
numpy.ndarray(dtype=double, ndim =1)