InterpolatedEffectiveAreaModel#

class optika.radiometry.InterpolatedEffectiveAreaModel(wavelength, area, axis_wavelength)[source]#

Bases: AbstractEffectiveAreaModel

An effective area model which linearly interpolates between measured calibration points.

Linear interpolation is used (rather than a polynomial fit) because the effective area of a real system has sharp features — absorption edges, filter cutoffs, and multilayer reflectivity peaks — that a polynomial would fit poorly.

Examples

Interpolate a measured effective area curve and plot the result.

import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import named_arrays as na
import optika

# A coarse set of calibration measurements
wavelength = na.linspace(100, 1000, axis="wavelength", num=10) * u.AA
area = 10 * np.exp(-(((wavelength - 500 * u.AA) / (150 * u.AA)) ** 2))
area = area * u.cm**2

model = optika.radiometry.InterpolatedEffectiveAreaModel(
    wavelength=wavelength,
    area=area,
    axis_wavelength="wavelength",
)

# Evaluate the model on a finer grid
wavelength_fit = na.linspace(100, 1000, axis="wavelength", num=201) * u.AA

fig, ax = plt.subplots(constrained_layout=True)
na.plt.scatter(wavelength, area, ax=ax, label="calibration")
na.plt.plot(wavelength_fit, model(wavelength_fit), ax=ax, label="interpolated")
ax.set_xlabel(f"wavelength ({na.unit(wavelength):latex_inline})")
ax.set_ylabel(f"effective area ({na.unit(area):latex_inline})")
ax.legend();
../_images/optika.radiometry.InterpolatedEffectiveAreaModel_0_0.png

Attributes

area

The measured effective area at each calibration point.

axis_wavelength

The logical axis corresponding to changing wavelength.

wavelength

The wavelength of each calibration point.

Methods

__init__(wavelength, area, axis_wavelength)

to_string([prefix])

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Inheritance Diagram

Inheritance diagram of optika.radiometry.InterpolatedEffectiveAreaModel
Parameters:
to_string(prefix=None)#

Public-facing version of the __repr__ method that allows for defining a prefix string, which can be used to calculate how much whitespace to add to the beginning of each line of the result.

Parameters:

prefix (None | str) – an optional string, the length of which is used to calculate how much whitespace to add to the result.

Return type:

str

area: AbstractScalar = <dataclasses._MISSING_TYPE object>#

The measured effective area at each calibration point.

axis_wavelength: str = <dataclasses._MISSING_TYPE object>#

The logical axis corresponding to changing wavelength.

wavelength: AbstractScalar = <dataclasses._MISSING_TYPE object>#

The wavelength of each calibration point.