PyTransit 2.6.13__tar.gz → 2.6.15__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 (146) hide show
  1. {pytransit-2.6.13 → pytransit-2.6.15}/PKG-INFO +3 -2
  2. {pytransit-2.6.13 → pytransit-2.6.15}/PyTransit.egg-info/PKG-INFO +3 -2
  3. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/__init__.py +1 -1
  4. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/eclipse_model.py +70 -1
  5. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/gdmodel.py +1 -1
  6. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/udmodel.py +2 -1
  7. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/model_trspec.py +36 -17
  8. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/stars/btsettl.py +1 -1
  9. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/stars/husser2013.py +1 -1
  10. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/de.py +3 -3
  11. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_contamination.py +5 -3
  12. {pytransit-2.6.13 → pytransit-2.6.15}/LICENSE +0 -0
  13. {pytransit-2.6.13 → pytransit-2.6.15}/MANIFEST.in +0 -0
  14. {pytransit-2.6.13 → pytransit-2.6.15}/PyTransit.egg-info/SOURCES.txt +0 -0
  15. {pytransit-2.6.13 → pytransit-2.6.15}/PyTransit.egg-info/dependency_links.txt +0 -0
  16. {pytransit-2.6.13 → pytransit-2.6.15}/PyTransit.egg-info/requires.txt +0 -0
  17. {pytransit-2.6.13 → pytransit-2.6.15}/PyTransit.egg-info/top_level.txt +0 -0
  18. {pytransit-2.6.13 → pytransit-2.6.15}/README.md +0 -0
  19. {pytransit-2.6.13 → pytransit-2.6.15}/pyproject.toml +0 -0
  20. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/__init__.py +0 -0
  21. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/contamination.py +0 -0
  22. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/data/spectra.h5 +0 -0
  23. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/data/transmission.nc +0 -0
  24. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/filter.py +0 -0
  25. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/instrument.py +0 -0
  26. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/contamination/plotting.py +0 -0
  27. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/limb_darkening.py +0 -0
  28. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/__init__.py +0 -0
  29. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/baselines/__init__.py +0 -0
  30. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/baselines/legendrebaseline.py +0 -0
  31. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/baselines/linearbaseline.py +0 -0
  32. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/cntlpf.py +0 -0
  33. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/eclipselpf.py +0 -0
  34. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/__init__.py +0 -0
  35. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/celeriteloglikelihood.py +0 -0
  36. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/clloglikelihood.py +0 -0
  37. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/fmcloglikelihood.py +0 -0
  38. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/logisticloglikelihood.py +0 -0
  39. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/multiceleriteloglikelihood.py +0 -0
  40. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/loglikelihood/wnloglikelihood.py +0 -0
  41. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/logposteriorfunction.py +0 -0
  42. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/lpf.py +0 -0
  43. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/mclpf.py +0 -0
  44. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/mptlpf.py +0 -0
  45. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/ocllpf.py +0 -0
  46. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/ocltdvlpf.py +0 -0
  47. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/oclttvlpf.py +0 -0
  48. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/phasecurvelpf.py +0 -0
  49. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/rvlpf.py +0 -0
  50. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tdvlpf.py +0 -0
  51. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/__init__.py +0 -0
  52. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/ctesslpf.py +0 -0
  53. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/tessttvlpf.py +0 -0
  54. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/tgclpf.py +0 -0
  55. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/tgcmplpf.py +0 -0
  56. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tess/tmpclpf.py +0 -0
  57. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tesslpf.py +0 -0
  58. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/tessoclttvlpf.py +0 -0
  59. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/transitanalysis.py +0 -0
  60. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/transitlpf.py +0 -0
  61. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/lpf/ttvlpf.py +0 -0
  62. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/__init__.py +0 -0
  63. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/general.py +0 -0
  64. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ldmodel.py +0 -0
  65. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ldtkldm.py +0 -0
  66. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/__init__.py +0 -0
  67. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/general.py +0 -0
  68. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/linear.py +0 -0
  69. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/nonlinear.py +0 -0
  70. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/power_2.py +0 -0
  71. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/quadratic.py +0 -0
  72. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/quadratic_tri.py +0 -0
  73. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/limb_darkening/uniform.py +0 -0
  74. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ma_chromosphere.py +0 -0
  75. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ma_quadratic.py +0 -0
  76. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ma_quadratic_cl.py +0 -0
  77. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ma_uniform.py +0 -0
  78. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/ma_uniform_cl.py +0 -0
  79. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/__init__.py +0 -0
  80. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/gdmodel.py +0 -0
  81. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/general_nb.py +0 -0
  82. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/ldmodels.py +0 -0
  83. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/ldtkldm.py +0 -0
  84. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/ma_chromosphere_nb.py +0 -0
  85. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/ma_quadratic_nb.py +0 -0
  86. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/ma_uniform_nb.py +0 -0
  87. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/phasecurves.py +0 -0
  88. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/qpower2_nb.py +0 -0
  89. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/rrmodel.py +0 -0
  90. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/numba/spmodel.py +0 -0
  91. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/opencl/ma_quadratic.cl +0 -0
  92. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/opencl/ma_uniform.cl +0 -0
  93. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/opencl/orbits.cl +0 -0
  94. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/opencl/qpower2.cl +0 -0
  95. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/osmodel.py +0 -0
  96. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/qpower2.py +0 -0
  97. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/qpower2_cl.py +0 -0
  98. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/__init__.py +0 -0
  99. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/common.py +0 -0
  100. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/ecintersection.py +0 -0
  101. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/model.py +0 -0
  102. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/model_full.py +0 -0
  103. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/model_simple.py +0 -0
  104. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/opmodel.py +0 -0
  105. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/opmodel_full.py +0 -0
  106. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/rrmodel.cl +0 -0
  107. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/rrmodel.py +0 -0
  108. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/rrmodel_cl.py +0 -0
  109. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/roadrunner/tsmodel.py +0 -0
  110. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/transitmodel.py +0 -0
  111. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/models/uniform.py +0 -0
  112. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/orbits/__init__.py +0 -0
  113. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/orbits/orbits.py +0 -0
  114. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/orbits/orbits_py.py +0 -0
  115. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/orbits/taylor_z.py +0 -0
  116. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/param/__init__.py +0 -0
  117. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/param/parameter.py +0 -0
  118. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/param/prior.py +0 -0
  119. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/param/utilities.py +0 -0
  120. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/stars/__init__.py +0 -0
  121. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/stars/data/avg_bt_settl.fits +0 -0
  122. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/stars/data/avg_husser2013.fits +0 -0
  123. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/__init__.py +0 -0
  124. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/astrometry.py +0 -0
  125. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/constants.py +0 -0
  126. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/downsample.py +0 -0
  127. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/eclipses.py +0 -0
  128. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/io/__init__.py +0 -0
  129. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/io/lightcurvedata.py +0 -0
  130. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/keplerlc.py +0 -0
  131. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/mdwarfs.py +0 -0
  132. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/misc.py +0 -0
  133. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/mocklc.py +0 -0
  134. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/octasphere.py +0 -0
  135. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/phasecurves.py +0 -0
  136. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/physics.py +0 -0
  137. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/rv.py +0 -0
  138. {pytransit-2.6.13 → pytransit-2.6.15}/pytransit/utils/tess.py +0 -0
  139. {pytransit-2.6.13 → pytransit-2.6.15}/requirements.txt +0 -0
  140. {pytransit-2.6.13 → pytransit-2.6.15}/setup.cfg +0 -0
  141. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_ma_quadratic.py +0 -0
  142. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_ma_quadratic_nb.py +0 -0
  143. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_qpower2_nb.py +0 -0
  144. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_uniform_model.py +0 -0
  145. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_uniform_model_nb.py +0 -0
  146. {pytransit-2.6.13 → pytransit-2.6.15}/tests/test_z.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.13
3
+ Version: 2.6.15
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -36,6 +36,7 @@ Requires-Dist: pyopencl
36
36
  Requires-Dist: corner
37
37
  Requires-Dist: celerite
38
38
  Requires-Dist: meepmeep
39
+ Dynamic: license-file
39
40
 
40
41
  PyTransit
41
42
  =========
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: PyTransit
3
- Version: 2.6.13
3
+ Version: 2.6.15
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -36,6 +36,7 @@ Requires-Dist: pyopencl
36
36
  Requires-Dist: corner
37
37
  Requires-Dist: celerite
38
38
  Requires-Dist: meepmeep
39
+ Dynamic: license-file
39
40
 
40
41
  PyTransit
41
42
  =========
@@ -41,7 +41,7 @@ Date
41
41
 
42
42
  """
43
43
 
44
- __version__ = '2.6.13'
44
+ __version__ = '2.6.15'
45
45
 
46
46
  # Generic
47
47
  # -------
@@ -38,7 +38,7 @@ class EclipseModel(TransitModel):
38
38
  Parameters
39
39
  ----------
40
40
  k
41
- Radius ratio(s) either as a single float or a 1D vector.
41
+ Radius ratio(s) either as a single float, 1D vector, or 2D array.
42
42
  t0
43
43
  Transit center(s) as a float or a 1D vector.
44
44
  p
@@ -97,3 +97,72 @@ class EclipseModel(TransitModel):
97
97
  flux = 1.0 + (flux - 1.0) / k**2
98
98
 
99
99
  return squeeze(flux)
100
+
101
+ def evaluate_ps(self, k: float, t0: float, p: float, a: float, i: float, e: float = 0., w: float = 0., fr: Optional[float] = None) -> ndarray:
102
+ """Evaluate the transit model for a set of scalar parameters.
103
+
104
+ Parameters
105
+ ----------
106
+ k : array-like
107
+ Radius ratio(s) either as a single float or an 1D array.
108
+ t0 : float
109
+ Transit center as a float.
110
+ p : float
111
+ Orbital period as a float.
112
+ a : float
113
+ Orbital semi-major axis divided by the stellar radius as a float.
114
+ i : float
115
+ Orbital inclination(s) as a float.
116
+ e : float, optional
117
+ Orbital eccentricity as a float.
118
+ w : float, optional
119
+ Argument of periastron as a float.
120
+ fr : float, optional
121
+ Planet-star flux ratio as a float.
122
+
123
+
124
+ Notes
125
+ -----
126
+ This version of the `evaluate` method is optimized for calculating a single transit model (such as when using a
127
+ local optimizer). If you want to evaluate the model for a large number of parameters simultaneously, use either
128
+ `evaluate` or `evaluate_pv`.
129
+
130
+ Returns
131
+ -------
132
+ ndarray
133
+ Modelled flux as a 1D ndarray.
134
+ """
135
+ if self.time is None:
136
+ raise ValueError("Need to set the data before calling the transit model.")
137
+
138
+ k = asarray(k)
139
+ flux = uniform_model_s(self.time, k, t0, p, a, i, e, w, self.lcids, self.pbids, self.nsamples, self.exptimes, zsign=-1.0)
140
+ if fr is not None:
141
+ flux = 1.0 + (flux - 1.0) * fr
142
+ return squeeze(flux)
143
+
144
+ def evaluate_pv(self, pvp: ndarray, fr = None) -> ndarray:
145
+ """Evaluate the transit model for a 2D parameter array.
146
+
147
+ Parameters
148
+ ----------
149
+ pvp
150
+ Parameter array with a shape `(npv, npar)` where `npv` is the number of parameter vectors, and each row
151
+ contains a set of parameters `[k, t0, p, a, i, e, w]`. The radius ratios can also be given per passband,
152
+ in which case the row should be structured as `[k_0, k_1, k_2, ..., k_npb, t0, p, a, i, e, w]`.
153
+
154
+ Notes
155
+ -----
156
+ This version of the `evaluate` method is optimized for calculating several models in parallel, such as when
157
+ using *emcee* for MCMC sampling.
158
+
159
+ Returns
160
+ -------
161
+ ndarray
162
+ Modelled flux either as a 1D or 2D ndarray.
163
+ """
164
+ assert self.time is not None, "Need to set the data before calling the transit model."
165
+ flux = uniform_model_pv(self.time, pvp, self.lcids, self.pbids, self.nsamples, self.exptimes, zsign=-1.0)
166
+ if fr is not None:
167
+ flux = 1.0 + (flux - 1.0) * fr
168
+ return squeeze(flux)
@@ -23,7 +23,7 @@ from numpy import linspace, sin, cos, array, ndarray, asarray, squeeze, cross, n
23
23
  zeros, polyfit, atleast_2d, atleast_1d, nansum, zeros_like
24
24
  from numpy.linalg import norm
25
25
  from scipy.interpolate import interp1d
26
- from scipy.spatial.transform.rotation import Rotation
26
+ from scipy.spatial.transform import Rotation
27
27
 
28
28
  from .transitmodel import TransitModel
29
29
  from .numba.gdmodel import create_star_xy, create_planet_xy, map_osm, xy_taylor_vt, oblate_model_s, \
@@ -80,7 +80,8 @@ def uniform_model_simple(times, k, t0, p, a, i, e, w, with_derivatives):
80
80
 
81
81
 
82
82
  @njit
83
- def uniform_model_v(times, k, t0, p, dkdp, cfs, dcfs, with_derivatives, lcids, pbids, epids, nsamples, exptimes):
83
+ def uniform_model_v(times, k, t0, p, dkdp, cfs, dcfs, with_derivatives,
84
+ lcids, pbids, epids, nsamples, exptimes):
84
85
  k = atleast_1d(asarray(k))
85
86
  dkdp = atleast_1d(asarray(dkdp))
86
87
  t0 = atleast_1d(asarray(t0))
@@ -1,6 +1,6 @@
1
1
  from math import fabs, floor
2
2
  from numba import njit, prange, get_num_threads, set_num_threads
3
- from numpy import zeros, dot, ndarray, isnan, full, nan, mean, floor, fabs
3
+ from numpy import zeros, dot, ndarray, isnan, full, nan, mean, floor, fabs, max
4
4
 
5
5
  from meepmeep.xy.position import solve_xy_p5s, pd_t15sc
6
6
  from meepmeep.utils import d_from_pkaiews
@@ -40,6 +40,7 @@ def tsmodel_serial(times: ndarray,
40
40
  continue
41
41
 
42
42
  kmean = mean(k[ipv])
43
+ kmax = max(k[ipv])
43
44
  afac = k[ipv] ** 2 / kmean ** 2
44
45
 
45
46
  # -----------------------------------#
@@ -78,10 +79,16 @@ def tsmodel_serial(times: ndarray,
78
79
  for isample in range(1, nsamples[0] + 1):
79
80
  time_offset = exptimes[0] * ((isample - 0.5) / nsamples[0] - 0.5)
80
81
  z = pd_t15sc(tc + time_offset, xyc)
81
- aplanet = ccia(1.0, kmean, z)[0]
82
- for ipb in range(npb):
83
- iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
84
- flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * aplanet * afac[ipb]) / istar[ipv, ipb]
82
+ ap0, kappa = ccia(1.0, kmean, z)
83
+ dadk = 2.0*kmean*kappa
84
+ if z <= 1.0 - kmax:
85
+ for ipb in range(npb):
86
+ iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
87
+ flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * ap0 * afac[ipb]) / istar[ipv, ipb]
88
+ else:
89
+ for ipb in range(npb):
90
+ iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
91
+ flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * (ap0 + (k[ipv, ipb]-kmean)*dadk)) / istar[ipv, ipb]
85
92
  flux[ipv, :, ipt] /= nsamples[0]
86
93
  return flux
87
94
 
@@ -93,8 +100,8 @@ def tsmodel_parallel(times: ndarray,
93
100
  weights: ndarray, dk: float, kmin: float, kmax: float, ng: int, dg: float, z_edges: ndarray,
94
101
  nthreads: int) -> ndarray:
95
102
 
96
- #nthreads_current = get_num_threads()
97
- #set_num_threads(nthreads)
103
+ nthreads_current = get_num_threads()
104
+ set_num_threads(nthreads)
98
105
 
99
106
  if k.ndim != 2:
100
107
  raise ValueError(" The radius ratios must be given as a 2D array with shape (npv, npb)")
@@ -115,12 +122,13 @@ def tsmodel_parallel(times: ndarray,
115
122
  ldm = zeros((npb, ng)) # Limb darkening means
116
123
  xyc = zeros((2, 5)) # Taylor series coefficients for the (x, y) position
117
124
 
118
- for ipv in prange(npv):
125
+ for ipv in range(npv):
119
126
  if isnan(a[ipv]) or (a[ipv] <= 1.0) or (e[ipv] < 0.0):
120
127
  flux[ipv, :, :] = nan
121
128
  continue
122
129
 
123
130
  kmean = mean(k[ipv])
131
+ kmax = max(k[ipv])
124
132
  afac = k[ipv] ** 2 / kmean ** 2
125
133
 
126
134
  # -----------------------------------#
@@ -133,8 +141,8 @@ def tsmodel_parallel(times: ndarray,
133
141
  ldm[ipb, :] = (1.0 - ak) * dot(weights[ik], ldp[ipv, ipb, :]) + ak * dot(weights[ik + 1],
134
142
  ldp[ipv, ipb, :])
135
143
  else:
136
- _, dg, wg = calculate_weights_2d(kmean, z_edges, ng)
137
- for ipb in range(npb):
144
+ dk, dg, wg = calculate_weights_2d(kmean, z_edges, ng)
145
+ for ipb in prange(npb):
138
146
  ldm[ipb, :] = dot(wg, ldp[ipv, ipb, :])
139
147
 
140
148
  # -----------------------------------------------------#
@@ -151,16 +159,27 @@ def tsmodel_parallel(times: ndarray,
151
159
  # --------------------------#
152
160
  # Calculate the light curve #
153
161
  # --------------------------#
154
- for ipt in range(npt):
162
+ for ipt in prange(npt):
155
163
  epoch = floor((times[ipt] - t0[ipv] + 0.5 * p[ipv]) / p[ipv])
156
164
  tc = times[ipt] - (t0[ipv] + epoch * p[ipv])
157
165
  if fabs(tc) > hww:
158
166
  flux[ipv, :, ipt] = 1.0
159
167
  else:
160
- z = pd_t15sc(tc, xyc)
161
- aplanet = ccia(1.0, kmean, z)[0]
162
- for ipb in range(npb):
163
- iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
164
- flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * aplanet * afac[ipb]) / istar[ipv, ipb]
165
- #set_num_threads(nthreads_current)
168
+ for isample in range(1, nsamples[0] + 1):
169
+ time_offset = exptimes[0] * ((isample - 0.5) / nsamples[0] - 0.5)
170
+ z = pd_t15sc(tc + time_offset, xyc)
171
+ ap0, kappa = ccia(1.0, kmean, z)
172
+ dadk = 2.0*kmean*kappa
173
+ for ipb in range(npb):
174
+ if z <= 1.0 - kmax:
175
+ for ipb in range(npb):
176
+ iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
177
+ flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * ap0 * afac[ipb]) / istar[ipv, ipb]
178
+ else:
179
+ for ipb in range(npb):
180
+ iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
181
+ flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * (
182
+ ap0 + (k[ipv, ipb] - kmean) * dadk)) / istar[ipv, ipb]
183
+ flux[ipv, :, ipt] /= nsamples[0]
184
+ set_num_threads(nthreads_current)
166
185
  return flux
@@ -113,7 +113,7 @@ def write_table(df):
113
113
 
114
114
 
115
115
  def read_bt_settl_table():
116
- spectra = pf.getdata(bt_settl_file)
116
+ spectra = pf.getdata(bt_settl_file).astype('d')
117
117
  teff = pf.getdata(bt_settl_file, 1)['TEff'].astype('d')
118
118
  wl = pf.getval(bt_settl_file, 'CRVAL1') + arange(spectra.shape[1]) * pf.getval(bt_settl_file, 'CDELT1')
119
119
  return pd.DataFrame(spectra, index=pd.Index(teff, name='TEff [K]'), columns=pd.Index(wl, name='Wavelength [nm]'))
@@ -123,7 +123,7 @@ def write_table(df):
123
123
 
124
124
 
125
125
  def read_husser2013_table():
126
- spectra = pf.getdata(husser2013_file)
126
+ spectra = pf.getdata(husser2013_file).astype('d')
127
127
  teff = pf.getdata(husser2013_file, 1)['TEff'].astype('d')
128
128
  wl = pf.getval(husser2013_file, 'CRVAL1') + arange(spectra.shape[1]) * pf.getval(husser2013_file, 'CDELT1')
129
129
  return pd.DataFrame(spectra, index=pd.Index(teff, name='TEff [K]'), columns=pd.Index(wl, name='Wavelength [nm]'))
@@ -22,7 +22,7 @@ Implements the differential evolution optimization method by Storn & Price
22
22
  """
23
23
 
24
24
  from numba import njit
25
- from numpy import asarray, zeros, zeros_like, tile, array, argmin, mod
25
+ from numpy import asarray, zeros, zeros_like, tile, array, argmin, mod, ptp
26
26
  from numpy.random import random, randint, rand, seed as rseed, uniform
27
27
 
28
28
 
@@ -215,7 +215,7 @@ class DiffEvol(object):
215
215
  fitc[msk] = fitt[msk]
216
216
 
217
217
  self._minidx = argmin(fitc)
218
- if fitc.ptp() < self.min_ptp:
218
+ if ptp(fitc) < self.min_ptp:
219
219
  break
220
220
 
221
221
  yield popc[self._minidx, :], fitc[self._minidx]
@@ -241,7 +241,7 @@ class DiffEvol(object):
241
241
  fitc[msk] = fitt[msk]
242
242
 
243
243
  self._minidx = argmin(fitc)
244
- if fitc.ptp() < self.min_ptp:
244
+ if ptp(fitc) < self.min_ptp:
245
245
  break
246
246
 
247
247
  yield popc[self._minidx, :], fitc[self._minidx]
@@ -16,7 +16,7 @@
16
16
 
17
17
  import unittest
18
18
  from math import pi
19
- from numpy import array, copysign, inf
19
+ from numpy import array, copysign, inf, errstate
20
20
  from numpy.testing import assert_almost_equal
21
21
 
22
22
  from pytransit.contamination import true_radius_ratio, apparent_radius_ratio
@@ -30,11 +30,13 @@ class TestContamination(unittest.TestCase):
30
30
 
31
31
  def test_true_radius_ratio(self):
32
32
  assert_almost_equal(true_radius_ratio(0.1, 0.0), 0.1)
33
- assert_almost_equal(true_radius_ratio(0.1, 1.0), inf)
33
+ with errstate(divide='ignore'):
34
+ assert_almost_equal(true_radius_ratio(0.1, 1.0), inf)
34
35
 
35
36
  def test_apparent_radius_ratio(self):
36
37
  assert_almost_equal(apparent_radius_ratio(0.1, 0.0), 0.1)
37
- assert_almost_equal(apparent_radius_ratio(0.1, 1.0), 0.0)
38
+ with errstate(divide='ignore'):
39
+ assert_almost_equal(apparent_radius_ratio(0.1, 1.0), 0.0)
38
40
 
39
41
 
40
42
  if __name__ == '__main__':
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes