PyTransit 2.8.0__tar.gz → 2.8.1__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.
- pytransit-2.8.1/MANIFEST.in +4 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/PKG-INFO +1 -2
- {pytransit-2.8.0 → pytransit-2.8.1}/PyTransit.egg-info/PKG-INFO +1 -2
- {pytransit-2.8.0 → pytransit-2.8.1}/PyTransit.egg-info/SOURCES.txt +1 -2
- {pytransit-2.8.0 → pytransit-2.8.1}/PyTransit.egg-info/requires.txt +0 -1
- {pytransit-2.8.0 → pytransit-2.8.1}/pyproject.toml +1 -1
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/__init__.py +1 -1
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/linear.py +1 -1
- pytransit-2.8.1/pytransit/models/limb_darkening/nonlinear.py +6 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/power_2.py +2 -2
- pytransit-2.8.1/pytransit/models/new_eclipse_model.py +70 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/udmodel.py +1 -1
- {pytransit-2.8.0 → pytransit-2.8.1}/requirements.txt +0 -1
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_limb_darkening.py +10 -68
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_ma_quadratic.py +0 -34
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_uniform_model.py +10 -8
- pytransit-2.8.0/MANIFEST.in +0 -6
- pytransit-2.8.0/pytransit/models/limb_darkening/nonlinear.py +0 -8
- pytransit-2.8.0/tests/test_jax_uniformdisk.py +0 -196
- pytransit-2.8.0/tests/test_transitmodel_helpers.py +0 -193
- {pytransit-2.8.0 → pytransit-2.8.1}/LICENSE +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/PyTransit.egg-info/dependency_links.txt +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/PyTransit.egg-info/top_level.txt +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/README.md +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/contamination.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/data/spectra.h5 +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/data/transmission.nc +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/filter.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/instrument.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/contamination/plotting.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/limb_darkening.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/baselines/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/baselines/legendrebaseline.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/baselines/linearbaseline.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/cntlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/eclipselpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/celeriteloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/clloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/fmcloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/logisticloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/multiceleriteloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/loglikelihood/wnloglikelihood.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/logposteriorfunction.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/lpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/mclpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/mptlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/ocllpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/ocltdvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/oclttvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/phasecurvelpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/rvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tdvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/ctesslpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/tessttvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/tgclpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/tgcmplpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tess/tmpclpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tesslpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/tessoclttvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/transitanalysis.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/transitlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/lpf/ttvlpf.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/eclipse_model.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/gdmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/general.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ldmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ldtkldm.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/general.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/quadratic.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/quadratic_tri.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/limb_darkening/uniform.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ma_chromosphere.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ma_quadratic.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ma_quadratic_cl.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ma_uniform.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/ma_uniform_cl.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/gdmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/general_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/ldmodels.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/ldtkldm.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/ma_chromosphere_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/ma_quadratic_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/ma_uniform_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/phasecurves.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/qpower2_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/numba/spmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/opencl/ma_quadratic.cl +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/opencl/ma_uniform.cl +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/opencl/orbits.cl +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/opencl/qpower2.cl +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/osmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/qpower2.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/qpower2_cl.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/common.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/ecintersection.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/esmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/model_eclipse.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/model_ecspec.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/model_full.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/model_simple.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/model_trspec.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/opmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/opmodel_full.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/rrmodel.cl +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/rrmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/rrmodel_cl.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/roadrunner/tsmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/transitmodel.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/models/uniform.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/orbits/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/orbits/orbits.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/orbits/orbits_py.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/orbits/taylor_z.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/param/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/param/parameter.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/param/prior.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/param/utilities.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/stars/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/stars/btsettl.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/stars/data/avg_bt_settl.fits +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/stars/data/avg_husser2013.fits +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/stars/husser2013.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/astrometry.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/constants.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/de.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/downsample.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/eclipses.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/io/__init__.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/io/lightcurvedata.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/keplerlc.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/mdwarfs.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/misc.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/mocklc.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/octasphere.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/phasecurves.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/physics.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/rv.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/pytransit/utils/tess.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/setup.cfg +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_contamination.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_ma_quadratic_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_qpower2_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_roadrunner_eclipse.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_uniform_model_nb.py +0 -0
- {pytransit-2.8.0 → pytransit-2.8.1}/tests/test_z.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyTransit
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.1
|
|
4
4
|
Summary: Fast and painless exoplanet transit light curve modelling.
|
|
5
5
|
Author-email: Hannu Parviainen <hpparvi@gmail.com>
|
|
6
6
|
License: GPLv2
|
|
@@ -28,7 +28,6 @@ Requires-Dist: astropy
|
|
|
28
28
|
Requires-Dist: matplotlib
|
|
29
29
|
Requires-Dist: tqdm
|
|
30
30
|
Requires-Dist: semantic_version
|
|
31
|
-
Requires-Dist: setuptools
|
|
32
31
|
Requires-Dist: deprecated
|
|
33
32
|
Requires-Dist: seaborn
|
|
34
33
|
Requires-Dist: emcee
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyTransit
|
|
3
|
-
Version: 2.8.
|
|
3
|
+
Version: 2.8.1
|
|
4
4
|
Summary: Fast and painless exoplanet transit light curve modelling.
|
|
5
5
|
Author-email: Hannu Parviainen <hpparvi@gmail.com>
|
|
6
6
|
License: GPLv2
|
|
@@ -28,7 +28,6 @@ Requires-Dist: astropy
|
|
|
28
28
|
Requires-Dist: matplotlib
|
|
29
29
|
Requires-Dist: tqdm
|
|
30
30
|
Requires-Dist: semantic_version
|
|
31
|
-
Requires-Dist: setuptools
|
|
32
31
|
Requires-Dist: deprecated
|
|
33
32
|
Requires-Dist: seaborn
|
|
34
33
|
Requires-Dist: emcee
|
|
@@ -62,6 +62,7 @@ pytransit/models/ma_quadratic.py
|
|
|
62
62
|
pytransit/models/ma_quadratic_cl.py
|
|
63
63
|
pytransit/models/ma_uniform.py
|
|
64
64
|
pytransit/models/ma_uniform_cl.py
|
|
65
|
+
pytransit/models/new_eclipse_model.py
|
|
65
66
|
pytransit/models/osmodel.py
|
|
66
67
|
pytransit/models/qpower2.py
|
|
67
68
|
pytransit/models/qpower2_cl.py
|
|
@@ -137,13 +138,11 @@ pytransit/utils/tess.py
|
|
|
137
138
|
pytransit/utils/io/__init__.py
|
|
138
139
|
pytransit/utils/io/lightcurvedata.py
|
|
139
140
|
tests/test_contamination.py
|
|
140
|
-
tests/test_jax_uniformdisk.py
|
|
141
141
|
tests/test_limb_darkening.py
|
|
142
142
|
tests/test_ma_quadratic.py
|
|
143
143
|
tests/test_ma_quadratic_nb.py
|
|
144
144
|
tests/test_qpower2_nb.py
|
|
145
145
|
tests/test_roadrunner_eclipse.py
|
|
146
|
-
tests/test_transitmodel_helpers.py
|
|
147
146
|
tests/test_uniform_model.py
|
|
148
147
|
tests/test_uniform_model_nb.py
|
|
149
148
|
tests/test_z.py
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from math import pi
|
|
1
|
+
from math import pi
|
|
2
2
|
|
|
3
3
|
from numba import njit
|
|
4
4
|
from numpy import zeros, log
|
|
@@ -11,7 +11,7 @@ def ld_power_2(mu, pv):
|
|
|
11
11
|
|
|
12
12
|
@njit
|
|
13
13
|
def ldi_power_2(mu, pv):
|
|
14
|
-
return 2 * pi *
|
|
14
|
+
return 2 * pi * (0.5 - 0.5 * pv[0] + pv[0] / (pv[1] + 2.0))
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
@njit(fastmath=True)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# PyTransit: fast and easy exoplanet transit modelling in Python.
|
|
2
|
+
# Copyright (C) 2010-2019 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
|
+
|
|
17
|
+
from typing import Union
|
|
18
|
+
|
|
19
|
+
from numpy import squeeze, zeros, atleast_1d, atleast_2d
|
|
20
|
+
from numpy.typing import NDArray
|
|
21
|
+
from .roadrunner.model_eclipse import eclipse_model
|
|
22
|
+
from .transitmodel import TransitModel
|
|
23
|
+
|
|
24
|
+
__all__ = ['EclipseModel']
|
|
25
|
+
|
|
26
|
+
npfloat = Union[float, NDArray]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class EclipseModel(TransitModel):
|
|
30
|
+
|
|
31
|
+
def __init__(self) -> None:
|
|
32
|
+
super().__init__()
|
|
33
|
+
|
|
34
|
+
def evaluate(self, k: npfloat, t0: npfloat, p: npfloat, a: npfloat, i: npfloat, e: npfloat = None, w: npfloat = None,
|
|
35
|
+
rstar: float = 1.0, copy: bool = True) -> NDArray:
|
|
36
|
+
"""Evaluates a multiplicative secondary eclipse model for a set of scalar or vector parameters.
|
|
37
|
+
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
k
|
|
41
|
+
Radius ratio(s) either as a single float, 1D vector, or 2D array.
|
|
42
|
+
t0
|
|
43
|
+
Transit center(s) as a float or a 1D vector.
|
|
44
|
+
p
|
|
45
|
+
Orbital period(s) as a float or a 1D vector.
|
|
46
|
+
a
|
|
47
|
+
Orbital semi-major axis (axes) divided by the stellar radius as a float or a 1D vector.
|
|
48
|
+
i
|
|
49
|
+
Orbital inclination(s) as a float or a 1D vector.
|
|
50
|
+
e
|
|
51
|
+
Orbital eccentricity as a float or a 1D vector.
|
|
52
|
+
w
|
|
53
|
+
Argument of periastron as a float or a 1D vector.
|
|
54
|
+
rstar
|
|
55
|
+
Stellar radius in R_sun as a float or a 1D vector.
|
|
56
|
+
|
|
57
|
+
Returns
|
|
58
|
+
-------
|
|
59
|
+
Multiplicative eclipse model
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
k = atleast_1d(k)
|
|
63
|
+
t0 = atleast_2d(t0).reshape([k.size, -1])
|
|
64
|
+
p = atleast_1d(p)
|
|
65
|
+
a = atleast_1d(a)
|
|
66
|
+
i = atleast_1d(i)
|
|
67
|
+
e = zeros(1) if e is None else atleast_1d(e)
|
|
68
|
+
w = zeros(1) if w is None else atleast_1d(w)
|
|
69
|
+
|
|
70
|
+
return squeeze(eclipse_model(self.time, k, t0, p, a, i, e, w, rstar, self.nlc, self.lcids, self.pbids, self.nsamples, self.exptimes))
|
|
@@ -9,16 +9,13 @@ from numpy.testing import assert_allclose
|
|
|
9
9
|
import pytest
|
|
10
10
|
from scipy.integrate import quad
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from pytransit.
|
|
16
|
-
from pytransit.
|
|
17
|
-
from pytransit.
|
|
18
|
-
from pytransit.
|
|
19
|
-
from pytransit.backends.numba.limb_darkening.power_2 import ld_power_2, ldi_power_2, ldd_power_2
|
|
20
|
-
from pytransit.backends.numba.limb_darkening.nonlinear import ld_nonlinear, ldi_nonlinear, ldd_nonlinear
|
|
21
|
-
from pytransit.backends.numba.limb_darkening.general import ld_general, ldi_general, ldd_general
|
|
12
|
+
from pytransit.models.limb_darkening.uniform import ld_uniform, ldi_uniform
|
|
13
|
+
from pytransit.models.limb_darkening.linear import ld_linear, ldi_linear, ldd_linear
|
|
14
|
+
from pytransit.models.limb_darkening.quadratic import ld_quadratic, ldi_quadratic, ldd_quadratic
|
|
15
|
+
from pytransit.models.limb_darkening.quadratic_tri import ld_quadratic_tri, ldi_quadratic_tri
|
|
16
|
+
from pytransit.models.limb_darkening.power_2 import ld_power_2, ldi_power_2, ldd_power_2
|
|
17
|
+
from pytransit.models.limb_darkening.nonlinear import ld_nonlinear
|
|
18
|
+
from pytransit.models.limb_darkening.general import ld_general
|
|
22
19
|
|
|
23
20
|
|
|
24
21
|
def numerical_ldi(ld_func, pv, n=10000):
|
|
@@ -110,38 +107,12 @@ class TestIntegrals:
|
|
|
110
107
|
np.array([0.0, 1.0]),
|
|
111
108
|
])
|
|
112
109
|
def test_power_2(self, pv):
|
|
113
|
-
|
|
110
|
+
# ldi_power_2 takes (mu, pv) for registry consistency; mu is unused.
|
|
111
|
+
assert_allclose(ldi_power_2(np.array([1.0]), pv), numerical_ldi(ld_power_2, pv), rtol=1e-10)
|
|
114
112
|
|
|
115
113
|
def test_power_2_c0_gives_pi(self):
|
|
116
114
|
"""c=0 reduces to uniform disk, integral = π."""
|
|
117
|
-
assert_allclose(ldi_power_2(np.array([0.0, 1.0])), np.pi, rtol=1e-12)
|
|
118
|
-
|
|
119
|
-
@pytest.mark.parametrize("pv", [
|
|
120
|
-
np.array([0.1, 0.2, 0.1, 0.05]),
|
|
121
|
-
np.array([0.3, 0.2, 0.15, 0.1]),
|
|
122
|
-
np.array([0.0, 0.0, 0.0, 0.0]),
|
|
123
|
-
np.array([0.5, 0.3, 0.1, 0.05]),
|
|
124
|
-
])
|
|
125
|
-
def test_nonlinear(self, pv):
|
|
126
|
-
assert_allclose(ldi_nonlinear(pv), numerical_ldi(ld_nonlinear, pv), rtol=1e-10)
|
|
127
|
-
|
|
128
|
-
def test_nonlinear_zeros_gives_pi(self):
|
|
129
|
-
"""All zeros reduces to uniform disk, integral = π."""
|
|
130
|
-
assert_allclose(ldi_nonlinear(np.array([0.0, 0.0, 0.0, 0.0])), np.pi, rtol=1e-12)
|
|
131
|
-
|
|
132
|
-
@pytest.mark.parametrize("pv", [
|
|
133
|
-
np.array([0.5, 0.3]),
|
|
134
|
-
np.array([1.0, 0.0]),
|
|
135
|
-
np.array([0.0, 1.0]),
|
|
136
|
-
np.array([0.2, 0.3, 0.1]),
|
|
137
|
-
])
|
|
138
|
-
def test_general(self, pv):
|
|
139
|
-
assert_allclose(ldi_general(pv), numerical_ldi(ld_general, pv), rtol=1e-10)
|
|
140
|
-
|
|
141
|
-
def test_general_single_coeff(self):
|
|
142
|
-
"""Single coeff c₀: I(μ) = c₀(1-μ), integral = 2π·c₀·1/(2·3) = πc₀/3."""
|
|
143
|
-
pv = np.array([1.0])
|
|
144
|
-
assert_allclose(ldi_general(pv), np.pi / 3.0, rtol=1e-12)
|
|
115
|
+
assert_allclose(ldi_power_2(np.array([1.0]), np.array([0.0, 1.0])), np.pi, rtol=1e-12)
|
|
145
116
|
|
|
146
117
|
|
|
147
118
|
# ============================================================
|
|
@@ -171,15 +142,6 @@ class TestGradients:
|
|
|
171
142
|
num = numerical_gradient(ld_quadratic, self.mu_test, pv)
|
|
172
143
|
assert_allclose(ana, num, atol=1e-6)
|
|
173
144
|
|
|
174
|
-
@pytest.mark.parametrize("pv", [
|
|
175
|
-
np.array([0.5, 0.3]),
|
|
176
|
-
np.array([0.8, 0.5]),
|
|
177
|
-
])
|
|
178
|
-
def test_quadratic_tri(self, pv):
|
|
179
|
-
ana = ldd_quadratic_tri(self.mu_test, pv)
|
|
180
|
-
num = numerical_gradient(ld_quadratic_tri, self.mu_test, pv)
|
|
181
|
-
assert_allclose(ana, num, atol=1e-5)
|
|
182
|
-
|
|
183
145
|
@pytest.mark.parametrize("pv", [
|
|
184
146
|
np.array([0.3, 0.7]),
|
|
185
147
|
np.array([0.8, 0.5]),
|
|
@@ -191,26 +153,6 @@ class TestGradients:
|
|
|
191
153
|
num = numerical_gradient(ld_power_2, mu, pv)
|
|
192
154
|
assert_allclose(ana, num, atol=1e-5)
|
|
193
155
|
|
|
194
|
-
@pytest.mark.parametrize("pv", [
|
|
195
|
-
np.array([0.1, 0.2, 0.1, 0.05]),
|
|
196
|
-
np.array([0.3, 0.2, 0.15, 0.1]),
|
|
197
|
-
])
|
|
198
|
-
def test_nonlinear(self, pv):
|
|
199
|
-
# Avoid mu near 0 where c₁/(2√μ) diverges
|
|
200
|
-
mu = self.mu_test[self.mu_test > 0.05]
|
|
201
|
-
ana = ldd_nonlinear(mu, pv)
|
|
202
|
-
num = numerical_gradient(ld_nonlinear, mu, pv)
|
|
203
|
-
assert_allclose(ana, num, atol=1e-5)
|
|
204
|
-
|
|
205
|
-
@pytest.mark.parametrize("pv", [
|
|
206
|
-
np.array([0.5, 0.3]),
|
|
207
|
-
np.array([0.2, 0.3, 0.1]),
|
|
208
|
-
])
|
|
209
|
-
def test_general(self, pv):
|
|
210
|
-
ana = ldd_general(self.mu_test, pv)
|
|
211
|
-
num = numerical_gradient(ld_general, self.mu_test, pv)
|
|
212
|
-
assert_allclose(ana, num, atol=1e-5)
|
|
213
|
-
|
|
214
156
|
|
|
215
157
|
# ============================================================
|
|
216
158
|
# Edge case tests
|
|
@@ -109,40 +109,6 @@ class TestQuadraticModel:
|
|
|
109
109
|
assert flux.ndim == 1
|
|
110
110
|
assert flux.size == model_data.time.size
|
|
111
111
|
|
|
112
|
-
def test_evaluate_pvi(self, model_data):
|
|
113
|
-
tm = QuadraticModel(interpolate=True)
|
|
114
|
-
tm.set_data(model_data.time)
|
|
115
|
-
|
|
116
|
-
pvp = array([[0.12, 0.00, 1.0, 3.0, 0.500 * pi, 0.0, 0.0],
|
|
117
|
-
[0.11, 0.01, 0.9, 2.9, 0.495 * pi, 0.0, 0.0]])
|
|
118
|
-
|
|
119
|
-
ldc = [[0.1, 0.2], [0.3, 0.1]]
|
|
120
|
-
flux = tm.evaluate_pv(pvp[0], ldc[0])
|
|
121
|
-
assert flux.ndim == 1
|
|
122
|
-
assert flux.size == model_data.time.size
|
|
123
|
-
|
|
124
|
-
ldc = [[0.1, 0.2], [0.3, 0.1]]
|
|
125
|
-
flux = tm.evaluate_pv(pvp, ldc)
|
|
126
|
-
assert flux.ndim == 2
|
|
127
|
-
assert flux.shape == (2, model_data.time.size)
|
|
128
|
-
|
|
129
|
-
def test_evaluate_pvd(self, model_data):
|
|
130
|
-
tm = QuadraticModel(interpolate=False)
|
|
131
|
-
tm.set_data(model_data.time)
|
|
132
|
-
|
|
133
|
-
pvp = array([[0.12, 0.00, 1.0, 3.0, 0.500 * pi, 0.0, 0.0],
|
|
134
|
-
[0.11, 0.01, 0.9, 2.9, 0.495 * pi, 0.0, 0.0]])
|
|
135
|
-
|
|
136
|
-
ldc = [[0.1, 0.2], [0.3, 0.1]]
|
|
137
|
-
flux = tm.evaluate_pv(pvp[0], ldc[0])
|
|
138
|
-
assert flux.ndim == 1
|
|
139
|
-
assert flux.size == model_data.time.size
|
|
140
|
-
|
|
141
|
-
ldc = [[0.1, 0.2], [0.3, 0.1]]
|
|
142
|
-
flux = tm.evaluate_pv(pvp, ldc)
|
|
143
|
-
assert flux.ndim == 2
|
|
144
|
-
assert flux.shape == (2, model_data.time.size)
|
|
145
|
-
|
|
146
112
|
# TODO: Set up OpenCL in Travis
|
|
147
113
|
# -----------------------------
|
|
148
114
|
# def test_to_opencl(self):
|
|
@@ -79,17 +79,19 @@ class TestUniformModel:
|
|
|
79
79
|
assert flux.ndim == 1
|
|
80
80
|
assert flux.size == model_data.time.size
|
|
81
81
|
|
|
82
|
-
def
|
|
82
|
+
def test_evaluate_population(self, model_data):
|
|
83
|
+
# Evaluate a population of parameter sets simultaneously through the
|
|
84
|
+
# vectorised evaluate() (which replaced the removed evaluate_pv()). The
|
|
85
|
+
# vector branch is selected because the orbital parameters are arrays.
|
|
83
86
|
tm = UniformModel()
|
|
84
87
|
tm.set_data(model_data.time)
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
k = array([0.12, 0.11])
|
|
90
|
+
t0 = array([0.00, 0.01])
|
|
91
|
+
p = array([1.0, 0.9])
|
|
92
|
+
a = array([3.0, 2.9])
|
|
93
|
+
i = array([0.500 * pi, 0.495 * pi])
|
|
88
94
|
|
|
89
|
-
flux = tm.
|
|
90
|
-
assert flux.ndim == 1
|
|
91
|
-
assert flux.size == model_data.time.size
|
|
92
|
-
|
|
93
|
-
flux = tm.evaluate_pv(pvp)
|
|
95
|
+
flux = tm.evaluate(k, t0, p, a, i)
|
|
94
96
|
assert flux.ndim == 2
|
|
95
97
|
assert flux.shape == (2, model_data.time.size)
|
pytransit-2.8.0/MANIFEST.in
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
"""Tests for the JAX uniform-disk transit model.
|
|
2
|
-
|
|
3
|
-
Verifies:
|
|
4
|
-
1. Analytical correctness (mid-transit depth = k^2 for full containment)
|
|
5
|
-
2. jax.jit compatibility
|
|
6
|
-
3. jax.value_and_grad produces finite gradients
|
|
7
|
-
4. Edge cases: grazing transit, full containment, no transit
|
|
8
|
-
"""
|
|
9
|
-
|
|
10
|
-
import numpy as np
|
|
11
|
-
import jax
|
|
12
|
-
jax.config.update("jax_enable_x64", True)
|
|
13
|
-
import jax.numpy as jnp
|
|
14
|
-
import pytest
|
|
15
|
-
|
|
16
|
-
# Skip the whole module if the JAX backend isn't available yet (work in progress).
|
|
17
|
-
jax_uniform = pytest.importorskip("pytransit.backends.jax.uniformdisk").uniform_model
|
|
18
|
-
|
|
19
|
-
# Shared orbital parameters for a typical hot Jupiter transit
|
|
20
|
-
T0 = 0.0
|
|
21
|
-
P = 2.5
|
|
22
|
-
A = 8.0
|
|
23
|
-
I = np.radians(87.0)
|
|
24
|
-
E = 0.0
|
|
25
|
-
W = 0.5 * np.pi
|
|
26
|
-
TIMES = np.linspace(-0.15, 0.15, 300)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class TestAnalytical:
|
|
30
|
-
"""Check against known analytical results."""
|
|
31
|
-
|
|
32
|
-
def test_mid_transit_depth(self):
|
|
33
|
-
"""At mid-transit with b~0, flux deviation should be -k^2."""
|
|
34
|
-
k = 0.1
|
|
35
|
-
# Use near-zero impact parameter (i ~ 90 deg)
|
|
36
|
-
inc = np.radians(89.99)
|
|
37
|
-
times = jnp.array([0.0])
|
|
38
|
-
flux = np.asarray(jax_uniform(times, k, T0, P, A, inc, E, W))
|
|
39
|
-
np.testing.assert_allclose(flux[0], -k**2, atol=1e-6)
|
|
40
|
-
|
|
41
|
-
@pytest.mark.parametrize("k", [0.05, 0.1, 0.15])
|
|
42
|
-
def test_out_of_transit_is_zero(self, k):
|
|
43
|
-
"""Far from transit, flux deviation should be zero."""
|
|
44
|
-
times = jnp.array([0.5, 1.0, -0.5])
|
|
45
|
-
flux = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
|
|
46
|
-
np.testing.assert_allclose(flux, 0.0, atol=1e-12)
|
|
47
|
-
|
|
48
|
-
def test_transit_is_symmetric(self):
|
|
49
|
-
"""Transit light curve should be symmetric about t0 for circular orbit."""
|
|
50
|
-
k = 0.1
|
|
51
|
-
times = jnp.linspace(-0.1, 0.1, 201)
|
|
52
|
-
flux = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
|
|
53
|
-
np.testing.assert_allclose(flux, flux[::-1], atol=5e-7)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class TestJIT:
|
|
57
|
-
"""Model should work under jax.jit."""
|
|
58
|
-
|
|
59
|
-
def test_jit_produces_correct_results(self):
|
|
60
|
-
k = 0.1
|
|
61
|
-
times = jnp.array(TIMES)
|
|
62
|
-
flux_eager = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
|
|
63
|
-
flux_jit = np.asarray(jax.jit(jax_uniform)(times, k, T0, P, A, I, E, W))
|
|
64
|
-
np.testing.assert_allclose(flux_jit, flux_eager, atol=1e-6)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class TestGradients:
|
|
68
|
-
"""jax.value_and_grad should return finite gradients."""
|
|
69
|
-
|
|
70
|
-
def test_grad_wrt_k(self):
|
|
71
|
-
def loss(k):
|
|
72
|
-
return jnp.sum(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
|
|
73
|
-
|
|
74
|
-
val, grad = jax.value_and_grad(loss)(0.1)
|
|
75
|
-
assert jnp.isfinite(val)
|
|
76
|
-
assert jnp.isfinite(grad)
|
|
77
|
-
assert grad != 0.0 # k definitely affects the flux
|
|
78
|
-
|
|
79
|
-
def test_grad_wrt_all_params(self):
|
|
80
|
-
def loss(k, t0, p, a, inc, e, w):
|
|
81
|
-
return jnp.sum(jax_uniform(jnp.array(TIMES), k, t0, p, a, inc, e, w))
|
|
82
|
-
|
|
83
|
-
argnums = tuple(range(7))
|
|
84
|
-
val, grads = jax.value_and_grad(loss, argnums=argnums)(0.1, T0, P, A, I, E, W)
|
|
85
|
-
assert jnp.isfinite(val)
|
|
86
|
-
for j, g in enumerate(grads):
|
|
87
|
-
assert jnp.isfinite(g), f"Non-finite gradient for argnum {j}: {g}"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
class TestEdgeCases:
|
|
91
|
-
"""Edge cases: grazing transit, full containment, no overlap."""
|
|
92
|
-
|
|
93
|
-
def test_no_transit(self):
|
|
94
|
-
"""Large impact parameter — planet never overlaps the star."""
|
|
95
|
-
inc_no_transit = np.radians(60.0)
|
|
96
|
-
flux = np.asarray(jax_uniform(jnp.array(TIMES), 0.1, T0, P, A, inc_no_transit, E, W))
|
|
97
|
-
np.testing.assert_allclose(flux, 0.0, atol=1e-12)
|
|
98
|
-
|
|
99
|
-
def test_grazing_transit(self):
|
|
100
|
-
"""Planet barely grazes the stellar disk."""
|
|
101
|
-
k = 0.1
|
|
102
|
-
b_grazing = 0.95
|
|
103
|
-
inc_graze = np.arccos(b_grazing / A)
|
|
104
|
-
flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, inc_graze, E, W))
|
|
105
|
-
# Should have some negative flux values (transit dip)
|
|
106
|
-
assert np.min(flux) < 0.0
|
|
107
|
-
# But much shallower than full transit
|
|
108
|
-
full_flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
|
|
109
|
-
assert np.min(flux) > np.min(full_flux)
|
|
110
|
-
|
|
111
|
-
def test_full_containment(self):
|
|
112
|
-
"""Planet fully inside the stellar disk at mid-transit."""
|
|
113
|
-
k = 0.1
|
|
114
|
-
flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
|
|
115
|
-
# At mid-transit, flux deviation should be -k^2
|
|
116
|
-
mid_idx = len(TIMES) // 2
|
|
117
|
-
np.testing.assert_allclose(flux[mid_idx], -k**2, atol=1e-6)
|
|
118
|
-
|
|
119
|
-
def test_eccentric_orbit(self):
|
|
120
|
-
"""Eccentric orbit should still produce valid transit."""
|
|
121
|
-
k, e = 0.1, 0.3
|
|
122
|
-
flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, e, W))
|
|
123
|
-
# Should have a transit dip
|
|
124
|
-
assert np.min(flux) < 0.0
|
|
125
|
-
# Out-of-transit should be zero
|
|
126
|
-
assert flux[0] == 0.0 or abs(flux[0]) < 1e-10
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
class TestCustomJVP:
|
|
130
|
-
"""Validate custom JVP derivatives against finite differences."""
|
|
131
|
-
|
|
132
|
-
PARAM_NAMES = ["k", "t0", "p", "a", "i", "e", "w"]
|
|
133
|
-
|
|
134
|
-
@staticmethod
|
|
135
|
-
def _finite_diff_grad(times, params, idx, eps=1e-6):
|
|
136
|
-
"""Central finite-difference gradient w.r.t. params[idx]."""
|
|
137
|
-
p_plus = list(params)
|
|
138
|
-
p_minus = list(params)
|
|
139
|
-
p_plus[idx] = params[idx] + eps
|
|
140
|
-
p_minus[idx] = params[idx] - eps
|
|
141
|
-
f_plus = jax_uniform(times, *p_plus)
|
|
142
|
-
f_minus = jax_uniform(times, *p_minus)
|
|
143
|
-
return (f_plus - f_minus) / (2 * eps)
|
|
144
|
-
|
|
145
|
-
@pytest.mark.parametrize("idx", range(7))
|
|
146
|
-
def test_circular_orbit_jacobian(self, idx):
|
|
147
|
-
"""Custom JVP matches finite differences for circular orbit."""
|
|
148
|
-
times = jnp.linspace(-0.08, 0.08, 50)
|
|
149
|
-
params = [0.1, T0, P, A, I, 0.0, W]
|
|
150
|
-
|
|
151
|
-
# JAX Jacobian via the custom JVP
|
|
152
|
-
def model_wrapper(*args):
|
|
153
|
-
return jax_uniform(times, *args)
|
|
154
|
-
|
|
155
|
-
jac_jax = jax.jacobian(model_wrapper, argnums=idx)(*[jnp.float64(v) for v in params])
|
|
156
|
-
jac_fd = self._finite_diff_grad(times, params, idx)
|
|
157
|
-
|
|
158
|
-
np.testing.assert_allclose(
|
|
159
|
-
np.asarray(jac_jax), np.asarray(jac_fd), atol=1e-4, rtol=1e-3,
|
|
160
|
-
err_msg=f"Jacobian mismatch for {self.PARAM_NAMES[idx]} (circular)"
|
|
161
|
-
)
|
|
162
|
-
|
|
163
|
-
@pytest.mark.parametrize("idx", range(7))
|
|
164
|
-
def test_eccentric_orbit_jacobian(self, idx):
|
|
165
|
-
"""Custom JVP matches finite differences for eccentric orbit."""
|
|
166
|
-
times = jnp.linspace(-0.08, 0.08, 50)
|
|
167
|
-
params = [0.1, T0, P, A, I, 0.3, W]
|
|
168
|
-
|
|
169
|
-
def model_wrapper(*args):
|
|
170
|
-
return jax_uniform(times, *args)
|
|
171
|
-
|
|
172
|
-
jac_jax = jax.jacobian(model_wrapper, argnums=idx)(*[jnp.float64(v) for v in params])
|
|
173
|
-
jac_fd = self._finite_diff_grad(times, params, idx)
|
|
174
|
-
|
|
175
|
-
np.testing.assert_allclose(
|
|
176
|
-
np.asarray(jac_jax), np.asarray(jac_fd), atol=1e-4, rtol=1e-3,
|
|
177
|
-
err_msg=f"Jacobian mismatch for {self.PARAM_NAMES[idx]} (eccentric)"
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
def test_all_gradients_finite_and_nonzero(self):
|
|
181
|
-
"""All 7 partial derivatives should be finite; most should be nonzero."""
|
|
182
|
-
times = jnp.linspace(-0.08, 0.08, 50)
|
|
183
|
-
|
|
184
|
-
def loss(*args):
|
|
185
|
-
return jnp.sum(jax_uniform(times, *args))
|
|
186
|
-
|
|
187
|
-
params = [jnp.float64(v) for v in [0.1, T0, P, A, I, 0.0, W]]
|
|
188
|
-
val, grads = jax.value_and_grad(loss, argnums=tuple(range(7)))(*params)
|
|
189
|
-
|
|
190
|
-
assert jnp.isfinite(val)
|
|
191
|
-
for j, g in enumerate(grads):
|
|
192
|
-
assert jnp.isfinite(g), f"Non-finite grad for {self.PARAM_NAMES[j]}: {g}"
|
|
193
|
-
|
|
194
|
-
# k, a, i definitely affect transit depth
|
|
195
|
-
for j in [0, 3, 4]:
|
|
196
|
-
assert grads[j] != 0.0, f"Zero grad for {self.PARAM_NAMES[j]}"
|