Source code for ska_telmodel.sdp.common

"""Miscellaneous schemas that probably should be moved somewhere else."""
from schema import Or, Regex, Schema

from .._common import MID_MKT, MID_SKA

#: LOW core receptors, 1-224
LOW_CORE = Regex(r"^C([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-1][0-9]|22[0-4])$")
#: LOW east/north/south receptors.
LOW_DIRS = Regex(r"^[ENS]([1-9]|1[0-6])-[1-6]$")
#: LOW FS 1-512, plus optional substations.
LOW_FS = Regex(
    r"^FS([1-9]|[1-9][0-9]|[1-4][0-9][0-9]|50[0-9]|51[0-2])(\.\S+)?$"
)

#: All receptors.
ALL_RECEPTORS = Or(LOW_CORE, LOW_DIRS, LOW_FS, MID_SKA, MID_MKT)


[docs] def get_receptor_schema(strict: bool) -> Schema: """ Return schema for receptors. :param strict: check names if set :return: schema """ return ALL_RECEPTORS if strict else Schema(str)
[docs] def get_beam_function_pattern(strict: bool): """Get pattern for SDP beam functions As used for SDP configuration - i.e. basically a kind of data that the SKA SDP needs to receive. :return: A string pattern suitable for use in schemas """ if strict: return Or( "visibilities", "pulsar search", "pulsar timing", "vlbi", "transient buffer", ) else: return str