diff --git a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py index 01a1d4f2b27cac0b0ee1212467b17a3a89f9214d..6c2a061fe57bfd432391af7e5150bff4712d052d 100644 --- a/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py +++ b/SAS/TMSS/backend/src/tmss/tmssapp/subtasks.py @@ -155,6 +155,9 @@ def create_observation_subtask_specifications_from_observation_task_blueprint(ta # now go over the settings in the task_spec and 'copy'/'convert' them to the subtask_spec task_spec = task_blueprint.specifications_doc + # block size calculator will need to be fed all the relevant specs + cobalt_calculator_constraints = BlockConstraints() + # The calibrator has a minimal calibration-specific specification subset. # The rest of it's specs are 'shared' with the target observation. # So... copy the calibrator specs first, then loop over the shared target/calibrator specs... @@ -198,6 +201,17 @@ def create_observation_subtask_specifications_from_observation_task_blueprint(ta logger.info("Using station and correlator settings for calibrator observation task_blueprint id=%s from target observation task_blueprint id=%s", task_blueprint.id, target_task_blueprint.id) + # correlator + subtask_spec["COBALT"]["correlator"] = { "enabled": False } + + if "correlator" in task_spec: + subtask_spec["COBALT"]["correlator"]["enabled"] = True + subtask_spec["COBALT"]["correlator"]["channels_per_subband"] = task_spec["correlator"]["channels_per_subband"] + + corr = CorrelatorSettings() + corr.nrChannelsPerSubband = task_spec["correlator"]["channels_per_subband"] + corr.integrationTime = task_spec["correlator"]["integration_time"] + cobalt_calculator_constraints.correlator = corr # At this moment of subtask creation we known which stations we *want* from the task_spec # But we do not know yet which stations are available at the moment of observing. @@ -304,15 +318,15 @@ def create_observation_subtask_specifications_from_observation_task_blueprint(ta "angle1": task_spec["tile_beam"]["angle1"], "angle2": task_spec["tile_beam"]["angle2"] } + + + # Calculate block sizes and feed those to the spec + cobalt_calculator = BlockSize(constraints=cobalt_calculator_constraints) + subtask_spec["COBALT"]["blocksize"] = cobalt_calculator.blockSize + if "correlator" in task_spec: - corr = CorrelatorSettings() - corr.nrChannelsPerSubband = task_spec["correlator"]["channels_per_subband"] - corr.integrationTime = task_spec["correlator"]["integration_time"] - calculator = BlockSize(constraints=BlockConstraints(correlatorSettings=corr)) - subtask_spec["COBALT"]["correlator"] = {} - subtask_spec["COBALT"]["correlator"]["enabled"] = True - subtask_spec["COBALT"]["correlator"]["blocks_per_integration"] = calculator.nrBlocks - subtask_spec["COBALT"]["correlator"]["integrations_per_block"] = calculator.nrSubblocks + subtask_spec["COBALT"]["correlator"]["blocks_per_integration"] = cobalt_calculator.nrBlocks + subtask_spec["COBALT"]["correlator"]["integrations_per_block"] = cobalt_calculator.nrSubblocks # make sure that the subtask_spec is valid conform the schema validate_json_against_schema(subtask_spec, subtask_template.schema)