Main Level#
Trigger Logic Unit#
- class aidatlu.main.tlu.AidaTLU(hw, config_dict, clock_config_path, i2c=<class 'aidatlu.hardware.i2c.I2CCore'>)[source]#
-
- get_device_id() int [source]#
Read back board id. Consists of six blocks of hex data
- Returns:
Board id as 48 bits integer
- Return type:
int
- get_event_fifo_csr() int [source]#
Reads value from ‘EventFifoCSR’, corresponds to status flags of the FIFO.
- Returns:
number of events
- Return type:
int
- get_event_fifo_fill_level() int [source]#
- Reads value from ‘EventFifoFillLevel’
Returns the number of words written in the FIFO. The lowest 14-bits are the actual data.
- Returns:
buffer level of the fifi
- Return type:
int
- get_run_active() bool [source]#
Reads register ‘RunActiveRW’
- Returns:
Returns bool of the run active register.
- Return type:
bool
- get_scalers() list [source]#
reads current sc values from registers
- Returns:
all 6 trigger sc values
- Return type:
list
- get_timestamp() int [source]#
Get current time stamp.
- Returns:
Time stamp is not formatted.
- Return type:
int
- handle_status() None [source]#
Status message handling in separate thread. Calculates run time and obtain trigger information and sent it out every second.
- init_raw_data_table() None [source]#
Initializes the raw data table, where the raw FIFO data is found.
- log_sent_status(time: int) None [source]#
- Logs the status of the TLU run with trigger number, runtime usw.
Also calculates the mean trigger frequency between function calls.
- Parameters:
time (int) – current runtime of the TLU
- log_trigger_inputs(event_vector: list) None [source]#
Logs which inputs triggered the event corresponding to the event vector.
- Parameters:
event_vector (list) – 6 data long event vector from the FIFO.
- pull_fifo_event() list [source]#
- Pulls event from the FIFO. This is needed in the run loop to prevent the buffer to get stuck.
if this register is full the fifo needs to be reset or new triggers are generated but not sent out. #TODO check here if the FIFO is full and reset it if needed would prob. make sense.
- Returns:
6 element long vector containing bitwords of the data.
- Return type:
list
- reset_configuration() None [source]#
Switch off all outputs, reset all counters and set threshold to 1.2V
- run_loop() None [source]#
A single instance of the run loop. In a TLU run this function needs to be called repeatedly.
- Raises:
KeyboardInterrupt – The run loop can be interrupted when raising a KeyboardInterrupt.
- set_enable_record_data(value: int) None [source]#
#TODO not sure what this does. Looks like a separate internal event buffer to the FIFO.
- Parameters:
value (int) – #TODO I think this does not work
- set_event_fifo_csr(value: int) None [source]#
Sets value to the EventFifoCSR register.
- Parameters:
value (int) – 0 resets the FIFO. #TODO can do other stuff that is not implemented
- set_run_active(state: bool) None [source]#
Raises internal run active signal.
- Parameters:
state (bool) – True sets run active, False disables it.
- start_run_configuration() None [source]#
Start of the run configurations, consists of timestamp resets, data preparations and zmq connections initialization.
Configuration parser#
Data interpretation#
- aidatlu.main.data_parser.interpret_data(filepath_in: str | Path, filepath_out: str | Path = None, chunk_size: int = 1000000) None [source]#
Interprets raw tlu data. The data is interpreted in chunksizes. The data is parsed form filepath_in to filepath_out. An event consists of six consecutive raw data entries the last entry should be always 0. The raw data is sliced and the last data entry checked for corrupted data.
- Parameters:
filepath_in (str | Path) – raw data file path as string or Path object
filepath_out (str | Path) – output path of the interpreted data as string or Path object