diff --git a/SAS/TMSS/src/tmss/tmssapp/populate.py b/SAS/TMSS/src/tmss/tmssapp/populate.py index 989f364e0a1451c0e40d7f4f0a644223188f8002..6f231a7191f2ed9be2276fb6bf9f6af7766e3b41 100644 --- a/SAS/TMSS/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/src/tmss/tmssapp/populate.py @@ -61,19 +61,20 @@ def populate_lofar_json_schemas(apps, schema_editor): _populate_qa_plots_subtask_template() #_populate_task_draft_example() # Should be removed - _populate_scheduling_set_for_scheduling_unit_reference() + _populate_test_scheduling_set() -def _populate_scheduling_set_for_scheduling_unit_reference(): +def _populate_test_scheduling_set(): """ - Create a Schedule Set to be able to refer to + Create a Test Schedule Set to be able to refer to when Scheduling Unit Draft is created from a + scheduling unit json :return: """ try: from lofar.sas.tmss.tmss.tmssapp import models from lofar.sas.tmss.test.tmss_test_data_django_models import SchedulingSet_test_data if isTestEnvironment() or isDevelopmentEnvironment(): - scheduling_set_data = SchedulingSet_test_data(name="Test Scheduling Set") + scheduling_set_data = SchedulingSet_test_data(name="Test Scheduling Set UC1") models.SchedulingSet.objects.create(**scheduling_set_data) except ImportError: @@ -214,331 +215,16 @@ def _populate_correlator_calibrator_schema(): def _populate_obscontrol_schema(): - subtask_template_data = {"type": SubtaskType.objects.get(value='observation'), - "name": "observationcontrol schema", - "description": 'observationcontrol schema for observation subtask', - "version": '0.1', - "schema": json.loads(''' -{ - "$id": "http://example.com/example.json", - "type": "object", - "$schema": "http://json-schema.org/draft-06/schema#", - "definitions": { - "pointing": { - "type": "object", - "additionalProperties": false, - "properties": { - "direction_type": { - "type": "string", - "title": "Reference frame", - "description": "", - "default": "J2000", - "enum": [ - "J2000", - "SUN", - "MOON", - "MERCURY", - "VENUS", - "MARS", - "JUPITER", - "SATURN", - "URANUS", - "NEPTUNE", - "PLUTO" - ] - }, - "angle1": { - "type": "number", - "title": "Angle 1", - "description": "First angle (f.e. RA)", - "default": 0 - }, - "angle2": { - "type": "number", - "title": "Angle 2", - "description": "Second angle (f.e. DEC)", - "default": 0 - } - } - } - }, - "additionalProperties": false, - "properties": { - "stations": { - "type": "object", - "default": {}, - "properties": { - "station_list": { - "title": "Station list", - "type": "array", - "additionalItems": false, - "additionalProperties": false, - "default": ["CS001"], - "items": { - "type": "string", - "enum": [ - "CS001", - "CS002", - "CS003", - "CS004", - "CS005", - "CS006", - "CS007", - "CS011", - "CS013", - "CS017", - "CS021", - "CS024", - "CS026", - "CS028", - "CS030", - "CS031", - "CS032", - "CS101", - "CS103", - "CS201", - "CS301", - "CS302", - "CS401", - "CS501", - "RS106", - "RS205", - "RS208", - "RS210", - "RS305", - "RS306", - "RS307", - "RS310", - "RS406", - "RS407", - "RS409", - "RS503", - "RS508", - "RS509", - "DE601", - "DE602", - "DE603", - "DE604", - "DE605", - "FR606", - "SE607", - "UK608", - "DE609", - "PL610", - "PL611", - "PL612", - "IE613", - "LV614" - ], - "title": "Station", - "description": "" - }, - "minItems": 1, - "uniqueItems": true - }, - "antenna_set": { - "type": "string", - "title": "Antenna set", - "description": "Which antennas & fields to use on each station", - "default": "HBA_DUAL", - "enum": [ - "HBA_DUAL", - "HBA_DUAL_INNER", - "HBA_ONE", - "HBA_ONE_INNER", - "HBA_ZERO", - "HBA_ZERO_INNER", - "LBA_INNER", - "LBA_OUTER", - "LBA_SPARSE_EVEN", - "LBA_SPARSE_ODD", - "LBA_ALL" - ] - }, - "filter": { - "type": "string", - "title": "Band-pass filter", - "description": "Must match antenna type", - "default": "HBA_110_190", - "enum": [ - "LBA_10_90", - "LBA_30_90", - "HBA_110_190", - "HBA_210_250" - ] - }, - "analog_pointing": { - "title": "Analog pointing", - "description": "HBA only", - "$ref": "#/definitions/pointing", - "default": {} - }, - "digital_pointings": { - "type": "array", - "title": "Beams", - "additionalItems": false, - "default": [{}], - "items": { - "title": "Beam", - "headerTemplate": "{{ i0 }} - {{ self.name }}", - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "title": "Name/target", - "description": "Custom identifier for this beam. Same name is same beam.", - "default": "" - }, - "pointing": { - "title": "Digital pointing", - "$ref": "#/definitions/pointing", - "default": {} - }, - "subbands": { - "type": "array", - "title": "Subband list", - "additionalItems": false, - "default": [], - "items": { - "type": "integer", - "title": "Subband", - "minimum": 0, - "maximum": 511 - } - } - } - } - } - } - }, - "COBALT": { - "type": "object", - "title": "COBALT correlator/beamformer", - "additionalProperties": false, - "default": {}, - "properties": { - "blocksize": { - "type": "integer", - "title": "Block size (samples)", - "description": "Size of blocks COBALT works on, must be a multiple of all processing requirements", - "default": 196608, - "minimum": 97656, - "maximum": 292968 - }, - "delay_compensation": { - "type": "boolean", - "title": "Apply delay compensation", - "description": "Compensate for geometric and clock differences", - "default": true - }, - "bandpass_correction": { - "type": "boolean", - "title": "Apply band-pass correction", - "description": "Compensate for differences in station sensitivity within a subband", - "default": true - }, - "correlator": { - "title": "Correlator", - "type": "object", - "default": {}, - "oneOf": [ - { - "type": "object", - "title": "Enabled", - "additionalProperties": false, - "default": {}, - "properties": { - "enabled": { - "type": "boolean", - "title": "Enabled", - "description": "", - "default": true, - "options": { - "hidden": true - }, - "enum": [ - true - ] - }, - "channels_per_subband": { - "type": "integer", - "title": "Channels/subband", - "description": "Number of frequency bands per subband", - "default": 64, - "minimum": 1, - "enum": [ - 1, - 8, - 16, - 32, - 64, - 128, - 256, - 512, - 1024 - ] - }, - "blocks_per_integration": { - "type": "integer", - "title": "Blocks per integration", - "description": "Number of blocks to integrate", - "default": 1, - "minimum": 1 - }, - "integrations_per_block": { - "type": "integer", - "title": "Integrations per block", - "description": "Number of integrations to fit within each block", - "default": 1, - "minimum": 1 - }, - "phase_centers": { - "type": "array", - "title": "Custom phase centers", - "additionalItems": false, - "default": [{}], - "items": { - "title": "Beam", - "headerTemplate": "Beam {{ self.index }}", - "type": "object", - "additionalProperties": false, - "default": {}, - "properties": { - "index": { - "type": "integer", - "title": "Station beam index", - "description": "Apply to this station beam", - "minimum": 0, - "default": 0 - }, - "pointing": { - "title": "Correlator pointing", - "$ref": "#/definitions/pointing", - "default": {} - } - } - } - } - } - }, - { - "type": "object", - "title": "Disabled", - "additionalProperties": false, - "default": {}, - "properties": {} - } - ] - } - } - } - } -}'''), - "realtime": True, - "queue": False, - "tags": []} - + with open(os.path.join(working_dir, "schemas/subtask-observation-control.json")) as json_file: + json_data = json.loads(json_file.read()) + subtask_template_data = {"type": SubtaskType.objects.get(value='observation'), + "name": "observationcontrol schema", + "description": 'observationcontrol schema for observation subtask', + "version": '0.1', + "realtime": True, + "queue": False, + "tags": [], + "schema": json_data} SubtaskTemplate.objects.create(**subtask_template_data) @@ -554,45 +240,23 @@ def _populate_stations_schema(): def _populate_taskrelation_selection_templates(): - # All - data = { "name": "All", - "description": 'Select all, apply no filtering.', - "version": '1', - "schema": json.loads('''{ - "$id": "http://example.com/example.json", - "type": "object", - "$schema": "http://json-schema.org/draft-06/schema#", - "definitions": {}, - "additionalProperties": false, - "properties": {} }'''), - "tags": []} + with open(os.path.join(working_dir, "schemas/empty-schema.json")) as json_file: + json_data = json.loads(json_file.read()) + data = {"name": "All", + "description": 'Select all, apply no filtering.', + "version": '1', + "schema": json_data} TaskRelationSelectionTemplate.objects.create(**data) # SAP - data = { "name": "SAP", - "description": 'Select by SAP.', - "version": '1', - "schema": json.loads('''{ -"$id": "http://example.com/example.json", -"$schema": "http://json-schema.org/draft-06/schema#", -"additionalProperties": false, -"definitions": {}, -"properties": { - "sap": { - "type": "array", - "title": "sap list", - "additionalItems": false, - "default": [], - "items": { - "type": "integer", - "title": "sap", - "minimum": 0, - "maximum": 1 - }}}, -"type": "object" -}'''), - "tags": []} + with open(os.path.join(working_dir, "schemas/task-relation-sap.json")) as json_file: + json_data = json.loads(json_file.read()) + data = {"name": "SAP", + "description": 'Select by SAP.', + "version": '1', + "tags": [], + "schema": json_data} TaskRelationSelectionTemplate.objects.create(**data) @@ -601,129 +265,61 @@ def _populate_dataproduct_specifications_templates(): # the filters that operate on the DataproductSpecificationTemplates defined here. However, filters probably # will only use a subset of dataproduct specs, but could allow selecting several values of which only one # can be met by a single dataproduct. - - template_data = { "name": "Empty", - "description": 'Empty DataproductSpecificationsTemplate with an empty schema', - "version": '1', - "schema": json.loads('''{ -"$id": "http://example.com/example.json", -"type": "object", -"$schema": "http://json-schema.org/draft-06/schema#", -"definitions": {}, -"additionalProperties": false, -"properties": {} }'''), -"tags": []} - + with open(os.path.join(working_dir, "schemas/empty-schema.json")) as json_file: + json_data = json.loads(json_file.read()) + template_data = {"name": "Empty", + "description": 'Empty DataproductSpecificationsTemplate with an empty schema', + "version": '1', + "tags": [], + "schema": json_data} DataproductSpecificationsTemplate.objects.create(**template_data) # SAP - template_data = {"name": "SAP", - "description": 'Select by SAP.', - "version": '1', - "schema": json.loads('''{ - "$id": "http://example.com/example.json", - "$schema": "http://json-schema.org/draft-06/schema#", - "additionalProperties": false, - "definitions": {}, - "properties": { - "sap": { - "type": "array", - "title": "sap list", - "additionalItems": false, - "default": [], - "items": { - "type": "integer", - "title": "sap", - "minimum": 0, - "maximum": 1 - }}}, - "type": "object" - }'''), - "tags": []} + with open(os.path.join(working_dir, "schemas/task-relation-sap.json")) as json_file: + json_data = json.loads(json_file.read()) + template_data = {"name": "SAP", + "description": 'Select by SAP.', + "version": '1', + "schema": json_data} DataproductSpecificationsTemplate.objects.create(**template_data) def _populate_dataproduct_feedback_templates(): - template_data = { "name": "Empty", - "description": 'Empty DataproductFeedbackTemplate with an empty schema', - "version": '1', - "schema": json.loads('''{ -"$id": "http://example.com/example.json", -"type": "object", -"$schema": "http://json-schema.org/draft-06/schema#", -"definitions": {}, -"additionalProperties": false, -"properties": {} }'''), -"tags": []} - + with open(os.path.join(working_dir, "schemas/empty-schema.json")) as json_file: + json_data = json.loads(json_file.read()) + template_data = {"name": "Empty", + "description": 'Empty DataproductFeedbackTemplate with an empty schema', + "version": '1', + "tags": [], + "schema": json_data} DataproductFeedbackTemplate.objects.create(**template_data) def _populate_qa_files_subtask_template(): - subtask_template_data = {"type": SubtaskType.objects.get(value=SubtaskType.Choices.QA_FILES.value), - "name": "QA file conversion", - "description": 'QA file conversion subtask template', - "version": '0.1', - "schema": json.loads(''' -{ - "$id": "http://example.com/example.json", - "type": "object", - "$schema": "http://json-schema.org/draft-06/schema#", - "definitions": {}, - "additionalProperties": false, - "properties": { - "nr_of_subbands": { - "type": "integer", - "title": "#subbands", - "default": -1, - "description": "Keep this number of subbands from the observation in the QA file, or all if -1" - }, - "nr_of_timestamps": { - "type": "integer", - "title": "#timestamps", - "default": 256, - "minimum": 1, - "description": "Extract this number of timestamps from the observation in the QA file (equidistantanly sampled, no averaging/interpolation)" - } - } -}'''), - "realtime": False, - "queue": True, - "tags": []} - + with open(os.path.join(working_dir, "schemas/subtask-qa-files.json")) as json_file: + json_data = json.loads(json_file.read()) + subtask_template_data = {"type": SubtaskType.objects.get(value=SubtaskType.Choices.QA_FILES.value), + "name": "QA file conversion", + "description": 'QA file conversion subtask template', + "version": '0.1', + "realtime": False, + "queue": True, + "tags": [], + "schema": json_data} SubtaskTemplate.objects.create(**subtask_template_data) -def _populate_qa_plots_subtask_template(): - subtask_template_data = {"type": SubtaskType.objects.get(value=SubtaskType.Choices.QA_PLOTS.value), - "name": "QA plots", - "description": 'QA plots subtask template', - "version": '0.1', - "schema": json.loads(''' -{ - "$id": "http://example.com/example.json", - "type": "object", - "$schema": "http://json-schema.org/draft-06/schema#", - "definitions": {}, - "additionalProperties": false, - "properties": { - "autocorrelation": { - "type": "boolean", - "title": "autocorrelation", - "default": true, - "description": "Create autocorrelation plots for all stations" - }, - "crosscorrelation": { - "type": "boolean", - "title": "crosscorrelation", - "default": true, - "description": "Create crosscorrelation plots for all baselines" - } - } -}'''), - "realtime": False, - "queue": True, - "tags": []} +def _populate_qa_plots_subtask_template(): + with open(os.path.join(working_dir, "schemas/subtask-qa-plots.json")) as json_file: + json_data = json.loads(json_file.read()) + subtask_template_data = {"type": SubtaskType.objects.get(value=SubtaskType.Choices.QA_PLOTS.value), + "name": "QA plots", + "description": 'QA plots subtask template', + "version": '0.1', + "realtime": False, + "queue": True, + "tags": [], + "schema": json_data} SubtaskTemplate.objects.create(**subtask_template_data) @@ -739,201 +335,22 @@ def _populate_preprocessing_schema(): def _populate_pipelinecontrol_schema(): - subtask_template_data = {"type": SubtaskType.objects.get(value='pipeline'), - "name": "pipelinecontrol schema", - "description": 'pipelinecontrol schema for pipeline subtask', - "version": '0.1', - "schema": json.loads(''' -{ - "$id": "http://example.com/example.json", - "type": "object", - "$schema": "http://json-schema.org/draft-06/schema#", - "additionalProperties": false, - "properties": { - "preflagger0": { - "title": "Preflagger0", - "description": "Flag channels", - "type": "object", - "additionalProperties": false, - "properties": { - "channels": { - "title": "Channels", - "type": "string", - "default": "0..nchan/32-1,31*nchan/32..nchan-1" - } - }, - "required": [ - "channels" - ], - "default": {} - }, - "preflagger1": { - "title": "Preflagger1", - "description": "Flag correlations", - "type": "object", - "additionalProperties": false, - "properties": { - "corrtype": { - "title": "Correlations", - "type": "string", - "default": "auto", - "enum": [ - "", - "auto", - "cross" - ] - } - }, - "required": [ - "corrtype" - ], - "default": {} - }, - "aoflagger": { - "title": "AOFlagger", - "description": "Flag RFI", - "type": "object", - "additionalProperties": false, - "properties": { - "strategy": { - "title": "Strategy", - "type": "string", - "default": "HBAdefault", - "enum": [ - "HBAdefault", - "LBAdefault" - ] - } - }, - "required": [ - "strategy" - ], - "default": {} - }, - "demixer": { - "title": "Demixer & Averager", - "description": "Demix sources & average data", - "type": "object", - "additionalProperties": false, - "properties": { - "baselines": { - "title": "Baselines", - "type": "string", - "default": "CS*,RS*&" - }, - "frequency_steps": { - "type": "integer", - "title": "Frequency steps (average)", - "default": 4, - "minimum": 1 - }, - "time_steps": { - "type": "integer", - "title": "Time steps (average)", - "default": 1, - "minimum": 1 - }, - "demix_frequency_steps": { - "type": "integer", - "title": "Frequency steps (demix)", - "default": 4, - "minimum": 1 - }, - "demix_time_steps": { - "type": "integer", - "title": "Time steps (demix)", - "default": 1, - "minimum": 1 - }, - "ignore_target": { - "type": "boolean", - "title": "Ignore target", - "default": false - }, - "demix_always": { - "type": "array", - "title": "Demix always", - "default": [], - "uniqueItems": true, - "items": { - "type": "string", - "enum": [ - "CasA", - "CygA", - "HerA", - "HydraA", - "TauA", - "VirA" - ] - } - }, - "demix_if_needed": { - "type": "array", - "title": "Demix if needed", - "default": [], - "uniqueItems": true, - "items": { - "type": "string", - "enum": [ - "CasA", - "CygA", - "HerA", - "HydraA", - "TauA", - "VirA" - ] - } - } - }, - "required": [ - "baselines", - "frequency_steps", - "time_steps", - "demix_frequency_steps", - "demix_time_steps", - "ignore_target", - "demix_always", - "demix_if_needed" - ], - "default": {} - }, - "storagemanager": { - "type": "string", - "title": "Storage Manager", - "default": "dysco", - "enum": [ - "standard", - "dysco" - ] - } - }, - "required": [ - "storagemanager" - ] -} -'''), - "realtime": True, - "queue": False, - "tags": []} - + with open(os.path.join(working_dir, "schemas/subtask-pipeline-control.json")) as json_file: + json_data = json.loads(json_file.read()) + subtask_template_data = {"type": SubtaskType.objects.get(value='pipeline'), + "name": "pipelinecontrol schema", + "description": 'pipelinecontrol schema for pipeline subtask', + "version": '0.1', + "realtime": True, + "queue": False, + "tags": [], + "schema": json_data} SubtaskTemplate.objects.create(**subtask_template_data) - def _populate_connectors(): # the TaskConnectorType's define how the Task[Draft/Blueprint] *can* be connected. # TODO Need overview which we do actually need - # correlator schema will be removed so the first two taskconnectortypes too - # TaskConnectorType.objects.create(role=Role.objects.get(value=Role.Choices.CALIBRATOR.value), - # datatype=Datatype.objects.get(value=Datatype.Choices.VISIBILITIES.value), - # output_of=TaskTemplate.objects.get(name='correlator schema'), - # input_of=TaskTemplate.objects.get(name='preprocessing schema')) - # - # TaskConnectorType.objects.create(role=Role.objects.get(value=Role.Choices.TARGET.value), - # datatype=Datatype.objects.get(value=Datatype.Choices.VISIBILITIES.value), - # output_of=TaskTemplate.objects.get(name='correlator schema'), - # input_of=TaskTemplate.objects.get(name='preprocessing schema')) - TaskConnectorType.objects.create(role=Role.objects.get(value=Role.Choices.INPUT.value), datatype=Datatype.objects.get(value=Datatype.Choices.VISIBILITIES.value), output_of=TaskTemplate.objects.get(name='observation schema'), diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/CMakeLists.txt b/SAS/TMSS/src/tmss/tmssapp/schemas/CMakeLists.txt index f0afa83fb26ffb7c64b14badad130086e54952c6..4fb2a448999fb6ad5988477c7ac5de4c037fd5f9 100644 --- a/SAS/TMSS/src/tmss/tmssapp/schemas/CMakeLists.txt +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/CMakeLists.txt @@ -8,6 +8,12 @@ set(_json_schema_files task-stations.json task-correlator.json task-preprocessing.json + task-relation-sap.json + subtask-observation-control.json + subtask-pipeline-control.json + subtask-qa-files.json + subtask-qa-plots.json + empty-schema.json ) python_install(${_json_schema_files} diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/empty-schema.json b/SAS/TMSS/src/tmss/tmssapp/schemas/empty-schema.json new file mode 100644 index 0000000000000000000000000000000000000000..68b2c85fdb23fc17e374619884793e9290d39321 --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/empty-schema.json @@ -0,0 +1,8 @@ +{ + "$id": "http://example.com/example.json", + "type": "object", + "$schema": "http://json-schema.org/draft-06/schema#", + "definitions": {}, + "additionalProperties": false, + "properties": {} +} \ No newline at end of file diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/scheduling-unit.json b/SAS/TMSS/src/tmss/tmssapp/schemas/scheduling-unit.json index 6dd56baffaa1a6796d3ae8c11eee7cb2f8698eb1..ee006e603ecb695ed3d87e9c10a49929c3b4599b 100644 --- a/SAS/TMSS/src/tmss/tmssapp/schemas/scheduling-unit.json +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/scheduling-unit.json @@ -1,7 +1,7 @@ { "$id": "http://example.com/example.json", "type": "object", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft-06/schema#", "additionalProperties": false, "definitions": { "task_connector": { diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-observation-control.json b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-observation-control.json new file mode 100644 index 0000000000000000000000000000000000000000..b225aab1d3104443231952f98859e2b557add3b2 --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-observation-control.json @@ -0,0 +1,316 @@ +{ + "$id": "http://example.com/example.json", + "type": "object", + "$schema": "http://json-schema.org/draft-06/schema#", + "definitions": { + "pointing": { + "type": "object", + "additionalProperties": false, + "properties": { + "direction_type": { + "type": "string", + "title": "Reference frame", + "description": "", + "default": "J2000", + "enum": [ + "J2000", + "SUN", + "MOON", + "MERCURY", + "VENUS", + "MARS", + "JUPITER", + "SATURN", + "URANUS", + "NEPTUNE", + "PLUTO" + ] + }, + "angle1": { + "type": "number", + "title": "Angle 1", + "description": "First angle (f.e. RA)", + "default": 0 + }, + "angle2": { + "type": "number", + "title": "Angle 2", + "description": "Second angle (f.e. DEC)", + "default": 0 + } + } + } + }, + "additionalProperties": false, + "properties": { + "stations": { + "type": "object", + "default": {}, + "properties": { + "station_list": { + "title": "Station list", + "type": "array", + "additionalItems": false, + "additionalProperties": false, + "default": ["CS001"], + "items": { + "type": "string", + "enum": [ + "CS001", + "CS002", + "CS003", + "CS004", + "CS005", + "CS006", + "CS007", + "CS011", + "CS013", + "CS017", + "CS021", + "CS024", + "CS026", + "CS028", + "CS030", + "CS031", + "CS032", + "CS101", + "CS103", + "CS201", + "CS301", + "CS302", + "CS401", + "CS501", + "RS106", + "RS205", + "RS208", + "RS210", + "RS305", + "RS306", + "RS307", + "RS310", + "RS406", + "RS407", + "RS409", + "RS503", + "RS508", + "RS509", + "DE601", + "DE602", + "DE603", + "DE604", + "DE605", + "FR606", + "SE607", + "UK608", + "DE609", + "PL610", + "PL611", + "PL612", + "IE613", + "LV614" + ], + "title": "Station", + "description": "" + }, + "minItems": 1, + "uniqueItems": true + }, + "antenna_set": { + "type": "string", + "title": "Antenna set", + "description": "Which antennas & fields to use on each station", + "default": "HBA_DUAL", + "enum": [ + "HBA_DUAL", + "HBA_DUAL_INNER", + "HBA_ONE", + "HBA_ONE_INNER", + "HBA_ZERO", + "HBA_ZERO_INNER", + "LBA_INNER", + "LBA_OUTER", + "LBA_SPARSE_EVEN", + "LBA_SPARSE_ODD", + "LBA_ALL" + ] + }, + "filter": { + "type": "string", + "title": "Band-pass filter", + "description": "Must match antenna type", + "default": "HBA_110_190", + "enum": [ + "LBA_10_90", + "LBA_30_90", + "HBA_110_190", + "HBA_210_250" + ] + }, + "analog_pointing": { + "title": "Analog pointing", + "description": "HBA only", + "$ref": "#/definitions/pointing", + "default": {} + }, + "digital_pointings": { + "type": "array", + "title": "Beams", + "additionalItems": false, + "default": [{}], + "items": { + "title": "Beam", + "headerTemplate": "{{ i0 }} - {{ self.name }}", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "title": "Name/target", + "description": "Custom identifier for this beam. Same name is same beam.", + "default": "" + }, + "pointing": { + "title": "Digital pointing", + "$ref": "#/definitions/pointing", + "default": {} + }, + "subbands": { + "type": "array", + "title": "Subband list", + "additionalItems": false, + "default": [], + "items": { + "type": "integer", + "title": "Subband", + "minimum": 0, + "maximum": 511 + } + } + } + } + } + } + }, + "COBALT": { + "type": "object", + "title": "COBALT correlator/beamformer", + "additionalProperties": false, + "default": {}, + "properties": { + "blocksize": { + "type": "integer", + "title": "Block size (samples)", + "description": "Size of blocks COBALT works on, must be a multiple of all processing requirements", + "default": 196608, + "minimum": 97656, + "maximum": 292968 + }, + "delay_compensation": { + "type": "boolean", + "title": "Apply delay compensation", + "description": "Compensate for geometric and clock differences", + "default": true + }, + "bandpass_correction": { + "type": "boolean", + "title": "Apply band-pass correction", + "description": "Compensate for differences in station sensitivity within a subband", + "default": true + }, + "correlator": { + "title": "Correlator", + "type": "object", + "default": {}, + "oneOf": [ + { + "type": "object", + "title": "Enabled", + "additionalProperties": false, + "default": {}, + "properties": { + "enabled": { + "type": "boolean", + "title": "Enabled", + "description": "", + "default": true, + "options": { + "hidden": true + }, + "enum": [ + true + ] + }, + "channels_per_subband": { + "type": "integer", + "title": "Channels/subband", + "description": "Number of frequency bands per subband", + "default": 64, + "minimum": 1, + "enum": [ + 1, + 8, + 16, + 32, + 64, + 128, + 256, + 512, + 1024 + ] + }, + "blocks_per_integration": { + "type": "integer", + "title": "Blocks per integration", + "description": "Number of blocks to integrate", + "default": 1, + "minimum": 1 + }, + "integrations_per_block": { + "type": "integer", + "title": "Integrations per block", + "description": "Number of integrations to fit within each block", + "default": 1, + "minimum": 1 + }, + "phase_centers": { + "type": "array", + "title": "Custom phase centers", + "additionalItems": false, + "default": [{}], + "items": { + "title": "Beam", + "headerTemplate": "Beam {{ self.index }}", + "type": "object", + "additionalProperties": false, + "default": {}, + "properties": { + "index": { + "type": "integer", + "title": "Station beam index", + "description": "Apply to this station beam", + "minimum": 0, + "default": 0 + }, + "pointing": { + "title": "Correlator pointing", + "$ref": "#/definitions/pointing", + "default": {} + } + } + } + } + } + }, + { + "type": "object", + "title": "Disabled", + "additionalProperties": false, + "default": {}, + "properties": {} + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-pipeline-control.json b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-pipeline-control.json new file mode 100644 index 0000000000000000000000000000000000000000..f49c523fe5b217029da32dddde280dca384b31ca --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-pipeline-control.json @@ -0,0 +1,167 @@ +{ + "$id": "http://example.com/example.json", + "type": "object", + "$schema": "http://json-schema.org/draft-06/schema#", + "additionalProperties": false, + "properties": { + "preflagger0": { + "title": "Preflagger0", + "description": "Flag channels", + "type": "object", + "additionalProperties": false, + "properties": { + "channels": { + "title": "Channels", + "type": "string", + "default": "0..nchan/32-1,31*nchan/32..nchan-1" + } + }, + "required": [ + "channels" + ], + "default": {} + }, + "preflagger1": { + "title": "Preflagger1", + "description": "Flag correlations", + "type": "object", + "additionalProperties": false, + "properties": { + "corrtype": { + "title": "Correlations", + "type": "string", + "default": "auto", + "enum": [ + "", + "auto", + "cross" + ] + } + }, + "required": [ + "corrtype" + ], + "default": {} + }, + "aoflagger": { + "title": "AOFlagger", + "description": "Flag RFI", + "type": "object", + "additionalProperties": false, + "properties": { + "strategy": { + "title": "Strategy", + "type": "string", + "default": "HBAdefault", + "enum": [ + "HBAdefault", + "LBAdefault" + ] + } + }, + "required": [ + "strategy" + ], + "default": {} + }, + "demixer": { + "title": "Demixer & Averager", + "description": "Demix sources & average data", + "type": "object", + "additionalProperties": false, + "properties": { + "baselines": { + "title": "Baselines", + "type": "string", + "default": "CS*,RS*&" + }, + "frequency_steps": { + "type": "integer", + "title": "Frequency steps (average)", + "default": 4, + "minimum": 1 + }, + "time_steps": { + "type": "integer", + "title": "Time steps (average)", + "default": 1, + "minimum": 1 + }, + "demix_frequency_steps": { + "type": "integer", + "title": "Frequency steps (demix)", + "default": 4, + "minimum": 1 + }, + "demix_time_steps": { + "type": "integer", + "title": "Time steps (demix)", + "default": 1, + "minimum": 1 + }, + "ignore_target": { + "type": "boolean", + "title": "Ignore target", + "default": false + }, + "demix_always": { + "type": "array", + "title": "Demix always", + "default": [], + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "CasA", + "CygA", + "HerA", + "HydraA", + "TauA", + "VirA" + ] + } + }, + "demix_if_needed": { + "type": "array", + "title": "Demix if needed", + "default": [], + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "CasA", + "CygA", + "HerA", + "HydraA", + "TauA", + "VirA" + ] + } + } + }, + "required": [ + "baselines", + "frequency_steps", + "time_steps", + "demix_frequency_steps", + "demix_time_steps", + "ignore_target", + "demix_always", + "demix_if_needed" + ], + "default": {} + }, + "storagemanager": { + "type": "string", + "title": "Storage Manager", + "default": "dysco", + "enum": [ + "standard", + "dysco" + ] + } + }, + "required": [ + "storagemanager" + ] +} diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-files.json b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-files.json new file mode 100644 index 0000000000000000000000000000000000000000..905f0a9285b65d721c8a8f243ee1b0a479b3475b --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-files.json @@ -0,0 +1,22 @@ +{ + "$id": "http://example.com/example.json", + "type": "object", + "$schema": "http://json-schema.org/draft-06/schema#", + "definitions": {}, + "additionalProperties": false, + "properties": { + "nr_of_subbands": { + "type": "integer", + "title": "#subbands", + "default": -1, + "description": "Keep this number of subbands from the observation in the QA file, or all if -1" + }, + "nr_of_timestamps": { + "type": "integer", + "title": "#timestamps", + "default": 256, + "minimum": 1, + "description": "Extract this number of timestamps from the observation in the QA file (equidistantanly sampled, no averaging/interpolation)" + } + } +} \ No newline at end of file diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-plots.json b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-plots.json new file mode 100644 index 0000000000000000000000000000000000000000..461305537ec18d3c123c94a2573a0dedfbeb47a8 --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/subtask-qa-plots.json @@ -0,0 +1,21 @@ +{ + "$id": "http://example.com/example.json", + "type": "object", + "$schema": "http://json-schema.org/draft-06/schema#", + "definitions": {}, + "additionalProperties": false, + "properties": { + "autocorrelation": { + "type": "boolean", + "title": "autocorrelation", + "default": true, + "description": "Create autocorrelation plots for all stations" + }, + "crosscorrelation": { + "type": "boolean", + "title": "crosscorrelation", + "default": true, + "description": "Create crosscorrelation plots for all baselines" + } + } +} \ No newline at end of file diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/task-calibrator-addon.json b/SAS/TMSS/src/tmss/tmssapp/schemas/task-calibrator-addon.json index 11f98660cda0aff9518ac184687f11b805f697ce..997ee4d4c86f05cb23f545547eecf2485825b433 100644 --- a/SAS/TMSS/src/tmss/tmssapp/schemas/task-calibrator-addon.json +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/task-calibrator-addon.json @@ -1,12 +1,11 @@ { "$id": "http://example.com/example.json", "type": "object", - "$schema": "http://json-schema.org/draft-07/schema#", + "$schema": "http://json-schema.org/draft-06/schema#", "definitions": { "pointing": { "type": "object", "additionalProperties": false, - "format": "grid", "properties": { "direction_type": { "type": "string", @@ -54,7 +53,6 @@ ] } }, - "format": "grid", "additionalProperties": false, "properties": { "duration": { @@ -66,7 +64,6 @@ }, "autoselect": { "type": "boolean", - "format": "checkbox", "title": "Auto-select", "description": "Auto-select calibrator based on elevation", "default": true diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/task-observation-with-stations.json b/SAS/TMSS/src/tmss/tmssapp/schemas/task-observation-with-stations.json index 327e61b41a51624493cbc27b9d9e1b4ab5e45dbd..d1e1fd20c1eec0d688d6d54e81fcf42ca8406b02 100644 --- a/SAS/TMSS/src/tmss/tmssapp/schemas/task-observation-with-stations.json +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/task-observation-with-stations.json @@ -6,7 +6,6 @@ "pointing": { "type": "object", "additionalProperties": false, - "format": "grid", "properties": { "direction_type": { "type": "string", @@ -54,7 +53,6 @@ ] } }, - "format": "grid", "additionalProperties": false, "properties": { "stations": { @@ -64,7 +62,6 @@ { "type": "array", "title": "Fixed list", - "format": "grid", "additionalItems": false, "additionalProperties": false, "default": ["CS001"], @@ -136,11 +133,9 @@ "title": "Dynamic list", "type": "array", "default": [{}], - "format": "tabs", "additionalItems": false, "items": { "type": "object", - "format": "grid", "title": "Station set", "headerTemplate": "{{ self.group }}", "additionalProperties": false, @@ -217,7 +212,6 @@ "type": "array", "title": "SAPs", "description": "Station beams", - "format": "tabs", "additionalItems": false, "default": [{}], "items": { @@ -241,7 +235,6 @@ "subbands": { "type": "array", "title": "Subband list", - "format": "table", "additionalItems": false, "default": [], "items": { diff --git a/SAS/TMSS/src/tmss/tmssapp/schemas/task-relation-sap.json b/SAS/TMSS/src/tmss/tmssapp/schemas/task-relation-sap.json new file mode 100644 index 0000000000000000000000000000000000000000..5a3fcd971304b297f152dc42d98780ff586b875e --- /dev/null +++ b/SAS/TMSS/src/tmss/tmssapp/schemas/task-relation-sap.json @@ -0,0 +1,21 @@ +{ + "$id": "http://example.com/example.json", + "$schema": "http://json-schema.org/draft-06/schema#", + "additionalProperties": false, + "definitions": {}, + "properties": { + "sap": { + "type": "array", + "title": "sap list", + "additionalItems": false, + "default": [], + "items": { + "type": "integer", + "title": "sap", + "minimum": 0, + "maximum": 1 + } + } + }, + "type": "object" +} \ No newline at end of file diff --git a/SAS/TMSS/src/tmss/tmssapp/tasks.py b/SAS/TMSS/src/tmss/tmssapp/tasks.py index 321be1b571302d13b8bd521edfe2e9e59b6b6aa5..2da600a24184f98c8158ee97768f0825e62c319c 100644 --- a/SAS/TMSS/src/tmss/tmssapp/tasks.py +++ b/SAS/TMSS/src/tmss/tmssapp/tasks.py @@ -103,7 +103,7 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model Create a task_blueprint from the task_draft :raises Exception if instantiate fails. """ - logger.debug("create_task_blueprint_from_task_draft(task_draft.id=%s)", task_draft.pk) + logger.debug("Create Task Blueprint from Task Draft (id=%s)", task_draft.pk) # get or create a scheduling_unit_blueprint from the scheduling_unit_draft scheduling_unit_blueprint = task_draft.scheduling_unit_draft.scheduling_unit_blueprints.last() @@ -122,7 +122,7 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model specifications_template=task_draft.specifications_template ) - logger.info("create_task_blueprint_from_task_draft(task_draft.id=%s) created task_blueprint id=%s", task_draft.pk, task_blueprint.pk) + logger.info("Task Blueprint (id=%s) created from Task Draft (id=%s) created task_blueprint id=%s", task_blueprint.pk, task_draft.pk) # now that we have a task_blueprint, its time to refresh the task_draft so we get the non-cached fields task_draft.refresh_from_db() @@ -149,9 +149,8 @@ def create_task_blueprint_from_task_draft(task_draft: models.TaskDraft) -> model selection_doc=task_relation_draft.selection_doc, selection_template=task_relation_draft.selection_template, dataformat=task_relation_draft.dataformat) - logger.info("create_task_blueprint_from_task_draft(task_draft.id=%s) connected task_blueprint id=%s to task_blueprint id=%s via task_relation_blueprint id=%s", - task_draft.pk, task_blueprint.pk, producing_task_blueprint.pk, task_relation_blueprint.pk) - + logger.info("Task Blueprint (id=%s) connected to Task Blueprint (id=%s) via Task Relation Blueprint (id=%s)", + task_blueprint.pk, producing_task_blueprint.pk, task_relation_blueprint.pk) return task_blueprint diff --git a/SAS/TMSS/src/tmss/tmssapp/viewsets/specification.py b/SAS/TMSS/src/tmss/tmssapp/viewsets/specification.py index cae84a388cef246802e172d8d3d5d89bc1defb31..dd6345ddb9436664dc9e2faa295924d809674a8e 100644 --- a/SAS/TMSS/src/tmss/tmssapp/viewsets/specification.py +++ b/SAS/TMSS/src/tmss/tmssapp/viewsets/specification.py @@ -409,7 +409,7 @@ class TaskBlueprintViewSet(LOFARViewSet): queryset = models.TaskBlueprint.objects.all() serializer_class = serializers.TaskBlueprintSerializer - @swagger_auto_schema(responses={201: "This TaskBlueprint, with its created subtasks", + @swagger_auto_schema(responses={201: "This TaskBlueprint, with it is created subtasks", 403: 'forbidden'}, operation_description="Create subtasks.") @action(methods=['get'], detail=True, url_name="create_subtasks", name="Create Subtasks") diff --git a/SAS/TMSS/test/CMakeLists.txt b/SAS/TMSS/test/CMakeLists.txt index 97bfd914fb79bfb4cacbb594a9926355b607120a..fed919cff07977327addec9f2aeca6a243665c0a 100644 --- a/SAS/TMSS/test/CMakeLists.txt +++ b/SAS/TMSS/test/CMakeLists.txt @@ -17,7 +17,7 @@ if(BUILD_TESTING) tmss_test_environment_unittest_setup.py tmss_test_data_django_models.py tmss_test_data_rest.py - testdata/example_CTC_scheduling_block.json + testdata/example_UC1_scheduling_unit.json DESTINATION lofar/sas/tmss/test) lofar_add_test(t_tmss_test_database) diff --git a/SAS/TMSS/test/t_tasks.py b/SAS/TMSS/test/t_tasks.py index 2ccdb67ac3151d0246737997f85083610252665e..5005382e6c831e41cbd0f90d9c48afc99cce33de 100755 --- a/SAS/TMSS/test/t_tasks.py +++ b/SAS/TMSS/test/t_tasks.py @@ -94,7 +94,7 @@ class CreationFromSchedulingUnitDraft(unittest.TestCase): Check with REST-call if tasks are created """ working_dir = os.path.dirname(os.path.abspath(__file__)) - with open(os.path.join(working_dir, "testdata/example_CTC_scheduling_block.json")) as json_file: + with open(os.path.join(working_dir, "testdata/example_UC1_scheduling_unit.json")) as json_file: json_requirements_doc = json.loads(json_file.read()) scheduling_unit_draft = models.SchedulingUnitDraft.objects.create( diff --git a/SAS/TMSS/test/testdata/example_CTC_scheduling_block.json b/SAS/TMSS/test/testdata/example_UC1_scheduling_unit.json similarity index 99% rename from SAS/TMSS/test/testdata/example_CTC_scheduling_block.json rename to SAS/TMSS/test/testdata/example_UC1_scheduling_unit.json index da73abe4956f34cf2f317088e4434b447917402f..28b908235b5c6600ce359ccc3dcef72f5af4f505 100644 --- a/SAS/TMSS/test/testdata/example_CTC_scheduling_block.json +++ b/SAS/TMSS/test/testdata/example_UC1_scheduling_unit.json @@ -2,7 +2,7 @@ "tasks": [ { "name": "Calibrator Observation 1", - "description": "Calibrator Observation for UC1 HBA scheduling block", + "description": "Calibrator Observation for UC1 HBA scheduling unit", "tags": [], "specifications_doc": { "duration": 600, @@ -42,7 +42,7 @@ }, { "name": "Target Observation", - "description": "Target Observation for UC1 HBA scheduling block", + "description": "Target Observation for UC1 HBA scheduling unit", "tags": [], "specifications_doc": { "QA": { @@ -145,7 +145,7 @@ }, { "name": "Calibrator Observation 2", - "description": "Calibrator Observation for UC1 HBA scheduling block", + "description": "Calibrator Observation for UC1 HBA scheduling unit", "tags": [], "specifications_doc": { "duration": 600,