lfkit.corrections.responses module#
Response / filter-curve utilities for kcorrect.
This module handles: - discovering where kcorrect response .dat files live - listing and validating available responses - writing new response .dat files in kcorrect format (for custom surveys)
- lfkit.corrections.responses.discover_response_dir_auto()[source]#
Locate the kcorrect response directory (AUTO discovery), cached.
Strategy: 1) Probe a Kcorrect instance for common directory attributes. 2) Fallback: search inside installed kcorrect package for
*.datfiles.- Returns:
Path to a directory containing
*.datresponse files.- Raises:
FileNotFoundError – If no response directory can be found.
- Return type:
Path
- lfkit.corrections.responses.kcorrect_supports_response_dir()[source]#
Return True if installed kcorrect.Kcorrect supports response_dir=…
- Return type:
bool
- lfkit.corrections.responses.list_available_responses(response_dir=None)[source]#
List available kcorrect response (filter) names.
- Parameters:
response_dir (str | Path | None)
- Return type:
list[str]
- lfkit.corrections.responses.require_responses(responses, response_dir=None)[source]#
Validate that requested response names exist in response_dir (or AUTO).
- Parameters:
responses (Iterable[str])
response_dir (str | Path | None)
- Return type:
None
- lfkit.corrections.responses.write_kcorrect_response(*, name, wave_angst, throughput, out_dir, normalize=True)[source]#
Write a kcorrect-compatible response file.
- Parameters:
name (str) – Response name (file will be {name}.dat).
wave_angst (ndarray) – Wavelength array in Å.
throughput (ndarray) – Dimensionless throughput (0..1).
out_dir (str | Path) – Output directory to write the .dat file into.
normalize (bool) – If True, normalize throughput to max=1.
- Returns:
The response name (same as input name).
- Return type:
str