lfkit.corrections.kcorrect_backend module#
kcorrect backend construction utilities.
This module provides a small wrapper around kcorrect.Kcorrect that
standardizes how LFKit creates and reuses backend instances.
A kcorrect backend depends on the set of input responses, output responses, and the redshift grid used internally by the solver. Constructing this object can be relatively expensive, so LFKit builds and caches instances associated with a specific response configuration.
The wrapper also ensures that requested filter response names exist before initializing the backend and allows optional use of custom response directories when supported by the installed kcorrect version.
- lfkit.corrections.kcorrect_backend.build_kcorrect(*, responses_in, responses_out=None, responses_map=None, response_dir=None, redshift_range=(0.0, 2.0), nredshift=4000, abcorrect=False)[source]#
Create a kcorrect backend configured for a specific response setup.
This function returns a
kcorrect.Kcorrectinstance configured with the requested input and output filter responses. The backend defines the template set and internal redshift grid used to evaluate k-corrections.Backend objects are cached so that repeated calls with the same configuration reuse the existing instance rather than rebuilding the solver each time. This keeps repeated k(z) evaluations fast while ensuring that the requested filter responses are validated before use.
- Parameters:
responses_in (list[str])
responses_out (list[str] | None)
responses_map (list[str] | None)
response_dir (str | Path | None)
redshift_range (tuple[float, float])
nredshift (int)
abcorrect (bool)
- Return type:
Kcorrect