API
Run Control
- class src.config.Config(mainwindow)
Class object to load and save run config files
- apply_config(ui)
- apply_config_from_mainwindow()
- error
- init_config_to_mainwindow()
- load_config()
- load_config_from_file(ui)
Updates the config dict with new json dict. The new json has to follow the same structure, but doesn’t need to have all the values
- load_config_to_window(ui)
- periodic_task()
- run_config_saved
- save_config()
- save_config_from_ui(ui)
- start_event()
- start_run()
- stop_run()
- update_dict(original, new)
recursive helper function to update config dictionary with new settings. Prevents overwriting keys in the same level that is written.
- class src.sql.SQL(mainwindow)
- close_connection()
- connect_and_execute(query)
- error
- event_started
- event_stopped
- periodic_task()
- retrieve_run_id(date='')
- run()
- run_started
- run_stopped
- setup_connection()
- start_event()
- start_run()
- stop_event()
- stop_run()
- class src.ui_loader.SettingsWindow(mainwindow)
- amp1_iv
- amp2_iv
- amp3_iv
- apply_config()
- caen_group_changed(state)
- caen_individual_changed()
- load_config()
- load_config_from_file()
- run_amp1_iv()
- run_amp2_iv()
- run_amp3_iv()
- save_config()
- select_amp1_iv_dir()
- select_amp2_iv_dir()
- select_amp3_iv_dir()
- select_caen_data_path()
- select_clock_sketch_dir()
- select_data_dir()
- select_log_dir()
- select_position_sketch_dir()
- select_trigger_sketch_dir()
- upload_clock_sketch()
- upload_position_sketch()
- upload_trigger_sketch()
SBC Binary Format
- class sbcbinaryformat.Streamer(file_name, max_size=0, block_len=100)
This class manages opening a sbc binary file. It reads the header and saves data into a dictionary of numpy arrays. For large files, it uses block-based loading to handle partial reads efficiently.
- Parameters:
- Raises:
OSError – If the file format is invalid or unsupported endianness
ValueError – If the header format is incorrect or incompatible
IndexError – If the requested range is out of bounds
NotImplementedError – If step slicing is attempted in streaming mode
ValueError – If the ‘end’ and ‘length’ parameters are used together
ValueError – If the ‘start’ parameter is negative and exceeds file length
ValueError – If the ‘length’ parameter is not positive
ValueError – If the ‘end’ parameter is negative and exceeds file length
- get_info()
Get file and streaming information
- to_dict(start=None, end=None, length=None)
Convert data to dictionary of arrays
- Parameters:
start – Start index for range (inclusive). If not provided, defaults to the beginning of the data.
end – End index for range (exclusive). If not provided, defaults to the end of the data.
length – Number of elements to read starting from start. Cannot be used together with end.
- class sbcbinaryformat.Writer(file_name, columns_names, dtypes, sizes)
- SBC Binary Header description:
Header of a binary format is divided in 4 parts:
1.- Edianess - always 4 bits long (uint32_t)
2.- Data Header size - always 2 bits long (uint16_t)
and is the length of the next bit of data
3.- Data Header - is data header long.
Contains the structure of each line. It is always found as a raw
string in the form “{name_col};{type_col};{size1},{size2}…;…;
Cannot be longer than 65536 bytes.
4.- Number of lines - always 4 bits long (int32_t)
Number of lines in the file. If 0, it is indefinitely long.
- write(data)
Write multi line data to file.
- Raises:
Value Error – if data is not a dictioanry or a list of dictionaries
or keys or lengths do not match columns of the file, or dimensions of values cannot be broadcasted to sizes.