Skip to content
Snippets Groups Projects
Commit 098b3924 authored by Philipp Schmidt's avatar Philipp Schmidt
Browse files

Merge branch 'feat/litframefinder-update-config' into 'master'

Add litframefinder-relevant arguments to update_config script

See merge request detectors/pycalibration!723
parents 70d32a80 c95493b1
No related branches found
No related tags found
1 merge request!723Add litframefinder-relevant arguments to update_config script
......@@ -84,27 +84,30 @@ def test_main(capsys):
EXPECTED_CONF = [
{
'force-hg-if-below': {'typ': int},
'rel-gain': {'typ': bool},
'xray-gain': {'typ': bool},
'blc-noise': {'typ': bool},
'blc-set-min': {'typ': bool},
'dont-zero-nans': {'typ': bool},
'dont-zero-orange': {'typ': bool},
'max-pulses': {'typ': list,
'force-hg-if-below': {'type': int},
'rel-gain': {'type': bool},
'xray-gain': {'type': bool},
'blc-noise': {'type': bool},
'blc-set-min': {'type': bool},
'dont-zero-nans': {'type': bool},
'dont-zero-orange': {'type': bool},
'max-pulses': {'type': list,
'msg': 'Range list of maximum pulse indices '
'(--max-pulses start end step). '
'3 max input elements. '},
'no-rel-gain': {'typ': bool},
'no-xray-gain': {'typ': bool},
'no-blc-noise': {'typ': bool},
'no-blc-set-min': {'typ': bool},
'no-dont-zero-nans': {'typ': bool},
'no-dont-zero-orange': {'typ': bool}
'use-litframe-finder': {'type': str},
'litframe-device-id': {'type': str},
'energy-threshold': {'type': int},
'no-rel-gain': {'type': bool},
'no-xray-gain': {'type': bool},
'no-blc-noise': {'type': bool},
'no-blc-set-min': {'type': bool},
'no-dont-zero-nans': {'type': bool},
'no-dont-zero-orange': {'type': bool}
},
{
'karabo-da': {
'typ': list,
'type': list,
'choices': [
'AGIPD00', 'AGIPD01', 'AGIPD02', 'AGIPD03',
'AGIPD04', 'AGIPD05', 'AGIPD06', 'AGIPD07',
......
......@@ -9,37 +9,40 @@ import zmq
AGIPD_CONFIGURATIONS = {
"correct":
{
"force-hg-if-below": {'typ': int},
"rel-gain": {'typ': bool},
"xray-gain": {'typ': bool},
"blc-noise": {'typ': bool},
"blc-set-min": {'typ': bool},
"dont-zero-nans": {'typ': bool},
"dont-zero-orange": {'typ': bool},
"max-pulses": {'typ': list,
"force-hg-if-below": {'type': int},
"rel-gain": {'type': bool},
"xray-gain": {'type': bool},
"blc-noise": {'type': bool},
"blc-set-min": {'type': bool},
"dont-zero-nans": {'type': bool},
"dont-zero-orange": {'type': bool},
"max-pulses": {'type': list,
'msg': "Range list of maximum pulse indices "
"(--max-pulses start end step). "
"3 max input elements. "},
'use-litframe-finder': {'type': str},
'litframe-device-id': {'type': str},
'energy-threshold': {'type': int}
},
"dark":
{
"thresholds-offset-hard-hg": {'typ': list},
"thresholds-offset-hard-mg": {'typ': list},
"thresholds-offset-hard-lg": {'typ': list},
"thresholds-offset-hard-hg-fixed": {'typ': list},
"thresholds-offset-hard-mg-fixed": {'typ': list},
"thresholds-offset-hard-lg-fixed": {'typ': list},
"thresholds-offset-sigma": {'typ': list},
"thresholds-noise-hard-hg": {'typ': list},
"thresholds-noise-hard-mg": {'typ': list},
"thresholds-noise-hard-lg": {'typ': list},
"thresholds-noise-sigma": {'typ': list},
"thresholds-offset-hard-hg": {'type': list},
"thresholds-offset-hard-mg": {'type': list},
"thresholds-offset-hard-lg": {'type': list},
"thresholds-offset-hard-hg-fixed": {'type': list},
"thresholds-offset-hard-mg-fixed": {'type': list},
"thresholds-offset-hard-lg-fixed": {'type': list},
"thresholds-offset-sigma": {'type': list},
"thresholds-noise-hard-hg": {'type': list},
"thresholds-noise-hard-mg": {'type': list},
"thresholds-noise-hard-lg": {'type': list},
"thresholds-noise-sigma": {'type': list},
}
}
DATA_MAPPING = {
"karabo-da": {
'typ': list,
'type': list,
'choices': [f"AGIPD{i:02d}" for i in range(16)],
'msg': "Choices: [AGIPD00 ... AGIPD15]. "
}
......@@ -108,19 +111,19 @@ def _add_available_configs_to_arg_parser(karabo_id: str, action: str):
# Loop over action configurations in available_detectors dictionary.
for key, val in AVAILABLE_DETECTORS[karabo_id][0][action].items():
available_conf[0][key] = val
if val['typ'] == bool:
available_conf[0][f'no-{key}'] = {'typ': bool}
if val['type'] == bool:
available_conf[0][f'no-{key}'] = {'type': bool}
for conf in available_conf:
for option, info in conf.items():
typ = info['typ']
type_ = info['type']
choices = info.get('choices')
if info['typ'] == list:
if info['type'] == list:
arguments = {
"action": 'append',
"nargs": '+',
}
typ = str
type_ = str
# Avoid having a big line of choices in the help message.
if choices:
arguments.update({
......@@ -135,10 +138,10 @@ def _add_available_configs_to_arg_parser(karabo_id: str, action: str):
if 'msg' in info.keys():
help_msg += info['msg']
help_msg += f"Type: {info['typ'].__name__} ".upper()
help_msg += f"Type: {info['type'].__name__} ".upper()
parser.add_argument(
f"--{option}",
type=typ,
type=type_,
help=help_msg,
**arguments,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment