API

Run Control

class src.acoustics.Acoustics(mainwindow)
error
event_started
event_stopped
periodic_task()
range_conversion = {'±1 V': 2000, '±100 mV': 200, '±2 V': 4000, '±200 mV': 400, '±5 V': 10000, '±500 mV': 1000}
run()
sample_rate_conversion = {'1 MS/s': 1000000, '1 kS/s': 1000, '10 MS/s': 10000000, '10 kS/s': 10000, '100 MS/s': 100000000, '100 kS/s': 100000, '12.5 MS/s': 12500000, '2 MS/s': 2000000, '2 kS/s': 2000, '20 kS/s': 20000, '200 kS/s': 200000, '25 MS/s': 25000000, '5 MS/s': 5000000, '5 kS/s': 5000, '50 MS/s': 50000000, '50 kS/s': 50000, '500 kS/s': 500000}
save_config()
start_event()
start_gage()
stop_event()
class src.config.Config(mainwindow)

Class object to load and save run config files

apply_config(ui)
error
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_mainwindow()
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.niusb.NIUSB(mainwindow)
all_cams_stopped
check_niusb()
drive_definition = {'': 'input', 'comm_cam1': 'active_drive', 'comm_cam2': 'active_drive', 'comm_cam3': 'active_drive', 'latch': 'open_collector', 'reset': 'open_collector', 'state_cam1': 'open_collector', 'state_cam2': 'open_collector', 'state_cam3': 'open_collector', 'trig': 'open_collector', 'trigen_cam1': 'active_drive', 'trigen_cam2': 'active_drive', 'trigen_cam3': 'active_drive', 'trigff_ar': 'open_collector', 'trigff_but': 'open_collector', 'trigff_cam1': 'open_collector', 'trigff_cam2': 'open_collector', 'trigff_cam3': 'open_collector', 'trigff_cf4': 'open_collector', 'trigff_p': 'open_collector', 'trigff_piezo': 'open_collector', 'trigff_rc': 'open_collector'}
error
event_started
event_stopped
ff_dict = {'trigff_ar': 'Kulite Ar', 'trigff_but': 'Ext Button', 'trigff_cam1': 'Cam1', 'trigff_cam2': 'Cam2', 'trigff_cam3': 'Cam3', 'trigff_cf4': 'Kulite CF4', 'trigff_p': 'Pressure', 'trigff_piezo': 'Piezo', 'trigff_rc': 'Run Control'}
periodic_task()
pin_definition = {'': 'input', 'comm_cam1': 'output', 'comm_cam2': 'output', 'comm_cam3': 'output', 'latch': 'input', 'reset': 'output', 'state_cam1': 'input', 'state_cam2': 'input', 'state_cam3': 'input', 'trig': 'output', 'trigen_cam1': 'output', 'trigen_cam2': 'output', 'trigen_cam3': 'output', 'trigff_ar': 'input', 'trigff_but': 'input', 'trigff_cam1': 'input', 'trigff_cam2': 'input', 'trigff_cam3': 'input', 'trigff_cf4': 'input', 'trigff_p': 'input', 'trigff_piezo': 'input', 'trigff_rc': 'input'}
run()
run_started
run_stopped
send_trigger(source)
start_event()
start_run()
stop_event()
stop_run()
trigger_detected
trigger_ff
class src.sql.SQL(mainwindow)
close_connection()
connect_and_execute(query)
deleteLater(self, /) None
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.CheckBoxPairBinder(checkbox1, checkbox2)
sync_checkboxes(state)
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()
class src.ui_loader.LogWindow(main_window)
load_log()
periodic_task()
class src.writer.Writer(mainwindow)
error
event_stopped
periodic_task()
run()
run_stopped
write_event_data()
write_run_data()

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:
  • file_name (str) – Path to the SBC binary file

  • max_size (int) – Maximum size in MB to load at once (0 = load all)

  • block_len (int) – Number of rows per block for streaming mode

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.