PyTransit 2.6.19__tar.gz → 2.7.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.
Files changed (153) hide show
  1. {pytransit-2.6.19 → pytransit-2.7.1}/PKG-INFO +1 -1
  2. {pytransit-2.6.19 → pytransit-2.7.1}/PyTransit.egg-info/PKG-INFO +1 -1
  3. {pytransit-2.6.19 → pytransit-2.7.1}/PyTransit.egg-info/SOURCES.txt +4 -0
  4. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/__init__.py +2 -2
  5. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/rvlpf.py +30 -15
  6. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/__init__.py +3 -1
  7. pytransit-2.7.1/pytransit/models/roadrunner/esmodel.py +93 -0
  8. pytransit-2.7.1/pytransit/models/roadrunner/model_eclipse.py +83 -0
  9. pytransit-2.7.1/pytransit/models/roadrunner/model_ecspec.py +62 -0
  10. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/model_full.py +3 -4
  11. pytransit-2.7.1/tests/test_roadrunner_eclipse.py +61 -0
  12. {pytransit-2.6.19 → pytransit-2.7.1}/LICENSE +0 -0
  13. {pytransit-2.6.19 → pytransit-2.7.1}/MANIFEST.in +0 -0
  14. {pytransit-2.6.19 → pytransit-2.7.1}/PyTransit.egg-info/dependency_links.txt +0 -0
  15. {pytransit-2.6.19 → pytransit-2.7.1}/PyTransit.egg-info/requires.txt +0 -0
  16. {pytransit-2.6.19 → pytransit-2.7.1}/PyTransit.egg-info/top_level.txt +0 -0
  17. {pytransit-2.6.19 → pytransit-2.7.1}/README.md +0 -0
  18. {pytransit-2.6.19 → pytransit-2.7.1}/pyproject.toml +0 -0
  19. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/__init__.py +0 -0
  20. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/contamination.py +0 -0
  21. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/data/spectra.h5 +0 -0
  22. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/data/transmission.nc +0 -0
  23. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/filter.py +0 -0
  24. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/instrument.py +0 -0
  25. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/contamination/plotting.py +0 -0
  26. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/limb_darkening.py +0 -0
  27. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/__init__.py +0 -0
  28. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/baselines/__init__.py +0 -0
  29. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/baselines/legendrebaseline.py +0 -0
  30. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/baselines/linearbaseline.py +0 -0
  31. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/cntlpf.py +0 -0
  32. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/eclipselpf.py +0 -0
  33. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/__init__.py +0 -0
  34. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/celeriteloglikelihood.py +0 -0
  35. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/clloglikelihood.py +0 -0
  36. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/fmcloglikelihood.py +0 -0
  37. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/logisticloglikelihood.py +0 -0
  38. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/multiceleriteloglikelihood.py +0 -0
  39. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/loglikelihood/wnloglikelihood.py +0 -0
  40. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/logposteriorfunction.py +0 -0
  41. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/lpf.py +0 -0
  42. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/mclpf.py +0 -0
  43. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/mptlpf.py +0 -0
  44. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/ocllpf.py +0 -0
  45. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/ocltdvlpf.py +0 -0
  46. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/oclttvlpf.py +0 -0
  47. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/phasecurvelpf.py +0 -0
  48. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tdvlpf.py +0 -0
  49. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/__init__.py +0 -0
  50. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/ctesslpf.py +0 -0
  51. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/tessttvlpf.py +0 -0
  52. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/tgclpf.py +0 -0
  53. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/tgcmplpf.py +0 -0
  54. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tess/tmpclpf.py +0 -0
  55. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tesslpf.py +0 -0
  56. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/tessoclttvlpf.py +0 -0
  57. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/transitanalysis.py +0 -0
  58. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/transitlpf.py +0 -0
  59. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/lpf/ttvlpf.py +0 -0
  60. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/eclipse_model.py +0 -0
  61. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/gdmodel.py +0 -0
  62. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/general.py +0 -0
  63. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ldmodel.py +0 -0
  64. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ldtkldm.py +0 -0
  65. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/__init__.py +0 -0
  66. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/general.py +0 -0
  67. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/linear.py +0 -0
  68. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/nonlinear.py +0 -0
  69. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/power_2.py +0 -0
  70. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/quadratic.py +0 -0
  71. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/quadratic_tri.py +0 -0
  72. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/limb_darkening/uniform.py +0 -0
  73. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ma_chromosphere.py +0 -0
  74. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ma_quadratic.py +0 -0
  75. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ma_quadratic_cl.py +0 -0
  76. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ma_uniform.py +0 -0
  77. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/ma_uniform_cl.py +0 -0
  78. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/__init__.py +0 -0
  79. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/gdmodel.py +0 -0
  80. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/general_nb.py +0 -0
  81. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/ldmodels.py +0 -0
  82. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/ldtkldm.py +0 -0
  83. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/ma_chromosphere_nb.py +0 -0
  84. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/ma_quadratic_nb.py +0 -0
  85. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/ma_uniform_nb.py +0 -0
  86. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/phasecurves.py +0 -0
  87. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/qpower2_nb.py +0 -0
  88. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/rrmodel.py +0 -0
  89. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/spmodel.py +0 -0
  90. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/numba/udmodel.py +0 -0
  91. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/opencl/ma_quadratic.cl +0 -0
  92. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/opencl/ma_uniform.cl +0 -0
  93. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/opencl/orbits.cl +0 -0
  94. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/opencl/qpower2.cl +0 -0
  95. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/osmodel.py +0 -0
  96. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/qpower2.py +0 -0
  97. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/qpower2_cl.py +0 -0
  98. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/__init__.py +0 -0
  99. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/common.py +0 -0
  100. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/ecintersection.py +0 -0
  101. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/model.py +0 -0
  102. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/model_simple.py +0 -0
  103. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/model_trspec.py +0 -0
  104. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/opmodel.py +0 -0
  105. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/opmodel_full.py +0 -0
  106. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/rrmodel.cl +0 -0
  107. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/rrmodel.py +0 -0
  108. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/rrmodel_cl.py +0 -0
  109. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/roadrunner/tsmodel.py +0 -0
  110. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/transitmodel.py +0 -0
  111. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/models/uniform.py +0 -0
  112. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/orbits/__init__.py +0 -0
  113. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/orbits/orbits.py +0 -0
  114. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/orbits/orbits_py.py +0 -0
  115. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/orbits/taylor_z.py +0 -0
  116. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/param/__init__.py +0 -0
  117. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/param/parameter.py +0 -0
  118. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/param/prior.py +0 -0
  119. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/param/utilities.py +0 -0
  120. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/stars/__init__.py +0 -0
  121. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/stars/btsettl.py +0 -0
  122. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/stars/data/avg_bt_settl.fits +0 -0
  123. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/stars/data/avg_husser2013.fits +0 -0
  124. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/stars/husser2013.py +0 -0
  125. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/__init__.py +0 -0
  126. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/astrometry.py +0 -0
  127. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/constants.py +0 -0
  128. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/de.py +0 -0
  129. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/downsample.py +0 -0
  130. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/eclipses.py +0 -0
  131. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/io/__init__.py +0 -0
  132. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/io/lightcurvedata.py +0 -0
  133. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/keplerlc.py +0 -0
  134. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/mdwarfs.py +0 -0
  135. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/misc.py +0 -0
  136. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/mocklc.py +0 -0
  137. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/octasphere.py +0 -0
  138. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/phasecurves.py +0 -0
  139. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/physics.py +0 -0
  140. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/rv.py +0 -0
  141. {pytransit-2.6.19 → pytransit-2.7.1}/pytransit/utils/tess.py +0 -0
  142. {pytransit-2.6.19 → pytransit-2.7.1}/requirements.txt +0 -0
  143. {pytransit-2.6.19 → pytransit-2.7.1}/setup.cfg +0 -0
  144. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_contamination.py +0 -0
  145. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_jax_uniformdisk.py +0 -0
  146. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_limb_darkening.py +0 -0
  147. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_ma_quadratic.py +0 -0
  148. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_ma_quadratic_nb.py +0 -0
  149. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_qpower2_nb.py +0 -0
  150. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_transitmodel_helpers.py +0 -0
  151. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_uniform_model.py +0 -0
  152. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_uniform_model_nb.py +0 -0
  153. {pytransit-2.6.19 → pytransit-2.7.1}/tests/test_z.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.19
3
+ Version: 2.7.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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.19
3
+ Version: 2.7.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
@@ -95,7 +95,10 @@ 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_eclipse.py
101
+ pytransit/models/roadrunner/model_ecspec.py
99
102
  pytransit/models/roadrunner/model_full.py
100
103
  pytransit/models/roadrunner/model_simple.py
101
104
  pytransit/models/roadrunner/model_trspec.py
@@ -141,6 +144,7 @@ tests/test_limb_darkening.py
141
144
  tests/test_ma_quadratic.py
142
145
  tests/test_ma_quadratic_nb.py
143
146
  tests/test_qpower2_nb.py
147
+ tests/test_roadrunner_eclipse.py
144
148
  tests/test_transitmodel_helpers.py
145
149
  tests/test_uniform_model.py
146
150
  tests/test_uniform_model_nb.py
@@ -41,7 +41,7 @@ Date
41
41
 
42
42
  """
43
43
 
44
- __version__ = '2.6.19'
44
+ __version__ = '2.7.1'
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
@@ -32,8 +32,8 @@ from astropy.table import Column
32
32
  from corner import corner
33
33
  from matplotlib.pyplot import subplots, setp
34
34
  from numba import njit
35
- from numpy import zeros, log, pi, inf, atleast_2d, arange, arctan2, cos, squeeze, median, linspace, \
36
- percentile, argsort, sum, concatenate, full, sqrt, ndarray
35
+ from numpy import zeros, log, pi, inf, atleast_2d, arange, arctan2, cos, squeeze, median, linspace, percentile, argsort, \
36
+ sum, concatenate, full, sqrt, ndarray, floor
37
37
  from numpy.random.mtrand import permutation
38
38
 
39
39
  from pytransit.lpf.logposteriorfunction import LogPosteriorFunction
@@ -57,7 +57,7 @@ def lnlike_normal(o, m, e):
57
57
 
58
58
 
59
59
  class RVLPF(LogPosteriorFunction):
60
- def __init__(self, name: str, nplanets: int, times, rvs, rves, rvis=None, slope_order: int = 1):
60
+ def __init__(self, name: str, nplanets: int, times, rvs, rves, rvis, is_transiting, slope_order: int = 1):
61
61
  super().__init__(name)
62
62
 
63
63
  def transform_input(a):
@@ -76,8 +76,8 @@ class RVLPF(LogPosteriorFunction):
76
76
  else:
77
77
  rvis = zeros(len(times), 'int')
78
78
 
79
- self._tref = concatenate(times).mean()
80
- self.rvm: RVModel = RVModel(self, nplanets, times, rvs, rves, rvis, slope_order=slope_order)
79
+ self._tref = floor(concatenate(times).min())
80
+ self.rvm: RVModel = RVModel(self, nplanets, times, rvs, rves, rvis, is_transiting=is_transiting, slope_order=slope_order)
81
81
 
82
82
  def model(self, pv):
83
83
  return self.rvm.rv_model(pv)
@@ -102,7 +102,7 @@ class RVModel:
102
102
  """
103
103
 
104
104
  def __init__(self, lpf: LogPosteriorFunction, nplanets: int,
105
- times, rvs: Iterable, rves: Iterable, rvis: Iterable,
105
+ times, rvs: Iterable, rves: Iterable, rvis: Iterable, is_transiting,
106
106
  tref: Optional[float] = None, slope_order: int = 1):
107
107
  self.lpf = lpf
108
108
 
@@ -110,6 +110,10 @@ class RVModel:
110
110
  assert lpf.nplanets == nplanets
111
111
  self.nplanets = nplanets
112
112
 
113
+ if len(is_transiting) != self.nplanets:
114
+ raise ValueError("The size of the is_transiting list must equal the number of planets.")
115
+ self.is_transiting = is_transiting
116
+
113
117
  if hasattr(lpf, '_tref'):
114
118
  assert tref is None
115
119
  self._tref = lpf._tref
@@ -152,12 +156,15 @@ class RVModel:
152
156
  self.ps = ps = ParameterSet([])
153
157
  pp = []
154
158
  for i in range(1, self.nplanets + 1):
155
- pp.extend([
156
- GParameter(f'tc_{i}', f'zero epoch {i}', 'd', NP(0.0, 0.1), (-inf, inf)),
157
- GParameter(f'p_{i}', f'period {i}', 'd', NP(1.0, 1e-5), (0, inf)),
158
- GParameter(f'secw_{i}', f'sqrt(e) cos(w) {i}', '', UP(-1.0, 1.0), (-1, 1)),
159
- GParameter(f'sesw_{i}', f'sqrt(e) sin(w) {i}', '', UP(-1.0, 1.0), (-1, 1)),
160
- ])
159
+ if self.is_transiting[i-1]:
160
+ pp.append(GParameter(f't0_{i}', f'zero epoch {i}', 'd', NP(0.0, 0.1), (-inf, inf)))
161
+ else:
162
+ pp.append(GParameter(f'm0_{i}', f'reference mean anomaly {i}', 'd', UP(0.0, 2*pi), (0, 2*pi)))
163
+
164
+ pp.extend([GParameter(f'p_{i}', f'period {i}', 'd', NP(1.0, 1e-5), (0, inf)),
165
+ GParameter(f'secw_{i}', f'sqrt(e) cos(w) {i}', '', UP(-1.0, 1.0), (-1, 1)),
166
+ GParameter(f'sesw_{i}', f'sqrt(e) sin(w) {i}', '', UP(-1.0, 1.0), (-1, 1)),
167
+ ])
161
168
  ps.add_global_block('planets', pp)
162
169
  self._start_pl = ps.blocks[-1].start
163
170
  self._sl_pl = ps.blocks[-1].slice
@@ -190,9 +197,11 @@ class RVModel:
190
197
  self._sl_rv_slope = ps.blocks[-1].slice
191
198
  self.ps.freeze()
192
199
 
193
- pnames = "rv_k_{} tc_{} p_{} secw_{} sesw_{}".split()
200
+ pnames_tr = "rv_k_{} t0_{} p_{} secw_{} sesw_{}".split()
201
+ pnames_nt = "rv_k_{} m0_{} p_{} secw_{} sesw_{}".split()
194
202
  self.pids = zeros((self.nplanets, 5), 'int')
195
203
  for ipl in range(self.nplanets):
204
+ pnames = pnames_tr if self.is_transiting[ipl] else pnames_nt
196
205
  for ip, p in enumerate(pnames):
197
206
  name = p.format(ipl + 1)
198
207
  self.pids[ipl, ip] = self.ps.names.index(name)
@@ -216,7 +225,10 @@ class RVModel:
216
225
  planets = planets if planets is not None else arange(self.nplanets)
217
226
  for ipl in planets:
218
227
  pv = pvp[:, self.pids[ipl]]
219
- tc = pv[:, 1] - self._tref
228
+ if self.is_transiting[ipl]:
229
+ tc = pv[:, 1] - self._tref
230
+ else:
231
+ tc = pv[:, 1] / (2*pi) * pv[:, 2]
220
232
  p = pv[:, 2]
221
233
  e = pv[:, 3] ** 2 + pv[:, 4] ** 2
222
234
  w = arctan2(pv[:, 4], pv[:, 3])
@@ -345,7 +357,10 @@ class RVModel:
345
357
  rv_others = median(self.rv_model(pvp, planets=other_planets, add_sv=False, add_slope=False), 0)
346
358
 
347
359
  period = pv[self.ps.names.index(f'p_{planet + 1}')]
348
- tc = pv[self.ps.names.index(f'tc_{planet + 1}')] - self._tref
360
+ if self.is_transiting[planet]:
361
+ tc = pv[self.ps.names.index(f't0_{planet + 1}')] - self._tref
362
+ else:
363
+ tc = pv[self.ps.names.index(f'm0_{planet + 1}')] / (2*pi) * period
349
364
 
350
365
  phase = (fold(self._timea, period, tc, 0.5) - 0.5) * period
351
366
  phase_model = (fold(rv_time, period, tc, 0.5) - 0.5) * period
@@ -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
@@ -0,0 +1,93 @@
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, rstar: Union[float, ndarray] = 1.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
+ rstar : optional
71
+ Stellar radius in solar radii, used to compute the light travel time
72
+ correction between transit and secondary eclipse. Defaults to 1.0.
73
+
74
+ Notes
75
+ -----
76
+ The model can be evaluated either for one set of parameters or for many sets of parameters simultaneously. In
77
+ the first case, the orbital parameters should all be given as floats. In the second case, the orbital parameters
78
+ should be given as a 1D array-like.
79
+
80
+ Returns
81
+ -------
82
+ ndarray
83
+ Modelled flux either as a 3D ndarray.
84
+ """
85
+ k, t0, p, a, i, e, w, rstar = map(atleast_1d, (k, t0, p, a, i, e, w, rstar))
86
+ if rstar.size == 1 and k.size > 1:
87
+ rstar = rstar.repeat(k.size)
88
+ return self.model(self.time, k, t0, p, a, i, e, w, rstar, f, self.nsamples[0], self.exptimes[0])
89
+
90
+ def __call__(self, f: ndarray, k: Union[float, ndarray], t0: Union[float, ndarray], p: Union[float, ndarray],
91
+ a: Union[float, ndarray], i: Union[float, ndarray], e: Union[float, ndarray] = 0.0,
92
+ w: Union[float, ndarray] = 0.0, rstar: Union[float, ndarray] = 1.0) -> ndarray:
93
+ return self.evaluate(f, k, t0, p, a, i, e, w, rstar)
@@ -0,0 +1,83 @@
1
+ from meepmeep import eclipse_light_travel_time
2
+ from meepmeep.utils import eclipse_phase
3
+
4
+ from numba import njit, prange
5
+ from numpy import zeros, isnan, nan, full, floor, pi
6
+ from numpy.typing import NDArray
7
+
8
+ from meepmeep.xy.position import solve_xy_p5s, pd_t15sc, bounding_box
9
+
10
+ from .common import circle_circle_intersection_area_kite as ccia
11
+
12
+
13
+ @njit(parallel=False, fastmath=False)
14
+ def eclipse_model(times: NDArray, k: NDArray, t0: NDArray, p: NDArray, a: NDArray, i: NDArray, e: NDArray, w: NDArray,
15
+ rstar: float, nlc: int, lcids: NDArray, epids: NDArray, nsamples: int | NDArray,
16
+ exptimes: int | NDArray):
17
+
18
+ npv = k.shape[0]
19
+ npt = times.size
20
+
21
+ if k.ndim != 1:
22
+ raise ValueError(" The radius ratio must be given as an 1D array with shape (npv)")
23
+
24
+ _exptimes = zeros(nlc)
25
+ _exptimes[:] = exptimes
26
+ _nsamples = zeros(nlc)
27
+ _nsamples[:] = nsamples
28
+
29
+ pv_is_good = full(npv, True)
30
+ xyc = zeros((npv, 2, 5)) # Taylor series coefficients for the (x, y) position
31
+ bbs = zeros((npv, nlc, 2))
32
+ eclipse_shifts = zeros(npv)
33
+ ltts = zeros(npv)
34
+
35
+ for ipv in range(npv):
36
+ if isnan(a[ipv]) or (a[ipv] <= 1.0) or (e[ipv] < 0.0):
37
+ pv_is_good[ipv] = False
38
+ continue
39
+
40
+ # ------------------------------------------------------#
41
+ # Calculate the Taylor series expansions for the orbits #
42
+ # ------------------------------------------------------#
43
+ eclipse_shifts[ipv] = eclipse_phase(p[ipv], i[ipv], e[ipv], w[ipv])
44
+ xyc[ipv, :, :] = solve_xy_p5s(eclipse_shifts[ipv], p[ipv], a[ipv], i[ipv], e[ipv], w[ipv])
45
+ ltts[ipv] = eclipse_light_travel_time(p[ipv], a[ipv], i[ipv], e[ipv], w[ipv], rstar)
46
+
47
+ # -----------------------------#
48
+ # Calculate the bounding boxes #
49
+ # -----------------------------#
50
+ bt4, bt1 = bounding_box(k[ipv], xyc[ipv])
51
+ bbs[ipv, :, 0] = bt1
52
+ bbs[ipv, :, 1] = bt4
53
+ for ilc in range(nlc):
54
+ bbs[ipv, ilc, 0] -= 0.003 + _exptimes[ilc]
55
+ bbs[ipv, ilc, 1] += 0.003 + _exptimes[ilc]
56
+
57
+ # ---------------------------#
58
+ # Calculate the light curves #
59
+ # ---------------------------#
60
+ flux = zeros((npv, npt))
61
+ for j in prange(npv * npt):
62
+ ipv = j // npt
63
+ ipt = j % npt
64
+
65
+ if not pv_is_good[ipv]:
66
+ flux[ipv, ipt] = nan
67
+ continue
68
+
69
+ ilc = lcids[ipt]
70
+ iep = epids[ilc]
71
+
72
+ te = t0[ipv, iep] + eclipse_shifts[ipv] + ltts[ipv]
73
+ epoch = floor((times[ipt] - te + 0.5 * p[ipv]) / p[ipv])
74
+ tc = times[ipt] - (te + epoch * p[ipv])
75
+ if not (bbs[ipv, ilc, 0] <= tc <= bbs[ipv, ilc, 1]):
76
+ flux[ipv, ipt] = pi * k[ipv] ** 2
77
+ else:
78
+ for isample in range(1, nsamples[ilc] + 1):
79
+ time_offset = exptimes[ilc] * ((isample - 0.5) / nsamples[ilc] - 0.5)
80
+ z = pd_t15sc(tc + time_offset, xyc[ipv])
81
+ flux[ipv, ipt] += pi * k[ipv] ** 2 - ccia(1.0, k[ipv], z)[0]
82
+ flux[ipv, ipt] /= nsamples[ilc]
83
+ return flux
@@ -0,0 +1,62 @@
1
+ from math import fabs, floor
2
+
3
+ from meepmeep.utils import d_from_pkaiews, eclipse_phase
4
+ from meepmeep.newton import eclipse_light_travel_time
5
+ from meepmeep.xy.position import solve_xy_p5s, pd_t15sc
6
+ from numpy import zeros, ndarray, isnan, nan, pi
7
+
8
+ from .common import circle_circle_intersection_area_kite as ccia
9
+
10
+ __all__ = ['esmodel']
11
+
12
+
13
+ def esmodel(times: ndarray, k: ndarray, t0: ndarray, p: ndarray, a: ndarray, i: ndarray, e: ndarray, w: ndarray,
14
+ rstar: ndarray, fratio: ndarray, nsamples: int, exptime: float) -> ndarray:
15
+ if k.ndim != 1:
16
+ raise ValueError(" The radius ratio must be given as an 1D array with shape (npv)")
17
+
18
+ if fratio.ndim != 2:
19
+ raise ValueError(" The flux ratio must be given as a 2D array with shape (npv, npb)")
20
+
21
+ npt = times.size
22
+ npv = fratio.shape[0]
23
+ npb = fratio.shape[1]
24
+
25
+ flux = zeros((npv, npb, npt)) # Model flux
26
+ xyc = zeros((2, 5)) # Taylor series coefficients for the (x, y) position
27
+
28
+ for ipv in range(npv):
29
+ if isnan(a[ipv]) or (a[ipv] <= 1.0) or (e[ipv] < 0.0):
30
+ flux[ipv, :, :] = nan
31
+ continue
32
+
33
+ # -----------------------------------------------------#
34
+ # Calculate the Taylor series expansions for the orbit #
35
+ # -----------------------------------------------------#
36
+ eclipse_shift = eclipse_phase(p[ipv], i[ipv], e[ipv], w[ipv])
37
+ xyc[:, :] = solve_xy_p5s(eclipse_shift, p[ipv], a[ipv], i[ipv], e[ipv], w[ipv])
38
+ ltt = eclipse_light_travel_time(p[ipv], a[ipv], i[ipv], e[ipv], w[ipv], rstar[ipv])
39
+ te = t0[ipv] + eclipse_shift + ltt
40
+
41
+ # --------------------------------#
42
+ # Calculate the half-window width #
43
+ # --------------------------------#
44
+ hww = 0.5 * d_from_pkaiews(p[ipv], k[ipv], a[ipv], i[ipv], e[ipv], w[ipv], -1, 14)
45
+ hww = 0.0015 + exptime + hww
46
+
47
+ # --------------------------#
48
+ # Calculate the light curve #
49
+ # --------------------------#
50
+ for ipt in range(npt):
51
+ epoch = floor((times[ipt] - te + 0.5 * p[ipv]) / p[ipv])
52
+ tc = times[ipt] - (te + epoch * p[ipv])
53
+ if fabs(tc) > hww:
54
+ flux[ipv, :, ipt] = 1.0
55
+ else:
56
+ for isample in range(1, nsamples + 1):
57
+ time_offset = exptime * ((isample - 0.5) / nsamples - 0.5)
58
+ z = pd_t15sc(tc + time_offset, xyc)
59
+ flux[ipv, :, ipt] += 1.0 - (fratio[ipv, :] * ccia(1.0, k[ipv], z)[0] / pi) / (
60
+ 1.0 + fratio[ipv, :] * k[ipv] ** 2)
61
+ flux[ipv, :, ipt] /= nsamples
62
+ return flux
@@ -1,8 +1,7 @@
1
- from meepmeep.tsorbit import bounding_box
2
1
  from numba import njit, prange
3
2
  from numpy import zeros, dot, ndarray, isnan, nan, full, floor
4
3
 
5
- from meepmeep.xy.position import solve_xy_p5s, pd_t15sc
4
+ from meepmeep.xy.position import solve_xy_p5s, pd_t15sc, bounding_box
6
5
  from meepmeep.utils import d_from_pkaiews
7
6
 
8
7
  from .common import calculate_weights_2d, interpolate_mean_limb_darkening_s
@@ -82,7 +81,7 @@ def rr_full_serial(times: ndarray, k: ndarray, t0: ndarray, p: ndarray, a: ndarr
82
81
  # -----------------------------#
83
82
  # Calculate the bounding boxes #
84
83
  # -----------------------------#
85
- bt1, bt4 = bounding_box(ks[ipv, 0], xyc)
84
+ bt1, bt4 = bounding_box(ks[ipv, 0], xyc[ipv])
86
85
  bbs[ipv, :, 0] = bt1
87
86
  bbs[ipv, :, 1] = bt4
88
87
  for ilc in range(nlc):
@@ -178,7 +177,7 @@ def rr_full_parallel(times: ndarray, k: ndarray, t0: ndarray, p: ndarray, a: nda
178
177
  # -----------------------------#
179
178
  # Calculate the bounding boxes #
180
179
  # -----------------------------#
181
- bt1, bt4 = bounding_box(ks[ipv, 0], xyc)
180
+ bt1, bt4 = bounding_box(ks[ipv, 0], xyc[ipv])
182
181
  bbs[ipv, :, 0] = bt1
183
182
  bbs[ipv, :, 1] = bt4
184
183
  for ilc in range(nlc):
@@ -0,0 +1,61 @@
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
+ import unittest
10
+ from math import pi
11
+
12
+ import numpy as np
13
+ from numpy import ndarray
14
+
15
+
16
+ def make_inputs(k=0.1, a=8.0, inc=np.pi / 2, p=2.0, t0=0.0,
17
+ e=0.0, w=0.0, rstar=1.0,
18
+ npt=5000, t_start=-0.5, t_end=3.5, nep=1):
19
+ """Build a canonical single-pv, single-light-curve input set.
20
+
21
+ The defaults give a non-grazing hot-Jupiter-like geometry on a
22
+ circular orbit, with the primary transit at t=0 and the secondary
23
+ eclipse near t=p/2=1 d.
24
+ """
25
+ times = np.linspace(t_start, t_end, npt)
26
+ k_arr = np.array([k])
27
+ t0_arr = np.full((1, nep), t0)
28
+ p_arr = np.array([p])
29
+ a_arr = np.array([a])
30
+ i_arr = np.array([inc])
31
+ e_arr = np.array([e])
32
+ w_arr = np.array([w])
33
+ rstar_arr = np.array([rstar])
34
+ nlc, npb = 1, 1
35
+ lcids = np.zeros(npt, dtype=np.int64)
36
+ pbids = np.zeros(nlc, dtype=np.int64)
37
+ epids = np.zeros(nlc, dtype=np.int64)
38
+ nsamples = np.ones(nlc, dtype=np.int64)
39
+ exptimes = np.zeros(nlc)
40
+ return (times, k_arr, t0_arr, p_arr, a_arr, i_arr, e_arr, w_arr,
41
+ rstar_arr, nlc, npb, nep,
42
+ lcids, pbids, epids, nsamples, exptimes)
43
+
44
+
45
+ class TestEclipseKernelImport(unittest.TestCase):
46
+ """Sanity checks that the kernel imports and runs end-to-end."""
47
+
48
+ def test_kernel_imports(self):
49
+ from pytransit.models.roadrunner.model_eclipse import eclipse_model
50
+ self.assertTrue(callable(eclipse_model))
51
+
52
+ def test_kernel_returns_expected_shape(self):
53
+ from pytransit.models.roadrunner.model_eclipse import eclipse_model
54
+ args = make_inputs()
55
+ flux = eclipse_model(*args)
56
+ self.assertIsInstance(flux, ndarray)
57
+ self.assertEqual(flux.shape, (1, args[0].size))
58
+
59
+
60
+ if __name__ == "__main__":
61
+ unittest.main()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes