diff --git a/.make b/.make index c1804ce36f5ce10ca011ad0ccee022fe21e5384e..c38a4d0c11b18a778c6d79ec26029fef22e85155 160000 --- a/.make +++ b/.make @@ -1 +1 @@ -Subproject commit c1804ce36f5ce10ca011ad0ccee022fe21e5384e +Subproject commit c38a4d0c11b18a778c6d79ec26029fef22e85155 diff --git a/src/ska_telmodel/sdp/examples/v1_2_dev.py b/src/ska_telmodel/sdp/examples/v1_2_dev.py new file mode 100644 index 0000000000000000000000000000000000000000..f126042c82e75b3c9986838a8dbc354181cb20ae --- /dev/null +++ b/src/ska_telmodel/sdp/examples/v1_2_dev.py @@ -0,0 +1,31 @@ +"""SDP schema 1.2 examples.""" + +import copy + +from .v1_1 import SDP_ASSIGNRES as SDP_ASSIGNRES_1_1 +from .v1_1 import ( + get_sdp_configure, + get_sdp_recvaddrs, + get_sdp_releaseres, + get_sdp_scan, +) + +__all__ = [ + "get_sdp_assignres", + "get_sdp_configure", + "get_sdp_scan", + "get_sdp_recvaddrs", + "get_sdp_releaseres", +] + +SDP_ASSIGNRES = copy.deepcopy(SDP_ASSIGNRES_1_1) +SDP_ASSIGNRES["execution_block"]["telmodel_sources"] = [ + "car:ska-low-tmdata?main" +] +SDP_ASSIGNRES["execution_block"]["scan_types"][1]["beams"]["vis0"][ + "integration_time" +] = 0.125 + + +def get_sdp_assignres(version: str): + return copy.deepcopy(SDP_ASSIGNRES) diff --git a/src/ska_telmodel/sdp/schemas/v0_4.py b/src/ska_telmodel/sdp/schemas/v0_4.py index fe7731b84a6212d932db84824ce3419cb6596967..29a14b4dd83c895e88452c2b163813467c492931 100644 --- a/src/ska_telmodel/sdp/schemas/v0_4.py +++ b/src/ska_telmodel/sdp/schemas/v0_4.py @@ -22,6 +22,7 @@ __all__ = [ "get_sdp_configure", "get_sdp_scan", "get_sdp_recvaddrs", + "get_sdp_releaseres", ] @@ -169,14 +170,27 @@ def get_execution_block(version: str, strict: bool) -> TMSchema: strict, schema={ "eb_id": get_eb_name_schema(version, strict), - "max_length": float, - Literal( - "context", - description="Free-form information from OET, see ADR-54", - ): Schema(dict), }, as_reference=True, ) + schema.add_field( + "max_length", + float, + description=cleandoc( + """ + Maximum observation length in seconds. + + Used to ensure that enough buffer capacity is available to capture + data. Resource assignment might fail if we do not have enough + space to guarantee that all data could be captured. + """ + ), + ) + schema.add_field( + "context", + dict, + description="Free-form information from OET, see ADR-54", + ) schema.add_field( "beams", [get_beam(version, strict)], description="Beam parameters" ) diff --git a/src/ska_telmodel/sdp/schemas/v1_2_dev.py b/src/ska_telmodel/sdp/schemas/v1_2_dev.py new file mode 100644 index 0000000000000000000000000000000000000000..25332997433dd7c743578483935ac0a8da5cefa7 --- /dev/null +++ b/src/ska_telmodel/sdp/schemas/v1_2_dev.py @@ -0,0 +1,90 @@ +"""Version 1.2 of SDP schema""" + +from inspect import cleandoc + +from ska_telmodel._common import TMSchema + +from . import v1_1 +from .v1_1 import ( + get_sdp_configure, + get_sdp_recvaddrs, + get_sdp_releaseres, + get_sdp_scan, +) + +__all__ = [ + "get_sdp_assignres", + "get_sdp_configure", + "get_sdp_scan", + "get_sdp_recvaddrs", + "get_sdp_releaseres", +] + + +def get_scan_type_beam(version: str, strict: bool) -> TMSchema: + schema = TMSchema.new( + "Beam", + version, + strict, + ) + schema.add_opt_field( + "field_id", + str, + description="Field ID.", + ) + schema.add_opt_field( + "channels_id", + str, + description="Channels ID.", + ) + schema.add_opt_field( + "polarisations_id", + str, + description="Polarisations ID.", + ) + schema.add_opt_field( + "integration_time", + float, + description=cleandoc( + """ + Correlator integration time in seconds. + + Applies to visibility beams only. + """ + ), + ) + return schema + + +def get_sdp_assignres(version: str, strict: bool) -> TMSchema: + # Get 1.1 version + schema = v1_1.get_sdp_assignres(version, strict) + + # Add Telescope Model data sources to EB + exec_block = schema["execution_block"] + exec_block.add_opt_field( + "telmodel_sources", + [str], + description=cleandoc( + """ + Telescope model data sources. + + Processing blocks associated with the execution block will use + this to look up information about the telescope (such as the + telescope layout) for the purpose of processing and generating + metadata. The sources should be "pinned" to specific versions to + ensure that processing results are repeatable (see `Data Sources + `_). + """ + ), + ) + + # Update beams in scan type + scan_type = schema["execution_block"]["scan_types"][0] + del scan_type["beams"] + scan_type.add_field( + "beams", + {str: get_scan_type_beam(version, strict)}, + ) + + return schema diff --git a/src/ska_telmodel/sdp/version.py b/src/ska_telmodel/sdp/version.py index 27528681983e9e3f024cd17708a3e583ee66e90a..d72315380a658b29c199d1246696f4e9af7eda22 100644 --- a/src/ska_telmodel/sdp/version.py +++ b/src/ska_telmodel/sdp/version.py @@ -18,7 +18,7 @@ SDP_INTERFACE_STABLE_VERSIONS = [ (1, 1), ] -SDP_INTERFACE_DEV_VERSIONS = [] +SDP_INTERFACE_DEV_VERSIONS = [(1, 2)] SDP_INTERFACE_VERSIONS = ( SDP_INTERFACE_STABLE_VERSIONS + SDP_INTERFACE_DEV_VERSIONS