Forward Models (taurex.model)¶
Base¶
Class for forward spectral modeling.
- class ForwardModel(name: str)[source]¶
Bases:
Loggable,Fittable,Writeable,CitableA base class for producing forward models.
- citations() List[str][source]¶
Citations for forward model.
Will either return a list of string or a list of
Citationobjects ifpybtexis installed.
- compute_error(samples: Callable[[], float], wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, binner: Binner | None = None) Tuple[Dict[str, ndarray[tuple[int, ...], dtype[float64]]], Dict[str, ndarray[tuple[int, ...], dtype[float64]]]][source]¶
Error of the model and its components given a sample function.
- property derivedParameters: Dict[str, Tuple[str, str, Callable[[], float], bool]]¶
Returns a dictionary of derived parameters
- property fittingParameters: Dict[str, Tuple[str, str, Callable[[], float], Callable[[float], None], Literal['linear', 'log'], bool, Tuple[float, float]]]¶
Returns a dictionary of fitting parameters
- generate_profiles() Dict[str, ndarray[tuple[int, ...], dtype[float64]]][source]¶
Generate profiles to store.
Must return a dictionary of profiles you want to store after modeling
- model(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]] | None, Dict | T | None][source]¶
Computes the forward model for a wngrid
- model_contrib(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], Dict[str, Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], Any | None]]][source]¶
Computes the forward model for a wngrid with each contribution.
- model_full_contrib(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], Dict[str, List[Tuple[str, ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], Any | None]]]][source]¶
Computes the forward model for a wngrid for each contribution
Considers each contribution has subcomponents as well.
- write(output: OutputGroup) OutputGroup[source]¶
Write forward model to output group.
Basic Model¶
Basic forward model.
- class OneDForwardModel(name: str, planet: Planet | None = None, star: Star | None = None, pressure_profile: PressureProfile | None = None, temperature_profile: TemperatureProfile | None = None, chemistry: Chemistry | None = None, nlayers: int | None = 100, atm_min_pressure: float | None = 0.0001, atm_max_pressure: float | None = 1000000.0, contributions: List[object] | None = None)[source]¶
Bases:
SimpleForwardModelA forward model for a 1D atmosphere.
- Automatically sets up the following profiles:
Temperature
Pressure
Chemistry
Planet
Star
Contributions
- Must implement the following methods:
path_integral()Main integration function that must
return the absorption and optical depth for the given wngrid.
- class SimpleForwardModel(name: str, planet: Planet | None = None, star: Star | None = None, pressure_profile: PressureProfile | None = None, temperature_profile: TemperatureProfile | None = None, chemistry: Chemistry | None = None, nlayers: int | None = 100, atm_min_pressure: float | None = 0.0001, atm_max_pressure: float | None = 1000000.0, contributions: List[object] | None = None)[source]¶
Bases:
ForwardModelA ‘simple’ 1D base model.
It in the sense that its just a fairly standard single profiles model. It will handle settingup and initializing, building collecting parameters from given profiles for you. The only method that requires implementation is:
- WARN = True¶
- property altitudeProfile: ndarray[tuple[int, ...], dtype[float64]]¶
Atmospheric altitude profile in m.
- build() None[source]¶
Build the forward model.
Must be called at least once before running
model()Will automatically be called by
model()if not called before.
- compute_error(samples: Callable[[], float], wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, binner: Binner | None = None) Tuple[Dict[str, ndarray[tuple[int, ...], dtype[float64]]], Dict[str, ndarray[tuple[int, ...], dtype[float64]]]][source]¶
Computes standard deviations from samples.
- Parameters:
samples – A callable function that returns a weight for each sample
wngrid – Wavenumber grid, default is to use native grid
binner – A
Binnerobject to bin the spectrum
- property densityProfile: ndarray[tuple[int, ...], dtype[float64]]¶
Atmospheric density profile in m-3.
- model(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]] | None, Dict | T | None][source]¶
Runs the forward model.
- Parameters:
wngrid – Wavenumber grid, default is to use native grid
cutoff_grid – Run model only on
wngridgiven, default isTrue
- Returns:
native_grid – Native wavenumber grid, clipped if
wngridpasseddepth – Resulting depth
tau – Optical depth.
extra (
None) – Empty
- model_contrib(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], Dict[str, Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], Any | None]]][source]¶
Models each contribution seperately.
- model_full_contrib(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], Dict[str, List[Tuple[str, ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], Any | None]]]][source]¶
Model each sub-component of each contribution.
Like
model_contrib()except all components for each contribution are modellede.g. Absorption will be modelled seperately for each molecule in the atmosphere.
- property nLayers: int¶
Number of layers.
- property nativeWavenumberGrid: ndarray[tuple[int, ...], dtype[float64]]¶
Best grid for given cross-sections.
Searches through active molecules to determine the native wavenumber grid
- Returns:
wngrid – Native grid
- Return type:
array- Raises:
InvalidModelException – If no active molecules in atmosphere
- path_integral(wngrid: ndarray[tuple[int, ...], dtype[float64]], return_contrib: bool | None) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Main integration function.
Must return the absorption and optical depth for the given wngrid.
- property planet: Planet¶
Planet model.
- property pressure: PressureProfile¶
Pressure model.
- property pressureProfile: ndarray[tuple[int, ...], dtype[float64]]¶
Central atmospheric pressure profile in Pa.
- set_native_grid(spectral_grid: Quantity | ndarray[tuple[int, ...], dtype[float64]]) None[source]¶
Sets the native grid.
- Parameters:
wngrid – Wavenumber grid
- property temperature: TemperatureProfile¶
Temperature model.
- property temperatureProfile: ndarray[tuple[int, ...], dtype[float64]]¶
Atmospheric temperature profile in K.
- write(output: OutputGroup) OutputGroup[source]¶
Write forward model to output group.
Will also write all components to the output group.
Transmission¶
Transit forward model.
- class TransmissionModel(planet: Planet | None = None, star: Star | None = None, pressure_profile: PressureProfile | None = None, temperature_profile: TemperatureProfile | None = None, chemistry: Chemistry | None = None, nlayers: int | None = 100, atm_min_pressure: float | None = 0.0001, atm_max_pressure: float | None = 1000000.0, contributions: List[object] | None = None, new_path_method: bool | None = False)[source]¶
Bases:
OneDForwardModelA forward model for transits.
- compute_absorption(tau: ndarray[tuple[int, ...], dtype[float64]], dz: ndarray[tuple[int, ...], dtype[float64]]) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Compute final absorption and optical depth.
- compute_path_length() List[ndarray[tuple[int, ...], dtype[float64]]][source]¶
Compute path length for each layer, new method.
- compute_path_length_old(dz: ndarray[tuple[int, ...], dtype[float64]]) List[ndarray[tuple[int, ...], dtype[float64]]][source]¶
Compute path length for each layer.
- path_integral(wngrid: ndarray[tuple[int, ...], dtype[float64]], return_contrib: bool | None = False) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Compute path integral.
Calculates the absorption and optical depth for each layer assuming hemispherical geometry.
Emission¶
Radiative transfer modeeling of eclipses.
- class EmissionModel(planet: Planet | None = None, star: Star | None = None, pressure_profile: PressureProfile | None = None, temperature_profile: TemperatureProfile | None = None, chemistry: Chemistry | None = None, nlayers: int | None = 100, atm_min_pressure: float | None = 0.0001, atm_max_pressure: float | None = 1000000.0, contributions: List[object] | None = None, ngauss: int | None = 4)[source]¶
Bases:
OneDForwardModelA forward model for eclipses.
- property albedoterm: float¶
Albedo term.
- compute_final_flux(f_total: ndarray[tuple[int, ...], dtype[float64]]) ndarray[tuple[int, ...], dtype[float64]][source]¶
Compute final flux value.
For emission this converts the flux emitted to:
\[F = \frac{F_{total}}{\F_{star}} \left(\frac{R_{planet}}{R_{star}}\right)^2\]- Parameters:
f_total (np.ndarray) – Flux emitted by the planet
- evaluate_emission(wngrid: ndarray[tuple[int, ...], dtype[float64]], return_contrib: bool) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Evaluate emission flux on quadratures.
- evaluate_emission_ktables(wngrid: ndarray[tuple[int, ...], dtype[float64]], return_contrib: bool) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Evaluate emission flux on quadratures using ktables.
- property logBolometricFlux: float¶
log10 Flux integrated over all wavelengths (W m-2).
- partial_model(wngrid: ndarray[tuple[int, ...], dtype[float64]] | None = None, cutoff_grid: bool | None = True) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Evaluate the flux and quandratues but do not compute the final flux.
- path_integral(wngrid: ndarray[tuple[int, ...], dtype[float64]], return_contrib: bool) Tuple[ndarray[tuple[int, ...], dtype[float64]], ndarray[tuple[int, ...], dtype[float64]]][source]¶
Evaluate emission flux and integrate quadratures for flux.
- set_num_gauss(value: int, coeffs: ndarray[tuple[int, ...], dtype[float64]] | None = None) None[source]¶
Set number of gaussian quadrature points.
- Parameters:
value (int) – Number of gaussian quadrature points
coeffs (np.ndarray, optional) – Coefficients for each gaussian quadrature point
- set_quadratures(mu: ndarray[tuple[int, ...], dtype[float64]], weight: ndarray[tuple[int, ...], dtype[float64]], coeffs: ndarray[tuple[int, ...], dtype[float64]] | None = None)[source]¶
Set quadrature points.
- Parameters:
mu (np.ndarray) – Quadrature points
weight (np.ndarray) – Quadrature weights
coeffs (np.ndarray, optional) – Coefficients for each gaussian quadrature point
- property usingKTables: bool¶
Whether ktables are being used.
- write(output: OutputGroup) OutputGroup[source]¶
Write model to output group.
- contribute_ktau_emission(start_k, end_k, density_offset, sigma, density, path, weights, ngrid, layer, ngauss)¶
Direct Image¶
Direct imaging model.
- class DirectImageModel(planet: Planet | None = None, star: Star | None = None, pressure_profile: PressureProfile | None = None, temperature_profile: TemperatureProfile | None = None, chemistry: Chemistry | None = None, nlayers: int | None = 100, atm_min_pressure: float | None = 0.0001, atm_max_pressure: float | None = 1000000.0, contributions: List[object] | None = None, ngauss: int | None = 4)[source]¶
Bases:
EmissionModelA forward model for direct imaging of exo-planets.