ExoIris 0.20.0__tar.gz → 0.21.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exoiris-0.20.0 → exoiris-0.21.0}/CHANGELOG.md +11 -2
- {exoiris-0.20.0 → exoiris-0.21.0}/ExoIris.egg-info/PKG-INFO +1 -1
- {exoiris-0.20.0 → exoiris-0.21.0}/ExoIris.egg-info/SOURCES.txt +1 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/PKG-INFO +1 -1
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/exoiris.py +40 -1
- exoiris-0.21.0/exoiris/loglikelihood.py +144 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/tslpf.py +13 -5
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/util.py +46 -3
- {exoiris-0.20.0 → exoiris-0.21.0}/.github/workflows/python-package.yml +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/.gitignore +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/.readthedocs.yaml +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/CODE_OF_CONDUCT.md +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/ExoIris.egg-info/dependency_links.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/ExoIris.egg-info/requires.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/ExoIris.egg-info/top_level.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/LICENSE +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/README.md +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/Makefile +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/make.bat +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/requirements.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/_static/css/custom.css +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/api/binning.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/api/exoiris.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/api/tsdata.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/conf.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/01a_not_so_short_intro.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/01b_short_intro.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/02_increasing_knot_resolution.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/03_increasing_data_resolution.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/04_gaussian_processes.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/05a_ldtkldm.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/A2_full_data_resolution.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/appendix_1_data_preparation.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/data/README.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/data/nirHiss_order_1.h5 +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/data/nirHiss_order_2.h5 +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/example1.png +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/plot_1.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/figures.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/friendly_introduction.ipynb +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/index.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/k_knot_example.svg +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/setup_multiprocessing.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/index.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/doc/source/install.rst +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/__init__.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/binning.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/ephemeris.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/ldtkld.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/spotmodel.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/tsdata.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/tsmodel.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/exoiris/wlpf.py +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/pyproject.toml +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/requirements.txt +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/setup.cfg +0 -0
- {exoiris-0.20.0 → exoiris-0.21.0}/tests/test_binning.py +0 -0
|
@@ -5,6 +5,15 @@ All notable changes to ExoIris will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.21.0] - 2025-11-24
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Added a `loglikelihood.LogLikelihood` class for reduced-rank Gaussian log-likelihood calculation.
|
|
12
|
+
- Added `ExoIris.create_loglikelihood_function` method to generate log-likelihood instances for atmospheric retrieval.
|
|
13
|
+
- Added `ExoIris.radius_ratio_spectrum` and `ExoIris.area_ratio_spectrum` methods to compute posterior transmission
|
|
14
|
+
spectrum distributions for given wavelengths.
|
|
15
|
+
- Added `exoiris.util.create_mock_model` utility function for generating mock transmission spectra.
|
|
16
|
+
|
|
8
17
|
## [0.20.0] - 2025-11-19
|
|
9
18
|
|
|
10
19
|
### Added
|
|
@@ -12,8 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
21
|
center time, amplitude in a given reference wavelength, full width at half maximum (FWHM), spot temperature in Kelvin,
|
|
13
22
|
and spot shape. The spot amplitude along the wavelength is modeled using the theoretical BT-Settl spectra, the stellar
|
|
14
23
|
effective temperature, the spot temperature, and the reference wavelength in which the spot amplitude is measured.
|
|
15
|
-
- Added the ability to model the contamination from unocculted spots and faculae (the transit light source effect
|
|
16
|
-
or TLSE).
|
|
24
|
+
- Added the ability to model the contamination from unocculted spots and faculae (**the transit light source effect**,
|
|
25
|
+
or TLSE). This is modeled also using BT-Settl spectra following the formalism described by Rackham et al. (2018).
|
|
17
26
|
- Included two new radius ratio interpolation options: "nearest" and "linear".
|
|
18
27
|
|
|
19
28
|
## [0.19.2] - 2025-09-12
|
|
@@ -32,7 +32,8 @@ from emcee import EnsembleSampler
|
|
|
32
32
|
from matplotlib.pyplot import subplots, setp, figure, Figure, Axes
|
|
33
33
|
from numpy import (any, where, sqrt, clip, percentile, median, squeeze, floor, ndarray, isfinite,
|
|
34
34
|
array, inf, arange, argsort, concatenate, full, nan, r_, nanpercentile, log10,
|
|
35
|
-
ceil, unique)
|
|
35
|
+
ceil, unique, zeros)
|
|
36
|
+
from numpy.typing import ArrayLike
|
|
36
37
|
from numpy.random import normal
|
|
37
38
|
from pytransit import UniformPrior, NormalPrior
|
|
38
39
|
from pytransit.param import ParameterSet
|
|
@@ -44,6 +45,7 @@ from .ldtkld import LDTkLD
|
|
|
44
45
|
from .tsdata import TSData, TSDataGroup
|
|
45
46
|
from .tslpf import TSLPF
|
|
46
47
|
from .wlpf import WhiteLPF
|
|
48
|
+
from .loglikelihood import LogLikelihood
|
|
47
49
|
|
|
48
50
|
|
|
49
51
|
def load_model(fname: Path | str, name: str | None = None):
|
|
@@ -1128,6 +1130,22 @@ class ExoIris:
|
|
|
1128
1130
|
median(ar, 0)[ix], ar.std(0)[ix]],
|
|
1129
1131
|
names = ['wavelength', 'radius_ratio', 'radius_ratio_e', 'area_ratio', 'area_ratio_e'])
|
|
1130
1132
|
|
|
1133
|
+
def radius_ratio_spectrum(self, wavelengths: ArrayLike, knot_samples: ArrayLike | None = None) -> ndarray:
|
|
1134
|
+
if knot_samples is None:
|
|
1135
|
+
knot_samples = self.posterior_samples.iloc[:, self._tsa._sl_rratios].values
|
|
1136
|
+
k_posteriors = zeros((knot_samples.shape[0], wavelengths.size))
|
|
1137
|
+
for i, ks in enumerate(knot_samples):
|
|
1138
|
+
k_posteriors[i, :] = self._tsa._ip(wavelengths, self._tsa.k_knots, ks)
|
|
1139
|
+
return k_posteriors
|
|
1140
|
+
|
|
1141
|
+
def area_ratio_spectrum(self, wavelengths: ArrayLike, knot_samples: ArrayLike | None = None) -> ndarray:
|
|
1142
|
+
if knot_samples is None:
|
|
1143
|
+
knot_samples = self.posterior_samples.iloc[:, self._tsa._sl_rratios].values
|
|
1144
|
+
d_posteriors = zeros((knot_samples.shape[0], wavelengths.size))
|
|
1145
|
+
for i, ks in enumerate(knot_samples):
|
|
1146
|
+
d_posteriors[i, :] = self._tsa._ip(wavelengths, self._tsa.k_knots, ks) ** 2
|
|
1147
|
+
return d_posteriors
|
|
1148
|
+
|
|
1131
1149
|
def save(self, overwrite: bool = False) -> None:
|
|
1132
1150
|
"""Save the ExoIris analysis to a FITS file.
|
|
1133
1151
|
|
|
@@ -1228,6 +1246,27 @@ class ExoIris:
|
|
|
1228
1246
|
|
|
1229
1247
|
hdul.writeto(f"{self.name}.fits", overwrite=True)
|
|
1230
1248
|
|
|
1249
|
+
def create_loglikelihood_function(self, wavelengths: ArrayLike, kind: Literal['radius_ratio', 'depth'] = 'depth') -> LogLikelihood:
|
|
1250
|
+
"""Create a reduced-rank Gaussian log-likelihood function for retrieval.
|
|
1251
|
+
|
|
1252
|
+
Parameters
|
|
1253
|
+
----------
|
|
1254
|
+
wavelengths
|
|
1255
|
+
The wavelength grid used in the theoretical transmission spectra.
|
|
1256
|
+
|
|
1257
|
+
kind
|
|
1258
|
+
The transmission spectrum type. Can be either 'radius_ratio' or 'depth'.
|
|
1259
|
+
|
|
1260
|
+
Returns
|
|
1261
|
+
-------
|
|
1262
|
+
LogLikelihood
|
|
1263
|
+
An instance of LogLikelihood for analyzing the consistency of the model
|
|
1264
|
+
with the provided wavelengths and chosen log-likelihood kind.
|
|
1265
|
+
"""
|
|
1266
|
+
if self.mcmc_chains is None:
|
|
1267
|
+
raise ValueError("Cannot create log-likelihood function before running the MCMC sampler.")
|
|
1268
|
+
return LogLikelihood(self, wavelengths, kind)
|
|
1269
|
+
|
|
1231
1270
|
def create_initial_population(self, n: int, source: str, add_noise: bool = True) -> ndarray:
|
|
1232
1271
|
"""Create an initial parameter vector population for the DE optimisation.
|
|
1233
1272
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# ExoIris: fast, flexible, and easy exoplanet transmission spectroscopy in Python.
|
|
2
|
+
# Copyright (C) 2025 Hannu Parviainen
|
|
3
|
+
#
|
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
7
|
+
# (at your option) any later version.
|
|
8
|
+
#
|
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
# GNU General Public License for more details.
|
|
13
|
+
#
|
|
14
|
+
# You should have received a copy of the GNU General Public License
|
|
15
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
from typing import Literal
|
|
17
|
+
|
|
18
|
+
from numpy import full, cov, sqrt, sum
|
|
19
|
+
from numpy.linalg import eigh
|
|
20
|
+
from numpy.typing import ArrayLike
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class LogLikelihood:
|
|
24
|
+
def __init__(self, exoiris, wavelength: ArrayLike, kind: Literal['radius_ratio', 'depth'] = 'depth', eps: float = 1e-10):
|
|
25
|
+
"""Reduced-rank Gaussian log-likelihood.
|
|
26
|
+
|
|
27
|
+
This class constructs a statistically correct reduced-rank Gaussian
|
|
28
|
+
log-likelihood function for comparing a theoretical transmission spectrum to the
|
|
29
|
+
posterior distribution inferred by ExoIris. Because the posterior
|
|
30
|
+
samples of the transmission spectrum are generated from a spline with
|
|
31
|
+
far fewer independent parameters than the number of wavelength bins, the
|
|
32
|
+
empirical covariance matrix is rank-deficient or strongly ill-conditioned.
|
|
33
|
+
Direct inversion of the full covariance is therefore numerically unstable
|
|
34
|
+
and produces incorrect likelihoods.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
exoiris
|
|
39
|
+
The ExoIris model object from which posterior samples of the knot
|
|
40
|
+
values and spline interpolation functions are obtained.
|
|
41
|
+
|
|
42
|
+
wavelength
|
|
43
|
+
Wavelength grid on which the radius ratio posterior samples and the
|
|
44
|
+
theoretical spectra will be evaluated.
|
|
45
|
+
|
|
46
|
+
kind
|
|
47
|
+
The type of the spectrum. Can be either ``radius_ratio`` for a radius ratio
|
|
48
|
+
spectrum, or ``depth`` for a transit depth spectrum.
|
|
49
|
+
|
|
50
|
+
eps
|
|
51
|
+
Relative tolerance factor used to determine which eigenvalues of
|
|
52
|
+
the covariance matrix are considered significant. Eigenvalues smaller
|
|
53
|
+
than ``eps * max_eigenvalue`` are discarded. Default is ``1e-10``.
|
|
54
|
+
|
|
55
|
+
Attributes
|
|
56
|
+
----------
|
|
57
|
+
k_posteriors : ndarray of shape (n_samples, n_wavelengths)
|
|
58
|
+
Radius-ratio posterior samples evaluated on the wavelength grid.
|
|
59
|
+
|
|
60
|
+
k_mean : ndarray of shape (n_wavelengths,)
|
|
61
|
+
Posterior mean radius-ratio spectrum.
|
|
62
|
+
|
|
63
|
+
k_cov : ndarray of shape (n_wavelengths, n_wavelengths)
|
|
64
|
+
Empirical covariance matrix of the posterior samples.
|
|
65
|
+
|
|
66
|
+
lambda_r : ndarray of shape (k,)
|
|
67
|
+
Significant eigenvalues of the covariance matrix (``k`` = reduced
|
|
68
|
+
dimensionality).
|
|
69
|
+
|
|
70
|
+
u_r : ndarray of shape (n_wavelengths, k)
|
|
71
|
+
Eigenvectors corresponding to the significant eigenvalues.
|
|
72
|
+
|
|
73
|
+
sqrt_inv_lambda_r : ndarray of shape (k,)
|
|
74
|
+
Factors used to whiten the reduced-rank representation.
|
|
75
|
+
|
|
76
|
+
y_data : ndarray of shape (k,)
|
|
77
|
+
Whitened reduced-rank representation of the posterior mean spectrum.
|
|
78
|
+
|
|
79
|
+
Notes
|
|
80
|
+
-----
|
|
81
|
+
The class implements the reduced-rank likelihood method:
|
|
82
|
+
|
|
83
|
+
1. Posterior samples of the spline knot values are evaluated on the
|
|
84
|
+
user-specified wavelength grid to produce a matrix of radius-ratio
|
|
85
|
+
samples, ``k_posteriors``.
|
|
86
|
+
|
|
87
|
+
2. The empirical mean spectrum and covariance matrix are computed over
|
|
88
|
+
these samples.
|
|
89
|
+
|
|
90
|
+
3. An eigendecomposition of the covariance matrix is performed. All
|
|
91
|
+
eigenvalues below ``eps * max(eigenvalue)`` are discarded, ensuring that
|
|
92
|
+
only statistically meaningful directions (i.e., those supported by the
|
|
93
|
+
spline parameterization and the data) are retained.
|
|
94
|
+
|
|
95
|
+
4. The retained eigenvectors form an orthonormal basis for the true
|
|
96
|
+
low-dimensional subspace in which the posterior distribution lives.
|
|
97
|
+
Projection onto this basis, followed by whitening with
|
|
98
|
+
``lambda_r**(-1/2)``, yields a representation where the posterior is a
|
|
99
|
+
standard multivariate normal with identity covariance.
|
|
100
|
+
|
|
101
|
+
5. The log-likelihood of a theoretical spectrum ``x`` is evaluated in this
|
|
102
|
+
reduced space as:
|
|
103
|
+
|
|
104
|
+
log L = -0.5 * sum_i (y_data[i] - y_model[i])^2
|
|
105
|
+
|
|
106
|
+
where ``y_data`` is the whitened reduced-space representation of the
|
|
107
|
+
posterior mean spectrum, and ``y_model`` is the whitened projection of
|
|
108
|
+
the model spectrum.
|
|
109
|
+
|
|
110
|
+
- This reduced-rank formulation is mathematically equivalent to computing
|
|
111
|
+
the Gaussian likelihood in knot space, and avoids the numerical
|
|
112
|
+
instabilities associated with inverting a nearly singular covariance
|
|
113
|
+
matrix in the oversampled wavelength space.
|
|
114
|
+
|
|
115
|
+
- If ``x`` is provided as a scalar, it is broadcast to a constant spectrum
|
|
116
|
+
over the wavelength grid. Otherwise, it must be an array of the same
|
|
117
|
+
wavelength length.
|
|
118
|
+
"""
|
|
119
|
+
self.model = m = exoiris
|
|
120
|
+
self.wavelength = wavelength
|
|
121
|
+
self.eps = eps
|
|
122
|
+
|
|
123
|
+
if kind == 'radius_ratio':
|
|
124
|
+
self.spectrum = m.radius_ratio_spectrum(wavelength)
|
|
125
|
+
elif kind == 'depth':
|
|
126
|
+
self.spectrum = m.area_ratio_spectrum(wavelength)
|
|
127
|
+
else:
|
|
128
|
+
raise ValueError('Unknown spectrum type: {}'.format(kind))
|
|
129
|
+
|
|
130
|
+
self.spmean = self.spectrum.mean(0)
|
|
131
|
+
self.spcov = cov(self.spectrum, rowvar=False)
|
|
132
|
+
|
|
133
|
+
evals, u = eigh(self.spcov)
|
|
134
|
+
tol = eps * evals.max()
|
|
135
|
+
keep = evals > tol
|
|
136
|
+
self.lambda_r, self.u_r = evals[keep], u[:, keep]
|
|
137
|
+
self.sqrt_inv_lambda_r = 1.0 / sqrt(self.lambda_r)
|
|
138
|
+
self.y_data = (self.u_r.T @ self.spmean) * self.sqrt_inv_lambda_r
|
|
139
|
+
|
|
140
|
+
def __call__(self, x):
|
|
141
|
+
if isinstance(x, float):
|
|
142
|
+
x = full(self.wavelength.size, x)
|
|
143
|
+
y_model = (self.u_r.T @ x) * self.sqrt_inv_lambda_r
|
|
144
|
+
return -0.5*sum((self.y_data - y_model)**2)
|
|
@@ -35,7 +35,6 @@ from scipy.interpolate import (
|
|
|
35
35
|
splev,
|
|
36
36
|
Akima1DInterpolator,
|
|
37
37
|
interp1d,
|
|
38
|
-
FloaterHormannInterpolator,
|
|
39
38
|
)
|
|
40
39
|
|
|
41
40
|
from .tsmodel import TransmissionSpectroscopyModel as TSModel
|
|
@@ -102,6 +101,13 @@ def add_knots(x_new, x_old):
|
|
|
102
101
|
return sort(concatenate([x_new, x_old]))
|
|
103
102
|
|
|
104
103
|
|
|
104
|
+
interpolator_choices = ("bspline", "pchip", "makima", "nearest", "linear")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
interpolators = {'bspline': ip_bspline, 'pchip': ip_pchip, 'makima': ip_makima,
|
|
108
|
+
'nearest': ip_nearest, 'linear': ip_linear}
|
|
109
|
+
|
|
110
|
+
|
|
105
111
|
def clean_knots(knots, min_distance, lmin=0, lmax=inf):
|
|
106
112
|
"""Clean the knot table by replacing groups of adjacent knots with a single knot at the group mean.
|
|
107
113
|
|
|
@@ -154,8 +160,10 @@ class TSLPF(LogPosteriorFunction):
|
|
|
154
160
|
self._baseline_models: list[ndarray] | None = None
|
|
155
161
|
self.interpolation: str = interpolation
|
|
156
162
|
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
if interpolation not in interpolator_choices:
|
|
164
|
+
raise ValueError(f'interpolation must be one of {interpolator_choices}')
|
|
165
|
+
self._ip = interpolators[interpolation]
|
|
166
|
+
self._ip_ld = interpolators['bspline']
|
|
159
167
|
|
|
160
168
|
self._gp: Optional[list[GP]] = None
|
|
161
169
|
self._gp_time: Optional[list[ndarray]] = None
|
|
@@ -608,8 +616,8 @@ class TSLPF(LogPosteriorFunction):
|
|
|
608
616
|
ldp = [zeros((pvp.shape[0], npb, 2)) for npb in self.npb]
|
|
609
617
|
for ids in range(self.data.size):
|
|
610
618
|
for ipv in range(pvp.shape[0]):
|
|
611
|
-
ldp[ids][ipv, :, 0] =
|
|
612
|
-
ldp[ids][ipv, :, 1] =
|
|
619
|
+
ldp[ids][ipv, :, 0] = self._ip_ld(self.wavelengths[ids], self.ld_knots, ldk[ipv, :, 0])
|
|
620
|
+
ldp[ids][ipv, :, 1] = self._ip_ld(self.wavelengths[ids], self.ld_knots, ldk[ipv, :, 1])
|
|
613
621
|
return ldp
|
|
614
622
|
|
|
615
623
|
def transit_model(self, pv, copy=True):
|
|
@@ -15,8 +15,10 @@
|
|
|
15
15
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
16
|
|
|
17
17
|
from numba import njit
|
|
18
|
-
from numpy import zeros, sum, sqrt, linspace, vstack, concatenate, floor, dot, ndarray, nan
|
|
19
|
-
|
|
18
|
+
from numpy import (zeros, sum, sqrt, linspace, vstack, concatenate, floor, dot, ndarray, nan, asarray, tile)
|
|
19
|
+
from numpy._typing import ArrayLike
|
|
20
|
+
from pytransit import TSModel
|
|
21
|
+
from pytransit.orbits import i_from_ba
|
|
20
22
|
|
|
21
23
|
@njit
|
|
22
24
|
def bin2d(v, e, el, er, bins, estimate_errors: bool = False) -> tuple[ndarray, ndarray]:
|
|
@@ -116,4 +118,45 @@ def create_binning(ranges, bwidths):
|
|
|
116
118
|
n = int(floor((r[1] - r[0]) / w))
|
|
117
119
|
e = linspace(*r, num=n)
|
|
118
120
|
bins.append(vstack([e[:-1], e[1:]]).T)
|
|
119
|
-
return concatenate(bins)
|
|
121
|
+
return concatenate(bins)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def create_mock_model(ks: ArrayLike, times: ArrayLike = None, ldc: ArrayLike = None, t0: float = 0.0, p: float =2.0, a: float =8.0, b: float =0.0) -> ndarray:
|
|
125
|
+
"""Create a mock transmission spectrum observation using given parameters.
|
|
126
|
+
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
ks
|
|
130
|
+
Array of radius ratios, one radius ratio per wavelength.
|
|
131
|
+
times
|
|
132
|
+
Array of time values to set the data points. If None, defaults to a
|
|
133
|
+
linspace of 500 points in the range [-0.1, 0.1].
|
|
134
|
+
ldc
|
|
135
|
+
Array representing the limb darkening coefficients. If None, defaults to
|
|
136
|
+
a tile of [0.4, 0.4] for each wavelength element.
|
|
137
|
+
t0
|
|
138
|
+
Transit center.
|
|
139
|
+
p
|
|
140
|
+
Orbital period.
|
|
141
|
+
a
|
|
142
|
+
Semi-major axis.
|
|
143
|
+
b
|
|
144
|
+
Impact parameter.
|
|
145
|
+
|
|
146
|
+
Returns
|
|
147
|
+
-------
|
|
148
|
+
ndarray
|
|
149
|
+
Mock spectrophotometric light curves.
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
ks = asarray(ks)
|
|
153
|
+
if times is None:
|
|
154
|
+
times = linspace(-0.1, 0.1, 500)
|
|
155
|
+
if ldc is None:
|
|
156
|
+
ldc = tile([0.4, 0.4], (1, ks.size, 1))
|
|
157
|
+
inc = i_from_ba(b, a)
|
|
158
|
+
|
|
159
|
+
m1 = TSModel('power-2', ng=100, nzin=50, nzlimb=50)
|
|
160
|
+
m1.set_data(times)
|
|
161
|
+
f1 = m1.evaluate(ks, ldc, t0, p, a, inc)[0]
|
|
162
|
+
return f1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/02_increasing_knot_resolution.ipynb
RENAMED
|
File without changes
|
{exoiris-0.20.0 → exoiris-0.21.0}/doc/source/examples/e01/03_increasing_data_resolution.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|