mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-08 01:38:42 +01:00
* added empty c extension * added rotation to the decoding * added color map, options and findex * minor * move checks to before acquisition * added pixel map based decoder * cleanup * no thread creation for single thread processing * added rotation and test to compare * allow high and low water mark for zmq (also buffer size) for fast readouts * removed roatation during decoding * added Transpose to image and invert Y False to invert it * retains the zoomed state after the first image of gui, catch and display exception if no detector connected * moved start frame to dockable widget, removed extra frame number label, moved current measurement also to dockable widget, hide frame plot entirely when showing patternviewer * first image dependin on which plot * remember settings of main window size and position, dockewidget if docked, its size and posisiotn as well, then update it next time the gui is opened * change in comment * using c decoder for moench 04 and matterhorn * catch exception from invalid image from decoder * clean up * update row and col when choosing image type, neeeded to show values * fix for previous PR * disable resetting colormap values keep the range selected for every new acquisition * fix typos + tested on virtual matterhorn * minor print * refactored Slow ADCs Tab * refactored DAC tab * refactored power supplies * refactored signals tab * refactored transceiver tab * fix typo * fix typo2 * remove commented code * delete commented code * delete commented code * delete commented signals code * remove commented code for transceiver tab * refactor adc tab * refactor Pattern Tab * Refactor transceivers tab (PR#5) (#118) * refactored transceiver tab * remove commented code for transceiver tab --------- Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com> * refactor adc tab (PR#6) (#119) * refactor adc tab * refactored Plot and Acquisition Tabs * fix the regression issue * restructure project files * applying singleton and renaming tabs to services * working install using pip * applies singleton to tab classes and remove CI erros * added pyzmq and pillow * remove the singleton implementation and keep changes * fix merge errors in mainWindow * moved misplaced init file * rename service to tab * reorganize imports * iterate over tabs * reorder tabs * add slowadc to the list * saving changes (buggy) power supply ui not showing in the gui * split power supply tab * fixed tests * add hardcoded values to defines file * fix error * separate power supply * fix errors for powerSuppliesTab * split dacs * split slow adcs * split signals tab * added tests for bit_utils * add slowAdc class to defines * split transceiver ui file * split adc.ui * split pattern ui file * split plot and acquisition ui file * added basic test for parsing bit names * removed redundant code in read_alias_file * fix dacs ui position * testing for correct exception * cmd and args at split * group radio buttons * fix comments from PR#1 * show legend * added python version and dev requirements to setup.py * fix dac issue * moved _decoder into pkg * added inplace build * removed clear * fixed dependencies * make tests run without slsdet * updated name of action * define colcount * fixed loading of alias file * add yapf and ruff * apply formatting * fix E and F rules * add more ruff rules * change variable name * squashing gh debugging commits and add pre-commit * update label values to mv units * add hook for yapf * reconfigure yapf precommit hook * add format and check_format to makefile * change gh actions * update readme * added check_format * WIP * added linting in github action * updated readme] * add more control for color choice * remove useless file * fix un-updated line after refactoring Defines BIT0_31_MASK is not found in Defines.signals * visually improve the interface * fix last commit * add only selected plots for legend * add hide legend button * change hide legend to show legend checkbox show legend is checked by default * add support for saving in numpy * solve conversations * fix acq index offset * fix browse button in pattern error * fix other browse button errors * finish tests and add usage.md * remove buffer * add file,numpy-like interface and tests * remove useless .npy files * subscriptible npz files * remove useless files * remove repetetive tests * save changes * add mode r+, add with support,remove logging * remove offset of acqIndex between raw and numpy saving * fix only saving last frame * save signals of multiple devices * add comments and move condition for clearer code * fix bug when vieweing pattern file * iterate over enabled and plotted plots * add padestal substraction to transceiver and analog data * init pedestal frames to detector.frames * restore old exception * add pedestal substraction for digital signals * remove frames spinbox from plotTab * remove comments and use str instead of Path * avoid saving all frames * correct exception and log error's trace * add gui tests * add waveform test * add pedestal test * refactor by using fixtures * add tests for moench analog and pattern * add pytest-qt to dependencies * add save and load gui parameters * remove nohup file * fix old bug IndexError * save plot type * a * handle canceling load, loading matterhorn pedestal for moench * remove comparing .png files for pattern test * save plot type * red error on status bar when shape mismatch for loaded pedestal * fix makefile and docstrings * fix PRs conversation * move code into different function * fix wrong function names for power supply * removed old ctbgui * removed unnecessary files --------- Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com> Co-authored-by: Braham Bechir <braham_b@pc11979.psi.ch> Co-authored-by: Bechir <bechir.braham@psi.ch> Co-authored-by: Bechir <bechir.brahem420@gmail.com>
102 lines
3.3 KiB
Python
102 lines
3.3 KiB
Python
from pathlib import Path
|
|
|
|
|
|
def read_alias_file(alias_file):
|
|
with open(alias_file) as fp:
|
|
lines_alias = fp.readlines()
|
|
return parse_alias_lines(lines_alias)
|
|
|
|
|
|
def parse_alias_lines(lines_alias):
|
|
bit_names = [None] * 64
|
|
bit_plots = [None] * 64
|
|
bit_colors = [None] * 64
|
|
adc_names = [None] * 32
|
|
adc_plots = [None] * 32
|
|
adc_colors = [None] * 32
|
|
dac_names = [None] * 18
|
|
sense_names = [None] * 8
|
|
power_names = [None] * 5
|
|
pat_file_name = None
|
|
|
|
for line_nr, line in enumerate(lines_alias):
|
|
ignore_list = ['PATCOMPILER']
|
|
|
|
# skip empty lines
|
|
if line == '\n' or len(line) == 0:
|
|
continue
|
|
# skip comments
|
|
if line.startswith('#'):
|
|
continue
|
|
|
|
cmd, *args = line.split()
|
|
|
|
if not args:
|
|
raise Exception(
|
|
f"Alias file parsing failed: Require atleast one argument in addition to command. ({line_nr}:{line})")
|
|
|
|
if cmd.startswith("BIT"):
|
|
process_alias_bit_or_adc(cmd, args, bit_names, bit_plots, bit_colors)
|
|
|
|
elif cmd.startswith("ADC"):
|
|
process_alias_bit_or_adc(cmd, args, adc_names, adc_plots, adc_colors)
|
|
|
|
elif cmd.startswith("DAC"):
|
|
if len(args) > 1:
|
|
raise Exception(f"Too many arguments {len(args)} (expected max: 1) for this type. ({line_nr}:{line})")
|
|
i = int(cmd[3:])
|
|
dac_names[i] = args[0]
|
|
|
|
elif cmd.startswith("SENSE"):
|
|
if len(args) > 1:
|
|
raise Exception(f"Too many arguments {len(args)} (expected max: 1) for this type. ({line_nr}:{line})")
|
|
i = int(cmd[5:])
|
|
sense_names[i] = args[0]
|
|
|
|
elif cmd in ["VA", "VB", "VC", "VD", "VIO"]:
|
|
if len(args) > 1:
|
|
raise Exception(f"Too many arguments {len(args)} (expected max: 1) for this type. ({line_nr}:{line})")
|
|
|
|
match cmd:
|
|
case "VA":
|
|
i = 0
|
|
case "VB":
|
|
i = 1
|
|
case "VC":
|
|
i = 2
|
|
case "VD":
|
|
i = 3
|
|
case "VIO":
|
|
i = 4
|
|
power_names[i] = args[0]
|
|
|
|
elif cmd == "PATFILE":
|
|
if len(args) > 1:
|
|
raise Exception(f"Too many arguments {len(args)} (expected max: 1) for this type. ({line_nr}:{line})")
|
|
|
|
pat_file_name = args[0]
|
|
path = Path(pat_file_name)
|
|
if not path.is_file():
|
|
raise Exception("Pattern file provided in alias file does not exist.<br><br>Pattern file:" +
|
|
pat_file_name)
|
|
elif cmd in ignore_list:
|
|
pass
|
|
|
|
else:
|
|
raise Exception(f"Command: {cmd} not supported. Line {line_nr}:{line}")
|
|
|
|
return bit_names, bit_plots, bit_colors, adc_names, adc_plots, adc_colors, dac_names, sense_names, power_names,\
|
|
pat_file_name
|
|
|
|
|
|
def process_alias_bit_or_adc(cmd, args, names, plots, colors):
|
|
n_args = len(args)
|
|
i = int(cmd[3:])
|
|
names[i] = args[0]
|
|
if n_args > 1:
|
|
plots[i] = bool(int(args[1]))
|
|
if n_args > 2:
|
|
colors[i] = args[2]
|
|
if n_args > 3:
|
|
raise Exception(f"Too many arguments {args} (expected max: 3) for this type in line.")
|