From e8bbf30d6e1056cb6b341f518330799edd9a0fa1 Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Tue, 23 Mar 2021 16:12:40 +0100 Subject: [PATCH] TMSS-604: fixed test. do not assume that all dataproducts have the 'sap' template. fixed copy/paste error for pipeline_idx field_idx/tab_idx --- SAS/TMSS/backend/src/tmss/tmssapp/adapters/parset.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/parset.py b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/parset.py index 27dda83cd5f..00ed6e2a279 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/adapters/parset.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/adapters/parset.py @@ -145,7 +145,7 @@ def _convert_beamformer_settings_to_parset_dict(subtask: models.Subtask, spec: d beamformer_pipeline_parsets = [] # Process beamformer pipelines - for pipeline in spec['COBALT']['beamformer']['tab_pipelines']: + for pipeline_idx, pipeline in enumerate(spec['COBALT']['beamformer']['tab_pipelines']): pipeline_parset = {} pipeline_parset.update(_add_prefix(_stokes_settings_parset_subkeys(pipeline['coherent']), "CoherentStokes.")) pipeline_parset.update(_add_prefix(_stokes_settings_parset_subkeys(pipeline['incoherent']), "IncoherentStokes.")) @@ -176,12 +176,13 @@ def _convert_beamformer_settings_to_parset_dict(subtask: models.Subtask, spec: d for s in range(nr_stokes): for p in range(nr_parts): dataproduct = [dp for dp in dataproducts - if dp.specifications_doc["sap"] == sap['name'] + if dp.specifications_doc.get("sap") == sap['name'] + and "identifiers" in dp.specifications_doc and dp.specifications_doc["identifiers"]["pipeline_index"] == pipeline_idx - and dp.specifications_doc["identifiers"]["tab_index"] == field_idx + and dp.specifications_doc["identifiers"]["tab_index"] == tab_idx and dp.specifications_doc["identifiers"]["stokes_index"] == s and dp.specifications_doc["identifiers"]["part_index"] == p - and dp.specifications_doc["coherent"] == tab['coherent']] + and dp.specifications_doc.get("coherent") == tab['coherent']] if tab['coherent']: coherent_dataproducts.append(dataproduct[0] if dataproduct else null_dataproduct) else: -- GitLab