uvex_transients.phase_space.sampling.core.check_detection#

uvex_transients.phase_space.sampling.core.check_detection(detection: Sequence[Mapping] | None) → tuple[dict, ...] | None[source]#

Check a definition of a detection and return it as plain types.

A definition is a list of cuts. Each entry is a mapping with the name of a cut registered on SurveySimulator as cut, and the arguments of that cut as params, as in the steps: of a run-config:

[
    {"cut": "snr", "params": {"n_visits": 2}},
    {
        "cut": "time_since_last_nondetection",
        "params": {"max_delay": 1.0},
    },
]
Parameters:

detection (sequence of Mapping or None) – The entries, applied in order, or None for the sampler’s default.

Returns:

The entries as plain dicts (params left out when empty), or None.

Return type:

tuple of dict or None

Raises:

ValueError – If detection is empty or not a list of mappings, an entry has a key other than cut and params, a cut is not registered, or a cut does not take one of its params.