diff --git a/SAS/TMSS/src/tmss/tmssapp/populate.py b/SAS/TMSS/src/tmss/tmssapp/populate.py index bd6e58cccb3b8ed7f4ccb3dcb08fc13f814a62e3..df0d905a5ead5d6cab14b640d36f322d37f5bc4d 100644 --- a/SAS/TMSS/src/tmss/tmssapp/populate.py +++ b/SAS/TMSS/src/tmss/tmssapp/populate.py @@ -31,6 +31,11 @@ def populate_choices(apps, schema_editor): def populate_lofar_json_schemas(apps, schema_editor): + _populate_correlator_schema() + _populate_obscontrol_schema() + _populate_stations_schema() + +def _populate_correlator_schema(): subtask_template_data = {"type": SubtaskType.objects.get(value='observation'), "name": "correlator schema", "description": 'first attempt at correlator schema', @@ -151,3 +156,562 @@ def populate_lofar_json_schemas(apps, schema_editor): "tags": []} SubtaskTemplate.objects.create(**subtask_template_data) + + +def _populate_obscontrol_schema(): + subtask_template_data = {"type": SubtaskType.objects.get(value='observation'), + "name": "obscontrol schema", + "description": 'first attempt at obscontrol schema', + "version": '0.1', + "schema": json.dumps(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": { + "station_list": { + "title": "Station list", + "type": "array", + "additionalItems": false, + "additionalProperties": false, + "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" + }, + "digital_pointings": { + "type": "array", + "title": "Beams", + "additionalItems": false, + "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" + }, + "subbands": { + "type": "array", + "title": "Subband list", + "additionalItems": false, + "items": { + "type": "integer", + "title": "Subband", + "minimum": 0, + "maximum": 511 + } + } + } + } + } + }, + "COBALT": { + "type": "object", + "title": "COBALT correlator/beamformer", + "additionalProperties": false, + "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", + "oneOf": [ + { + "type": "object", + "title": "Enabled", + "additionalProperties": false, + "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, + "items": { + "title": "Beam", + "headerTemplate": "Beam {{ self.index }}", + "type": "object", + "additionalProperties": false, + "properties": { + "index": { + "type": "integer", + "title": "Station beam index", + "description": "Apply to this station beam", + "minimum": 0 + }, + "pointing": { + "title": "Correlator pointing", + "$ref": "#/definitions/pointing" + } + } + } + } + } + }, + { + "type": "object", + "title": "Disabled", + "additionalProperties": false, + "properties": {} + } + ] + } + } + } + } +}''')), + "realtime": True, + "queue": False, + "tags": []} + + SubtaskTemplate.objects.create(**subtask_template_data) + + + +def _populate_stations_schema(): + subtask_template_data = {"type": SubtaskType.objects.get(value='observation'), + "name": "stations schema", + "description": 'first attempt at stations schema', + "version": '0.1', + "schema": json.dumps(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": { + "title": "Station list", + "oneOf": [ + { + "type": "array", + "title": "Fixed list", + "additionalItems": false, + "additionalProperties": false, + "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", + "RS104", + "RS106", + "RS205", + "RS208", + "RS210", + "RS305", + "RS306", + "RS307", + "RS310", + "RS406", + "RS407", + "RS409", + "RS410", + "RS503", + "RS508", + "RS509", + "DE601", + "DE602", + "DE603", + "DE604", + "DE605", + "FR606", + "SE607", + "UK608", + "DE609", + "PL610", + "PL611", + "PL612", + "IE613", + "LV614" + ], + "title": "Station", + "description": "" + }, + "minItems": 1, + "uniqueItems": true + }, + { + "title": "Dynamic list", + "type": "array", + "additionalItems": false, + "items": { + "type": "object", + "title": "Station set", + "headerTemplate": "{{ self.group }}", + "additionalProperties": false, + "properties": { + "group": { + "type": "string", + "title": "Group/station", + "description": "Which (group of) station(s) to select from", + "default": "ALL", + "enum": [ + "ALL", + "SUPERTERP", + "CORE", + "REMOTE", + "DUTCH", + "INTERNATIONAL" + ] + }, + "min_stations": { + "type": "integer", + "title": "Minimum nr of stations", + "description": "Number of stations to use within group/station", + "default": 1, + "minimum": 0 + } + } + } + } + ] + }, + "antenna_set": { + "type": "string", + "title": "Antenna set", + "description": "Fields & antennas to use", + "default": "HBA_DUAL", + "enum": [ + "HBA_DUAL", + "HBA_DUAL_INNER", + "HBA_JOINED", + "HBA_JOINED_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_70", + "LBA_30_70", + "LBA_10_90", + "LBA_30_90", + "HBA_110_190", + "HBA_210_250" + ] + }, + "analog_pointing": { + "title": "Analog pointing", + "description": "HBA only", + "$ref": "#/definitions/pointing" + }, + "beams": { + "type": "array", + "title": "Beams", + "additionalItems": false, + "items": { + "title": "Beam", + "headerTemplate": "{{ i0 }} - {{ self.name }}", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "title": "Name/target", + "description": "Identifier for this beam", + "default": "" + }, + "digital_pointing": { + "title": "Digital pointing", + "$ref": "#/definitions/pointing" + }, + "subbands": { + "type": "array", + "title": "Subband list", + "additionalItems": false, + "items": { + "type": "integer", + "title": "Subband", + "minimum": 0, + "maximum": 511 + } + } + } + } + } + } +}''')), + "realtime": True, + "queue": False, + "tags": []} + + SubtaskTemplate.objects.create(**subtask_template_data) + + + + +