PyTransit 2.6.18__tar.gz → 2.7.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.
Files changed (151) hide show
  1. {pytransit-2.6.18 → pytransit-2.7.0}/PKG-INFO +2 -2
  2. {pytransit-2.6.18 → pytransit-2.7.0}/PyTransit.egg-info/PKG-INFO +2 -2
  3. {pytransit-2.6.18 → pytransit-2.7.0}/PyTransit.egg-info/SOURCES.txt +4 -0
  4. {pytransit-2.6.18 → pytransit-2.7.0}/PyTransit.egg-info/requires.txt +1 -1
  5. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/__init__.py +2 -2
  6. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/__init__.py +3 -1
  7. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ldmodel.py +2 -2
  8. pytransit-2.7.0/pytransit/models/roadrunner/esmodel.py +88 -0
  9. pytransit-2.7.0/pytransit/models/roadrunner/model_ecspec.py +60 -0
  10. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/rrmodel_cl.py +2 -2
  11. {pytransit-2.6.18 → pytransit-2.7.0}/requirements.txt +1 -1
  12. pytransit-2.7.0/tests/test_jax_uniformdisk.py +195 -0
  13. pytransit-2.7.0/tests/test_limb_darkening.py +254 -0
  14. {pytransit-2.6.18 → pytransit-2.7.0}/LICENSE +0 -0
  15. {pytransit-2.6.18 → pytransit-2.7.0}/MANIFEST.in +0 -0
  16. {pytransit-2.6.18 → pytransit-2.7.0}/PyTransit.egg-info/dependency_links.txt +0 -0
  17. {pytransit-2.6.18 → pytransit-2.7.0}/PyTransit.egg-info/top_level.txt +0 -0
  18. {pytransit-2.6.18 → pytransit-2.7.0}/README.md +0 -0
  19. {pytransit-2.6.18 → pytransit-2.7.0}/pyproject.toml +0 -0
  20. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/__init__.py +0 -0
  21. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/contamination.py +0 -0
  22. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/data/spectra.h5 +0 -0
  23. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/data/transmission.nc +0 -0
  24. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/filter.py +0 -0
  25. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/instrument.py +0 -0
  26. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/contamination/plotting.py +0 -0
  27. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/limb_darkening.py +0 -0
  28. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/__init__.py +0 -0
  29. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/baselines/__init__.py +0 -0
  30. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/baselines/legendrebaseline.py +0 -0
  31. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/baselines/linearbaseline.py +0 -0
  32. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/cntlpf.py +0 -0
  33. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/eclipselpf.py +0 -0
  34. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/__init__.py +0 -0
  35. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/celeriteloglikelihood.py +0 -0
  36. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/clloglikelihood.py +0 -0
  37. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/fmcloglikelihood.py +0 -0
  38. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/logisticloglikelihood.py +0 -0
  39. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/multiceleriteloglikelihood.py +0 -0
  40. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/loglikelihood/wnloglikelihood.py +0 -0
  41. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/logposteriorfunction.py +0 -0
  42. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/lpf.py +0 -0
  43. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/mclpf.py +0 -0
  44. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/mptlpf.py +0 -0
  45. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/ocllpf.py +0 -0
  46. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/ocltdvlpf.py +0 -0
  47. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/oclttvlpf.py +0 -0
  48. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/phasecurvelpf.py +0 -0
  49. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/rvlpf.py +0 -0
  50. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tdvlpf.py +0 -0
  51. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/__init__.py +0 -0
  52. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/ctesslpf.py +0 -0
  53. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/tessttvlpf.py +0 -0
  54. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/tgclpf.py +0 -0
  55. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/tgcmplpf.py +0 -0
  56. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tess/tmpclpf.py +0 -0
  57. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tesslpf.py +0 -0
  58. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/tessoclttvlpf.py +0 -0
  59. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/transitanalysis.py +0 -0
  60. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/transitlpf.py +0 -0
  61. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/lpf/ttvlpf.py +0 -0
  62. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/eclipse_model.py +0 -0
  63. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/gdmodel.py +0 -0
  64. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/general.py +0 -0
  65. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ldtkldm.py +0 -0
  66. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/__init__.py +0 -0
  67. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/general.py +0 -0
  68. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/linear.py +0 -0
  69. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/nonlinear.py +0 -0
  70. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/power_2.py +0 -0
  71. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/quadratic.py +0 -0
  72. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/quadratic_tri.py +0 -0
  73. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/limb_darkening/uniform.py +0 -0
  74. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ma_chromosphere.py +0 -0
  75. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ma_quadratic.py +0 -0
  76. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ma_quadratic_cl.py +0 -0
  77. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ma_uniform.py +0 -0
  78. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/ma_uniform_cl.py +0 -0
  79. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/__init__.py +0 -0
  80. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/gdmodel.py +0 -0
  81. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/general_nb.py +0 -0
  82. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/ldmodels.py +0 -0
  83. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/ldtkldm.py +0 -0
  84. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/ma_chromosphere_nb.py +0 -0
  85. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/ma_quadratic_nb.py +0 -0
  86. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/ma_uniform_nb.py +0 -0
  87. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/phasecurves.py +0 -0
  88. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/qpower2_nb.py +0 -0
  89. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/rrmodel.py +0 -0
  90. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/spmodel.py +0 -0
  91. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/numba/udmodel.py +0 -0
  92. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/opencl/ma_quadratic.cl +0 -0
  93. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/opencl/ma_uniform.cl +0 -0
  94. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/opencl/orbits.cl +0 -0
  95. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/opencl/qpower2.cl +0 -0
  96. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/osmodel.py +0 -0
  97. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/qpower2.py +0 -0
  98. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/qpower2_cl.py +0 -0
  99. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/__init__.py +0 -0
  100. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/common.py +0 -0
  101. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/ecintersection.py +0 -0
  102. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/model.py +0 -0
  103. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/model_full.py +0 -0
  104. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/model_simple.py +0 -0
  105. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/model_trspec.py +0 -0
  106. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/opmodel.py +0 -0
  107. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/opmodel_full.py +0 -0
  108. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/rrmodel.cl +0 -0
  109. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/rrmodel.py +0 -0
  110. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/roadrunner/tsmodel.py +0 -0
  111. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/transitmodel.py +0 -0
  112. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/models/uniform.py +0 -0
  113. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/orbits/__init__.py +0 -0
  114. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/orbits/orbits.py +0 -0
  115. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/orbits/orbits_py.py +0 -0
  116. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/orbits/taylor_z.py +0 -0
  117. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/param/__init__.py +0 -0
  118. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/param/parameter.py +0 -0
  119. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/param/prior.py +0 -0
  120. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/param/utilities.py +0 -0
  121. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/stars/__init__.py +0 -0
  122. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/stars/btsettl.py +0 -0
  123. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/stars/data/avg_bt_settl.fits +0 -0
  124. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/stars/data/avg_husser2013.fits +0 -0
  125. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/stars/husser2013.py +0 -0
  126. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/__init__.py +0 -0
  127. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/astrometry.py +0 -0
  128. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/constants.py +0 -0
  129. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/de.py +0 -0
  130. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/downsample.py +0 -0
  131. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/eclipses.py +0 -0
  132. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/io/__init__.py +0 -0
  133. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/io/lightcurvedata.py +0 -0
  134. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/keplerlc.py +0 -0
  135. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/mdwarfs.py +0 -0
  136. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/misc.py +0 -0
  137. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/mocklc.py +0 -0
  138. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/octasphere.py +0 -0
  139. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/phasecurves.py +0 -0
  140. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/physics.py +0 -0
  141. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/rv.py +0 -0
  142. {pytransit-2.6.18 → pytransit-2.7.0}/pytransit/utils/tess.py +0 -0
  143. {pytransit-2.6.18 → pytransit-2.7.0}/setup.cfg +0 -0
  144. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_contamination.py +0 -0
  145. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_ma_quadratic.py +0 -0
  146. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_ma_quadratic_nb.py +0 -0
  147. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_qpower2_nb.py +0 -0
  148. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_transitmodel_helpers.py +0 -0
  149. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_uniform_model.py +0 -0
  150. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_uniform_model_nb.py +0 -0
  151. {pytransit-2.6.18 → pytransit-2.7.0}/tests/test_z.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.18
3
+ Version: 2.7.0
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -17,7 +17,7 @@ Requires-Python: >=3.10
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: arviz
20
- Requires-Dist: numpy
20
+ Requires-Dist: numpy>=2.0.0
21
21
  Requires-Dist: scipy
22
22
  Requires-Dist: pandas
23
23
  Requires-Dist: xarray
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.18
3
+ Version: 2.7.0
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -17,7 +17,7 @@ Requires-Python: >=3.10
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE
19
19
  Requires-Dist: arviz
20
- Requires-Dist: numpy
20
+ Requires-Dist: numpy>=2.0.0
21
21
  Requires-Dist: scipy
22
22
  Requires-Dist: pandas
23
23
  Requires-Dist: xarray
@@ -95,7 +95,9 @@ pytransit/models/opencl/qpower2.cl
95
95
  pytransit/models/roadrunner/__init__.py
96
96
  pytransit/models/roadrunner/common.py
97
97
  pytransit/models/roadrunner/ecintersection.py
98
+ pytransit/models/roadrunner/esmodel.py
98
99
  pytransit/models/roadrunner/model.py
100
+ pytransit/models/roadrunner/model_ecspec.py
99
101
  pytransit/models/roadrunner/model_full.py
100
102
  pytransit/models/roadrunner/model_simple.py
101
103
  pytransit/models/roadrunner/model_trspec.py
@@ -136,6 +138,8 @@ pytransit/utils/tess.py
136
138
  pytransit/utils/io/__init__.py
137
139
  pytransit/utils/io/lightcurvedata.py
138
140
  tests/test_contamination.py
141
+ tests/test_jax_uniformdisk.py
142
+ tests/test_limb_darkening.py
139
143
  tests/test_ma_quadratic.py
140
144
  tests/test_ma_quadratic_nb.py
141
145
  tests/test_qpower2_nb.py
@@ -1,5 +1,5 @@
1
1
  arviz
2
- numpy
2
+ numpy>=2.0.0
3
3
  scipy
4
4
  pandas
5
5
  xarray
@@ -41,7 +41,7 @@ Date
41
41
 
42
42
  """
43
43
 
44
- __version__ = '2.6.18'
44
+ __version__ = '2.7.0'
45
45
 
46
46
  # Generic
47
47
  # -------
@@ -59,7 +59,7 @@ from .models.general import GeneralModel
59
59
  from .models.osmodel import OblateStarModel
60
60
  from .models.gdmodel import GravityDarkenedModel
61
61
 
62
- from .models import RoadRunnerModel, OblatePlanetModel, TransmissionSpectroscopyModel
62
+ from .models import RoadRunnerModel, OblatePlanetModel, TransmissionSpectroscopyModel, EclipseSpectroscopyModel, ESModel
63
63
 
64
64
  TSModel = TransmissionSpectroscopyModel
65
65
  OPModel = OblatePlanetModel
@@ -14,11 +14,13 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
 
17
- from .transitmodel import TransitModel
17
+ from .transitmodel import TransitModel # noqa
18
18
  from .roadrunner.rrmodel import RoadRunnerModel
19
19
  from .roadrunner.opmodel import OblatePlanetModel
20
20
  from .roadrunner.tsmodel import TransmissionSpectroscopyModel
21
+ from .roadrunner.esmodel import EclipseSpectroscopyModel
21
22
 
22
23
  RRModel = RoadRunnerModel
23
24
  OPModel = OblatePlanetModel
24
25
  TSModel = TransmissionSpectroscopyModel
26
+ ESModel = EclipseSpectroscopyModel
@@ -15,7 +15,7 @@
15
15
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
 
17
17
  from typing import Tuple
18
- from numpy import linspace, trapz, sqrt, ndarray, zeros, pi
18
+ from numpy import linspace, trapezoid, sqrt, ndarray, zeros, pi
19
19
 
20
20
 
21
21
  class LDModel:
@@ -35,5 +35,5 @@ class LDModel:
35
35
  ldi = zeros((npv, npb))
36
36
  for ipv in range(npv):
37
37
  for ipb in range(npb):
38
- ldi[ipv,ipb] = 2. * pi * trapz(self._int_z * self._evaluate(self._int_mu, x), self._int_z)
38
+ ldi[ipv,ipb] = 2. * pi * trapezoid(self._int_z * self._evaluate(self._int_mu, x), self._int_z)
39
39
  return ldi
@@ -0,0 +1,88 @@
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
+ # This program is free software: you can redistribute it and/or modify
18
+ # it under the terms of the GNU General Public License as published by
19
+ # the Free Software Foundation, either version 3 of the License, or
20
+ # (at your option) any later version.
21
+ #
22
+ # This program is distributed in the hope that it will be useful,
23
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ # GNU General Public License for more details.
26
+ #
27
+ # You should have received a copy of the GNU General Public License
28
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
29
+ from typing import Union, List, Optional
30
+
31
+ from numpy import ndarray, atleast_1d
32
+ from numba import njit
33
+
34
+ from ..transitmodel import TransitModel
35
+ from .model_ecspec import esmodel
36
+
37
+ __all__ = ['EclipseSpectroscopyModel']
38
+
39
+
40
+ class EclipseSpectroscopyModel(TransitModel):
41
+
42
+ def __init__(self, parallel: bool = False):
43
+ self.parallel = parallel
44
+ self.model = njit(parallel=parallel, fastmath=False)(esmodel)
45
+ super().__init__()
46
+
47
+ def evaluate(self, f: ndarray, k: Union[float, ndarray], t0: Union[float, ndarray], p: Union[float, ndarray],
48
+ a: Union[float, ndarray], i: Union[float, ndarray], e: Union[float, ndarray] = 0.0,
49
+ w: Union[float, ndarray] = 0.0) -> ndarray:
50
+ """Evaluate the transit model for a set of scalar or vector parameters.
51
+
52
+ Parameters
53
+ ----------
54
+ f
55
+ Flux ratios either as a 1D vector or 2D array
56
+ k
57
+ Radius ratio either as a single float or a 1D vector.
58
+ t0
59
+ Transit center(s) as a float or a 1D vector.
60
+ p
61
+ Orbital period(s) as a float or a 1D vector.
62
+ a
63
+ Orbital semi-major axis (axes) divided by the stellar radius as a float or a 1D vector.
64
+ i
65
+ Orbital inclination(s) as a float or a 1D vector.
66
+ e : optional
67
+ Orbital eccentricity as a float or a 1D vector.
68
+ w : optional
69
+ Argument of periastron as a float or a 1D vector.
70
+
71
+ Notes
72
+ -----
73
+ The model can be evaluated either for one set of parameters or for many sets of parameters simultaneously. In
74
+ the first case, the orbital parameters should all be given as floats. In the second case, the orbital parameters
75
+ should be given as a 1D array-like.
76
+
77
+ Returns
78
+ -------
79
+ ndarray
80
+ Modelled flux either as a 3D ndarray.
81
+ """
82
+ k, t0, p, a, i, e, w = map(atleast_1d, (k, t0, p, a, i, e, w))
83
+ return self.model(self.time, k, t0, p, a, i, e, w, f, self.nsamples[0], self.exptimes[0])
84
+
85
+ def __call__(self, f: ndarray, k: Union[float, ndarray], t0: Union[float, ndarray], p: Union[float, ndarray],
86
+ a: Union[float, ndarray], i: Union[float, ndarray], e: Union[float, ndarray] = 0.0,
87
+ w: Union[float, ndarray] = 0.0) -> ndarray:
88
+ return self.evaluate(f, k, t0, p, a, i, e, w)
@@ -0,0 +1,60 @@
1
+ from math import fabs, floor
2
+
3
+ from meepmeep.utils import d_from_pkaiews, eclipse_phase
4
+ from meepmeep.xy.position import solve_xy_p5s, pd_t15sc
5
+ from numpy import zeros, ndarray, isnan, nan, pi
6
+
7
+ from .common import circle_circle_intersection_area_kite as ccia
8
+
9
+ __all__ = ['esmodel']
10
+
11
+
12
+ def esmodel(times: ndarray, k: ndarray, t0: ndarray, p: ndarray, a: ndarray, i: ndarray, e: ndarray, w: ndarray,
13
+ fratio: ndarray, nsamples: int, exptime: float) -> ndarray:
14
+ if k.ndim != 1:
15
+ raise ValueError(" The radius ratio must be given as an 1D array with shape (npv)")
16
+
17
+ if fratio.ndim != 2:
18
+ raise ValueError(" The flux ratio must be given as a 2D array with shape (npv, npb)")
19
+
20
+ npt = times.size
21
+ npv = fratio.shape[0]
22
+ npb = fratio.shape[1]
23
+
24
+ flux = zeros((npv, npb, npt)) # Model flux
25
+ xyc = zeros((2, 5)) # Taylor series coefficients for the (x, y) position
26
+
27
+ for ipv in range(npv):
28
+ if isnan(a[ipv]) or (a[ipv] <= 1.0) or (e[ipv] < 0.0):
29
+ flux[ipv, :, :] = nan
30
+ continue
31
+
32
+ # -----------------------------------------------------#
33
+ # Calculate the Taylor series expansions for the orbit #
34
+ # -----------------------------------------------------#
35
+ eclipse_shift = eclipse_phase(p[ipv], i[ipv], e[ipv], w[ipv])
36
+ xyc[:, :] = solve_xy_p5s(eclipse_shift, p[ipv], a[ipv], i[ipv], e[ipv], w[ipv])
37
+ te = t0[ipv] + eclipse_shift
38
+
39
+ # --------------------------------#
40
+ # Calculate the half-window width #
41
+ # --------------------------------#
42
+ hww = 0.5 * d_from_pkaiews(p[ipv], k[ipv], a[ipv], i[ipv], e[ipv], w[ipv], -1, 14)
43
+ hww = 0.0015 + exptime + hww
44
+
45
+ # --------------------------#
46
+ # Calculate the light curve #
47
+ # --------------------------#
48
+ for ipt in range(npt):
49
+ epoch = floor((times[ipt] - te + 0.5 * p[ipv]) / p[ipv])
50
+ tc = times[ipt] - (te + epoch * p[ipv])
51
+ if fabs(tc) > hww:
52
+ flux[ipv, :, ipt] = 1.0
53
+ else:
54
+ for isample in range(1, nsamples + 1):
55
+ time_offset = exptime * ((isample - 0.5) / nsamples - 0.5)
56
+ z = pd_t15sc(tc + time_offset, xyc)
57
+ flux[ipv, :, ipt] += 1.0 - (fratio[ipv, :] * ccia(1.0, k[ipv], z)[0] / pi) / (
58
+ 1.0 + fratio[ipv, :] * k[ipv] ** 2)
59
+ flux[ipv, :, ipt] /= nsamples
60
+ return flux
@@ -23,7 +23,7 @@ import warnings
23
23
  from pyopencl import CompilerWarning
24
24
 
25
25
  from numpy import array, uint32, float32, int32, asarray, zeros, ones, unique, atleast_2d, squeeze, ndarray, \
26
- concatenate, empty, linspace, diff, trapz
26
+ concatenate, empty, linspace, diff, trapezoid
27
27
  from ..ldmodel import LDModel
28
28
 
29
29
  from .common import create_z_grid
@@ -344,7 +344,7 @@ class RoadRunnerModelCL(TransitModel):
344
344
  ldpi = evaluate_ld(self.ldmodel, self._ldmu, ldc)
345
345
  for ipv in range(self.npv):
346
346
  for ipb in range(self.npb):
347
- istar[ipv, ipb] = 2 * pi * trapz(self._ldz * ldpi[ipv,ipb], self._ldz)
347
+ istar[ipv, ipb] = 2 * pi * trapezoid(self._ldz * ldpi[ipv,ipb], self._ldz)
348
348
 
349
349
  # Copy the limb darkening profiles and their integrals to the GPU
350
350
  cl.enqueue_copy(self.queue, self._b_ldp, ldp.astype('float32'))
@@ -1,5 +1,5 @@
1
1
  arviz
2
- numpy
2
+ numpy >= 2.0.0
3
3
  scipy
4
4
  pandas
5
5
  xarray
@@ -0,0 +1,195 @@
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
+ from pytransit.backends.jax.uniformdisk import uniform_model as jax_uniform
17
+
18
+ # Shared orbital parameters for a typical hot Jupiter transit
19
+ T0 = 0.0
20
+ P = 2.5
21
+ A = 8.0
22
+ I = np.radians(87.0)
23
+ E = 0.0
24
+ W = 0.5 * np.pi
25
+ TIMES = np.linspace(-0.15, 0.15, 300)
26
+
27
+
28
+ class TestAnalytical:
29
+ """Check against known analytical results."""
30
+
31
+ def test_mid_transit_depth(self):
32
+ """At mid-transit with b~0, flux deviation should be -k^2."""
33
+ k = 0.1
34
+ # Use near-zero impact parameter (i ~ 90 deg)
35
+ inc = np.radians(89.99)
36
+ times = jnp.array([0.0])
37
+ flux = np.asarray(jax_uniform(times, k, T0, P, A, inc, E, W))
38
+ np.testing.assert_allclose(flux[0], -k**2, atol=1e-6)
39
+
40
+ @pytest.mark.parametrize("k", [0.05, 0.1, 0.15])
41
+ def test_out_of_transit_is_zero(self, k):
42
+ """Far from transit, flux deviation should be zero."""
43
+ times = jnp.array([0.5, 1.0, -0.5])
44
+ flux = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
45
+ np.testing.assert_allclose(flux, 0.0, atol=1e-12)
46
+
47
+ def test_transit_is_symmetric(self):
48
+ """Transit light curve should be symmetric about t0 for circular orbit."""
49
+ k = 0.1
50
+ times = jnp.linspace(-0.1, 0.1, 201)
51
+ flux = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
52
+ np.testing.assert_allclose(flux, flux[::-1], atol=5e-7)
53
+
54
+
55
+ class TestJIT:
56
+ """Model should work under jax.jit."""
57
+
58
+ def test_jit_produces_correct_results(self):
59
+ k = 0.1
60
+ times = jnp.array(TIMES)
61
+ flux_eager = np.asarray(jax_uniform(times, k, T0, P, A, I, E, W))
62
+ flux_jit = np.asarray(jax.jit(jax_uniform)(times, k, T0, P, A, I, E, W))
63
+ np.testing.assert_allclose(flux_jit, flux_eager, atol=1e-6)
64
+
65
+
66
+ class TestGradients:
67
+ """jax.value_and_grad should return finite gradients."""
68
+
69
+ def test_grad_wrt_k(self):
70
+ def loss(k):
71
+ return jnp.sum(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
72
+
73
+ val, grad = jax.value_and_grad(loss)(0.1)
74
+ assert jnp.isfinite(val)
75
+ assert jnp.isfinite(grad)
76
+ assert grad != 0.0 # k definitely affects the flux
77
+
78
+ def test_grad_wrt_all_params(self):
79
+ def loss(k, t0, p, a, inc, e, w):
80
+ return jnp.sum(jax_uniform(jnp.array(TIMES), k, t0, p, a, inc, e, w))
81
+
82
+ argnums = tuple(range(7))
83
+ val, grads = jax.value_and_grad(loss, argnums=argnums)(0.1, T0, P, A, I, E, W)
84
+ assert jnp.isfinite(val)
85
+ for j, g in enumerate(grads):
86
+ assert jnp.isfinite(g), f"Non-finite gradient for argnum {j}: {g}"
87
+
88
+
89
+ class TestEdgeCases:
90
+ """Edge cases: grazing transit, full containment, no overlap."""
91
+
92
+ def test_no_transit(self):
93
+ """Large impact parameter — planet never overlaps the star."""
94
+ inc_no_transit = np.radians(60.0)
95
+ flux = np.asarray(jax_uniform(jnp.array(TIMES), 0.1, T0, P, A, inc_no_transit, E, W))
96
+ np.testing.assert_allclose(flux, 0.0, atol=1e-12)
97
+
98
+ def test_grazing_transit(self):
99
+ """Planet barely grazes the stellar disk."""
100
+ k = 0.1
101
+ b_grazing = 0.95
102
+ inc_graze = np.arccos(b_grazing / A)
103
+ flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, inc_graze, E, W))
104
+ # Should have some negative flux values (transit dip)
105
+ assert np.min(flux) < 0.0
106
+ # But much shallower than full transit
107
+ full_flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
108
+ assert np.min(flux) > np.min(full_flux)
109
+
110
+ def test_full_containment(self):
111
+ """Planet fully inside the stellar disk at mid-transit."""
112
+ k = 0.1
113
+ flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, E, W))
114
+ # At mid-transit, flux deviation should be -k^2
115
+ mid_idx = len(TIMES) // 2
116
+ np.testing.assert_allclose(flux[mid_idx], -k**2, atol=1e-6)
117
+
118
+ def test_eccentric_orbit(self):
119
+ """Eccentric orbit should still produce valid transit."""
120
+ k, e = 0.1, 0.3
121
+ flux = np.asarray(jax_uniform(jnp.array(TIMES), k, T0, P, A, I, e, W))
122
+ # Should have a transit dip
123
+ assert np.min(flux) < 0.0
124
+ # Out-of-transit should be zero
125
+ assert flux[0] == 0.0 or abs(flux[0]) < 1e-10
126
+
127
+
128
+ class TestCustomJVP:
129
+ """Validate custom JVP derivatives against finite differences."""
130
+
131
+ PARAM_NAMES = ["k", "t0", "p", "a", "i", "e", "w"]
132
+
133
+ @staticmethod
134
+ def _finite_diff_grad(times, params, idx, eps=1e-6):
135
+ """Central finite-difference gradient w.r.t. params[idx]."""
136
+ p_plus = list(params)
137
+ p_minus = list(params)
138
+ p_plus[idx] = params[idx] + eps
139
+ p_minus[idx] = params[idx] - eps
140
+ f_plus = jax_uniform(times, *p_plus)
141
+ f_minus = jax_uniform(times, *p_minus)
142
+ return (f_plus - f_minus) / (2 * eps)
143
+
144
+ @pytest.mark.parametrize("idx", range(7))
145
+ def test_circular_orbit_jacobian(self, idx):
146
+ """Custom JVP matches finite differences for circular orbit."""
147
+ times = jnp.linspace(-0.08, 0.08, 50)
148
+ params = [0.1, T0, P, A, I, 0.0, W]
149
+
150
+ # JAX Jacobian via the custom JVP
151
+ def model_wrapper(*args):
152
+ return jax_uniform(times, *args)
153
+
154
+ jac_jax = jax.jacobian(model_wrapper, argnums=idx)(*[jnp.float64(v) for v in params])
155
+ jac_fd = self._finite_diff_grad(times, params, idx)
156
+
157
+ np.testing.assert_allclose(
158
+ np.asarray(jac_jax), np.asarray(jac_fd), atol=1e-4, rtol=1e-3,
159
+ err_msg=f"Jacobian mismatch for {self.PARAM_NAMES[idx]} (circular)"
160
+ )
161
+
162
+ @pytest.mark.parametrize("idx", range(7))
163
+ def test_eccentric_orbit_jacobian(self, idx):
164
+ """Custom JVP matches finite differences for eccentric orbit."""
165
+ times = jnp.linspace(-0.08, 0.08, 50)
166
+ params = [0.1, T0, P, A, I, 0.3, W]
167
+
168
+ def model_wrapper(*args):
169
+ return jax_uniform(times, *args)
170
+
171
+ jac_jax = jax.jacobian(model_wrapper, argnums=idx)(*[jnp.float64(v) for v in params])
172
+ jac_fd = self._finite_diff_grad(times, params, idx)
173
+
174
+ np.testing.assert_allclose(
175
+ np.asarray(jac_jax), np.asarray(jac_fd), atol=1e-4, rtol=1e-3,
176
+ err_msg=f"Jacobian mismatch for {self.PARAM_NAMES[idx]} (eccentric)"
177
+ )
178
+
179
+ def test_all_gradients_finite_and_nonzero(self):
180
+ """All 7 partial derivatives should be finite; most should be nonzero."""
181
+ times = jnp.linspace(-0.08, 0.08, 50)
182
+
183
+ def loss(*args):
184
+ return jnp.sum(jax_uniform(times, *args))
185
+
186
+ params = [jnp.float64(v) for v in [0.1, T0, P, A, I, 0.0, W]]
187
+ val, grads = jax.value_and_grad(loss, argnums=tuple(range(7)))(*params)
188
+
189
+ assert jnp.isfinite(val)
190
+ for j, g in enumerate(grads):
191
+ assert jnp.isfinite(g), f"Non-finite grad for {self.PARAM_NAMES[j]}: {g}"
192
+
193
+ # k, a, i definitely affect transit depth
194
+ for j in [0, 3, 4]:
195
+ assert grads[j] != 0.0, f"Zero grad for {self.PARAM_NAMES[j]}"