calibration.py API¶
bh_molecule.calibration
¶
Wavelength calibration linearity analysis and diagnostics.
Functions¶
analyze_wavelength_linearity(m: np.ndarray) -> dict
¶
Analyze wavelength linearity per fiber.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
m
|
(ndarray, shape(n_fibers, n_pixels))
|
Wavelength calibration matrix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
result |
dict with keys:
|
slopes : (n_fibers,) ndarray intercepts : (n_fibers,) ndarray r2 : (n_fibers,) ndarray rmse : (n_fibers,) ndarray |
linear_fit_residuals(m: np.ndarray, slopes: np.ndarray, intercepts: np.ndarray) -> np.ndarray
¶
Return residual array Δλ = λ - (a*x + b).
Shape: same as m (n_fibers, n_pixels).
plot_fiber_line_fits(m: np.ndarray, slopes: np.ndarray, intercepts: np.ndarray, fiber_indices: list[int] | None = None, ncols: int = 4)
¶
Plot data + linear fit for selected fibers in a grid.
If fiber_indices is None, select worst RMSE fibers.
plot_linearity_summary(slopes: np.ndarray, r2: np.ndarray, rmse: np.ndarray)
¶
Summary plots: slope vs fiber, RMSE distribution.
Wavelength calibration linearity analysis and diagnostics for multi-fiber spectrographs.