lfkit.corrections.filters module#

Filter / response mapping utilities.

LFKit uses a survey-oriented way to specify photometric bands:

(filterset, band)

Examples

(“sdss”, “r”) (“hsc”, “i”) (“decam”, “r”) (“bessell”, “V”)

Internally, kcorrect does not work with survey names. Instead it expects response curve identifiers, which correspond to filter throughput files distributed with the package.

This module provides a lightweight mapping between the LFKit public notation

(filterset, band)

and the corresponding kcorrect response names. The mapping can also be extended or overridden to support custom filter curves.

lfkit.corrections.filters.list_supported(response_map=None)[source]#

Return the set of supported bands grouped by filterset.

The output lists all (filterset, band) combinations available in the current response mapping. This is useful for inspecting which survey filters are currently recognized by LFKit.

Parameters:

response_map (dict[tuple[str, str], str] | None)

Return type:

dict[str, list[str]]

lfkit.corrections.filters.make_response_map(*, base=None, extra=None)[source]#

Create a response mapping dictionary.

The returned mapping associates (filterset, band) pairs with kcorrect response identifiers. A custom mapping can be created by starting from a base map and overriding or extending entries with the extra dictionary.

Parameters:
  • base (dict[tuple[str, str], str] | None)

  • extra (dict[tuple[str, str], str] | None)

Return type:

dict[tuple[str, str], str]

lfkit.corrections.filters.normalize_band(band)[source]#

Normalize a band label.

Band names are stripped of surrounding whitespace while preserving their case, since some filter systems distinguish between uppercase and lowercase band identifiers.

Parameters:

band (str)

Return type:

str

lfkit.corrections.filters.normalize_filterset(filterset)[source]#

Return the canonical LFKit representation of a filterset name.

Filterset names are normalized to lowercase and stripped of surrounding whitespace so that user input such as “SDSS”, “sdss”, or “ sdss “ all resolve to the same canonical form.

Parameters:

filterset (str)

Return type:

str

lfkit.corrections.filters.resolve_response_name(*, filterset, band, response_map=None)[source]#

Resolve a survey band to a kcorrect response identifier.

Given a (filterset, band) pair, this function returns the corresponding kcorrect response name used to load the filter throughput curve. A custom mapping can be provided to support additional surveys or user-defined filters.

Parameters:
  • filterset (str)

  • band (str)

  • response_map (dict[tuple[str, str], str] | None)

Return type:

str

lfkit.corrections.filters.validate_coverage(*, filterset, bands, response_map=None)[source]#

Check that a set of bands exists in the response mapping.

This function verifies that all requested bands are defined for the given filterset in the response mapping. If any band is missing, an informative error is raised listing the supported bands for that filterset.

Parameters:
  • filterset (str)

  • bands (Iterable[str])

  • response_map (dict[tuple[str, str], str] | None)

Return type:

None