Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • calibration/pycalibration
1 result
Show changes
...@@ -40,7 +40,14 @@ AGIPD_CONFIGURATIONS = { ...@@ -40,7 +40,14 @@ AGIPD_CONFIGURATIONS = {
} }
} }
DATA_MAPPING = { REMI_CONFIGURATIONS = {
'correct':
{
'first-pulse-offset': {'type': int}
}
}
AGIPD_DATA_MAPPING = {
"karabo-da": { "karabo-da": {
'type': list, 'type': list,
'choices': [f"AGIPD{i:02d}" for i in range(16)], 'choices': [f"AGIPD{i:02d}" for i in range(16)],
...@@ -48,9 +55,18 @@ DATA_MAPPING = { ...@@ -48,9 +55,18 @@ DATA_MAPPING = {
} }
} }
REMI_DATA_MAPPING = {
"karabo-da": {
'type': list,
'choices': ['DIGI02'],
'msg': "Choices: [DIGI02]. "
}
}
AVAILABLE_DETECTORS = { AVAILABLE_DETECTORS = {
"SPB_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, DATA_MAPPING], "SPB_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, AGIPD_DATA_MAPPING],
"MID_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, DATA_MAPPING], "MID_DET_AGIPD1M-1": [AGIPD_CONFIGURATIONS, AGIPD_DATA_MAPPING],
'SQS_REMI_DLD6': [REMI_CONFIGURATIONS, REMI_DATA_MAPPING]
} }
...@@ -67,7 +83,7 @@ required_args = parser.add_argument_group('required arguments') ...@@ -67,7 +83,7 @@ required_args = parser.add_argument_group('required arguments')
required_args.add_argument( required_args.add_argument(
'--karabo-id', type=str, '--karabo-id', type=str,
choices=['SPB_DET_AGIPD1M-1', 'MID_DET_AGIPD1M-1']) choices=list(AVAILABLE_DETECTORS.keys()))
required_args.add_argument( required_args.add_argument(
'--proposal', type=str, '--proposal', type=str,
help='The proposal number, without leading p, but with leading zeros.') help='The proposal number, without leading p, but with leading zeros.')
...@@ -79,6 +95,9 @@ action_group.add_argument( ...@@ -79,6 +95,9 @@ action_group.add_argument(
action_group.add_argument( action_group.add_argument(
'--dark', '-d', action='store_true') '--dark', '-d', action='store_true')
parser.add_argument(
'--verbose', '-v', action='store_true',
help='More verbose output, i.a. print the entire configuration written.')
parser.add_argument( parser.add_argument(
'--apply', action='store_true', '--apply', action='store_true',
help='Apply and push the requested configuration update to the git.') help='Apply and push the requested configuration update to the git.')
...@@ -105,7 +124,7 @@ def _add_available_configs_to_arg_parser(karabo_id: str, action: str): ...@@ -105,7 +124,7 @@ def _add_available_configs_to_arg_parser(karabo_id: str, action: str):
along with the arguments. along with the arguments.
""" """
available_conf = [{}, DATA_MAPPING] available_conf = [{}, AVAILABLE_DETECTORS[karabo_id][1]]
# adding "no" bools to available configurations # adding "no" bools to available configurations
# Loop over action configurations in available_detectors dictionary. # Loop over action configurations in available_detectors dictionary.
...@@ -175,7 +194,7 @@ def _create_new_config_from_args_input( ...@@ -175,7 +194,7 @@ def _create_new_config_from_args_input(
continue continue
# checking if data-mapping was updated. # checking if data-mapping was updated.
if key in DATA_MAPPING.keys(): if key in AVAILABLE_DETECTORS[karabo_id][1].keys():
if 'data-mapping' not in new_conf.keys(): if 'data-mapping' not in new_conf.keys():
new_conf['data-mapping'] = {karabo_id: {key: {}}} new_conf['data-mapping'] = {karabo_id: {key: {}}}
new_conf['data-mapping'][karabo_id][key] = value new_conf['data-mapping'][karabo_id][key] = value
...@@ -241,7 +260,7 @@ def main(): ...@@ -241,7 +260,7 @@ def main():
print("-" * 80) print("-" * 80)
pyaml = yaml.dump(new_conf, default_flow_style=False) pyaml = yaml.dump(new_conf, default_flow_style=False)
print(f"Sending the following update:\n {pyaml}") print(f"# Sending the following update:\n{pyaml}")
print("-" * 80) print("-" * 80)
con = zmq.Context() con = zmq.Context()
socket = con.socket(zmq.REQ) socket = con.socket(zmq.REQ)
...@@ -258,8 +277,17 @@ def main(): ...@@ -258,8 +277,17 @@ def main():
]) ])
socket.send(f"['{msg}']".encode()) socket.send(f"['{msg}']".encode())
resp = socket.recv_multipart()[0] resp = socket.recv_multipart()[0]
print("Configuration now in place is:") print("# Configuration now in place is:")
print(resp.decode())
if args['verbose']:
print(resp.decode())
else:
total_config = yaml.safe_load(resp.decode())
print(yaml.dump({
action: {instrument: {
karabo_id: total_config[action][instrument][karabo_id]
}}
}, default_flow_style=False))
if __name__ == '__main__': if __name__ == '__main__':
......