PyTransit 2.6.3__tar.gz → 2.6.4__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 (147) hide show
  1. {pytransit-2.6.3 → pytransit-2.6.4}/MANIFEST.in +2 -0
  2. {pytransit-2.6.3 → pytransit-2.6.4}/PKG-INFO +3 -2
  3. {pytransit-2.6.3 → pytransit-2.6.4}/PyTransit.egg-info/PKG-INFO +3 -2
  4. {pytransit-2.6.3 → pytransit-2.6.4}/PyTransit.egg-info/SOURCES.txt +5 -0
  5. {pytransit-2.6.3 → pytransit-2.6.4}/README.md +2 -1
  6. {pytransit-2.6.3 → pytransit-2.6.4}/pyproject.toml +1 -1
  7. pytransit-2.6.4/pytransit/models/numba/ldtkldm.py +91 -0
  8. pytransit-2.6.4/pytransit/models/roadrunner/ecintersection.py +137 -0
  9. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/model_trspec.py +22 -14
  10. pytransit-2.6.4/pytransit/models/roadrunner/opmodel.py +104 -0
  11. pytransit-2.6.4/pytransit/models/roadrunner/opmodel_full.py +245 -0
  12. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/rrmodel.py +38 -17
  13. pytransit-2.6.4/pytransit/models/roadrunner/rrmodel_cl.py +369 -0
  14. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/tsmodel.py +9 -5
  15. pytransit-2.6.4/pytransit/utils/io/__init__.py +0 -0
  16. pytransit-2.6.3/pytransit/models/roadrunner/__init__.py +0 -1
  17. {pytransit-2.6.3 → pytransit-2.6.4}/LICENSE +0 -0
  18. {pytransit-2.6.3 → pytransit-2.6.4}/PyTransit.egg-info/dependency_links.txt +0 -0
  19. {pytransit-2.6.3 → pytransit-2.6.4}/PyTransit.egg-info/requires.txt +0 -0
  20. {pytransit-2.6.3 → pytransit-2.6.4}/PyTransit.egg-info/top_level.txt +0 -0
  21. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/__init__.py +0 -0
  22. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/__init__.py +0 -0
  23. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/contamination.py +0 -0
  24. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/data/spectra.h5 +0 -0
  25. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/data/transmission.nc +0 -0
  26. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/filter.py +0 -0
  27. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/instrument.py +0 -0
  28. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/contamination/plotting.py +0 -0
  29. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/limb_darkening.py +0 -0
  30. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/__init__.py +0 -0
  31. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/baselines/__init__.py +0 -0
  32. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/baselines/legendrebaseline.py +0 -0
  33. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/baselines/linearbaseline.py +0 -0
  34. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/cntlpf.py +0 -0
  35. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/eclipselpf.py +0 -0
  36. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/__init__.py +0 -0
  37. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/celeriteloglikelihood.py +0 -0
  38. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/clloglikelihood.py +0 -0
  39. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/fmcloglikelihood.py +0 -0
  40. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/logisticloglikelihood.py +0 -0
  41. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/multiceleriteloglikelihood.py +0 -0
  42. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/loglikelihood/wnloglikelihood.py +0 -0
  43. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/logposteriorfunction.py +0 -0
  44. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/lpf.py +0 -0
  45. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/mclpf.py +0 -0
  46. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/mptlpf.py +0 -0
  47. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/ocllpf.py +0 -0
  48. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/ocltdvlpf.py +0 -0
  49. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/oclttvlpf.py +0 -0
  50. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/phasecurvelpf.py +0 -0
  51. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/rvlpf.py +0 -0
  52. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tdvlpf.py +0 -0
  53. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/__init__.py +0 -0
  54. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/ctesslpf.py +0 -0
  55. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/tessttvlpf.py +0 -0
  56. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/tgclpf.py +0 -0
  57. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/tgcmplpf.py +0 -0
  58. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tess/tmpclpf.py +0 -0
  59. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tesslpf.py +0 -0
  60. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/tessoclttvlpf.py +0 -0
  61. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/transitanalysis.py +0 -0
  62. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/transitlpf.py +0 -0
  63. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/lpf/ttvlpf.py +0 -0
  64. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/__init__.py +0 -0
  65. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/eclipse_model.py +0 -0
  66. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/gdmodel.py +0 -0
  67. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/general.py +0 -0
  68. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ldmodel.py +0 -0
  69. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ldtkldm.py +0 -0
  70. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/__init__.py +0 -0
  71. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/general.py +0 -0
  72. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/linear.py +0 -0
  73. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/nonlinear.py +0 -0
  74. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/power_2.py +0 -0
  75. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/quadratic.py +0 -0
  76. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/quadratic_tri.py +0 -0
  77. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/limb_darkening/uniform.py +0 -0
  78. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ma_chromosphere.py +0 -0
  79. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ma_quadratic.py +0 -0
  80. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ma_quadratic_cl.py +0 -0
  81. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ma_uniform.py +0 -0
  82. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/ma_uniform_cl.py +0 -0
  83. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/__init__.py +0 -0
  84. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/gdmodel.py +0 -0
  85. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/general_nb.py +0 -0
  86. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/ldmodels.py +0 -0
  87. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/ma_chromosphere_nb.py +0 -0
  88. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/ma_quadratic_nb.py +0 -0
  89. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/ma_uniform_nb.py +0 -0
  90. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/phasecurves.py +0 -0
  91. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/qpower2_nb.py +0 -0
  92. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/rrmodel.py +0 -0
  93. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/spmodel.py +0 -0
  94. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/numba/udmodel.py +0 -0
  95. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/opencl/ma_quadratic.cl +0 -0
  96. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/opencl/ma_uniform.cl +0 -0
  97. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/opencl/orbits.cl +0 -0
  98. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/opencl/qpower2.cl +0 -0
  99. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/osmodel.py +0 -0
  100. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/qpower2.py +0 -0
  101. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/qpower2_cl.py +0 -0
  102. {pytransit-2.6.3/pytransit/utils/io → pytransit-2.6.4/pytransit/models/roadrunner}/__init__.py +0 -0
  103. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/common.py +0 -0
  104. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/model.py +0 -0
  105. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/model_full.py +0 -0
  106. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/model_simple.py +0 -0
  107. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/roadrunner/rrmodel.cl +0 -0
  108. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/transitmodel.py +0 -0
  109. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/models/uniform.py +0 -0
  110. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/orbits/__init__.py +0 -0
  111. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/orbits/orbits.py +0 -0
  112. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/orbits/orbits_py.py +0 -0
  113. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/orbits/taylor_z.py +0 -0
  114. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/param/__init__.py +0 -0
  115. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/param/parameter.py +0 -0
  116. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/param/prior.py +0 -0
  117. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/param/utilities.py +0 -0
  118. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/stars/__init__.py +0 -0
  119. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/stars/btsettl.py +0 -0
  120. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/stars/data/avg_bt_settl.fits +0 -0
  121. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/stars/data/avg_husser2013.fits +0 -0
  122. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/stars/husser2013.py +0 -0
  123. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/__init__.py +0 -0
  124. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/astrometry.py +0 -0
  125. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/constants.py +0 -0
  126. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/de.py +0 -0
  127. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/downsample.py +0 -0
  128. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/eclipses.py +0 -0
  129. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/io/lightcurvedata.py +0 -0
  130. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/keplerlc.py +0 -0
  131. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/mdwarfs.py +0 -0
  132. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/misc.py +0 -0
  133. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/mocklc.py +0 -0
  134. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/octasphere.py +0 -0
  135. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/phasecurves.py +0 -0
  136. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/physics.py +0 -0
  137. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/rv.py +0 -0
  138. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/utils/tess.py +0 -0
  139. {pytransit-2.6.3 → pytransit-2.6.4}/pytransit/version.py +0 -0
  140. {pytransit-2.6.3 → pytransit-2.6.4}/setup.cfg +0 -0
  141. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_contamination.py +0 -0
  142. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_ma_quadratic.py +0 -0
  143. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_ma_quadratic_nb.py +0 -0
  144. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_qpower2_nb.py +0 -0
  145. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_uniform_model.py +0 -0
  146. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_uniform_model_nb.py +0 -0
  147. {pytransit-2.6.3 → pytransit-2.6.4}/tests/test_z.py +0 -0
@@ -1,4 +1,6 @@
1
1
  include pytransit/contamination/data/*
2
2
  include pytransit/models/opencl/*.cl
3
3
  include pytransit/models/roadrunner/*.cl
4
+ include pytransit/models/roadrunner/*.py
5
+ include pytransit/models/numba/*.py
4
6
  include pytransit/stars/data/*.fits
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyTransit
3
- Version: 2.6.3
3
+ Version: 2.6.4
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -43,7 +43,8 @@ PyTransit
43
43
 
44
44
  *PyTransit: fast and versatile exoplanet transit light curve modelling in Python.* PyTransit provides a set of optimised
45
45
  transit models with a unified API that makes modelling complex sets of heterogeneous light curve (nearly) as easy as
46
- modelling individual transit light curves.
46
+ modelling individual transit light curves. The models are optimised with Numba which allows for model evaluation speeds
47
+ paralleling Fortran and C-implementations but with hassle-free platform-independent multithreading.
47
48
 
48
49
  The package has been under continuous development since 2009, and is described in [Parviainen (2015)](http://arxiv.org/abs/1504.07433),
49
50
  [Parviainen (2020a)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.1633P/abstract), and [Parviainen (2020b)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.3356P/abstract).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyTransit
3
- Version: 2.6.3
3
+ Version: 2.6.4
4
4
  Summary: Fast and painless exoplanet transit light curve modelling.
5
5
  Author-email: Hannu Parviainen <hpparvi@gmail.com>
6
6
  License: GPLv2
@@ -43,7 +43,8 @@ PyTransit
43
43
 
44
44
  *PyTransit: fast and versatile exoplanet transit light curve modelling in Python.* PyTransit provides a set of optimised
45
45
  transit models with a unified API that makes modelling complex sets of heterogeneous light curve (nearly) as easy as
46
- modelling individual transit light curves.
46
+ modelling individual transit light curves. The models are optimised with Numba which allows for model evaluation speeds
47
+ paralleling Fortran and C-implementations but with hassle-free platform-independent multithreading.
47
48
 
48
49
  The package has been under continuous development since 2009, and is described in [Parviainen (2015)](http://arxiv.org/abs/1504.07433),
49
50
  [Parviainen (2020a)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.1633P/abstract), and [Parviainen (2020b)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.3356P/abstract).
@@ -79,6 +79,7 @@ pytransit/models/numba/__init__.py
79
79
  pytransit/models/numba/gdmodel.py
80
80
  pytransit/models/numba/general_nb.py
81
81
  pytransit/models/numba/ldmodels.py
82
+ pytransit/models/numba/ldtkldm.py
82
83
  pytransit/models/numba/ma_chromosphere_nb.py
83
84
  pytransit/models/numba/ma_quadratic_nb.py
84
85
  pytransit/models/numba/ma_uniform_nb.py
@@ -93,12 +94,16 @@ pytransit/models/opencl/orbits.cl
93
94
  pytransit/models/opencl/qpower2.cl
94
95
  pytransit/models/roadrunner/__init__.py
95
96
  pytransit/models/roadrunner/common.py
97
+ pytransit/models/roadrunner/ecintersection.py
96
98
  pytransit/models/roadrunner/model.py
97
99
  pytransit/models/roadrunner/model_full.py
98
100
  pytransit/models/roadrunner/model_simple.py
99
101
  pytransit/models/roadrunner/model_trspec.py
102
+ pytransit/models/roadrunner/opmodel.py
103
+ pytransit/models/roadrunner/opmodel_full.py
100
104
  pytransit/models/roadrunner/rrmodel.cl
101
105
  pytransit/models/roadrunner/rrmodel.py
106
+ pytransit/models/roadrunner/rrmodel_cl.py
102
107
  pytransit/models/roadrunner/tsmodel.py
103
108
  pytransit/orbits/__init__.py
104
109
  pytransit/orbits/orbits.py
@@ -9,7 +9,8 @@ PyTransit
9
9
 
10
10
  *PyTransit: fast and versatile exoplanet transit light curve modelling in Python.* PyTransit provides a set of optimised
11
11
  transit models with a unified API that makes modelling complex sets of heterogeneous light curve (nearly) as easy as
12
- modelling individual transit light curves.
12
+ modelling individual transit light curves. The models are optimised with Numba which allows for model evaluation speeds
13
+ paralleling Fortran and C-implementations but with hassle-free platform-independent multithreading.
13
14
 
14
15
  The package has been under continuous development since 2009, and is described in [Parviainen (2015)](http://arxiv.org/abs/1504.07433),
15
16
  [Parviainen (2020a)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.1633P/abstract), and [Parviainen (2020b)](https://ui.adsabs.harvard.edu/abs/2020MNRAS.499.3356P/abstract).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyTransit"
3
- version = "2.6.3"
3
+ version = "2.6.4"
4
4
  description = 'Fast and painless exoplanet transit light curve modelling.'
5
5
  authors=[{name='Hannu Parviainen', email='hpparvi@gmail.com'}]
6
6
  classifiers=[
@@ -0,0 +1,91 @@
1
+ from numba import njit, prange
2
+ from numpy import zeros, floor, sqrt, pi
3
+
4
+
5
+ @njit
6
+ def trilinear_interpolation_unit_cube(data, x, y, z):
7
+ """Trilinear interpolation inside a unit cube.
8
+
9
+ Implementation taken from Paul Bourke's notes
10
+ https://paulbourke.net/miscellaneous/interpolation
11
+ """
12
+ n1 = data.shape[3]
13
+ n2 = data.shape[4]
14
+ ldp = zeros((n1, n2))
15
+ rx, ry, rz = (1.0 - x), (1.0 - y), (1.0 - z)
16
+
17
+ a1 = rx * ry * rz
18
+ a2 = x * ry * rz
19
+ b1 = rx * y * rz
20
+ b2 = rx * ry * z
21
+ c1 = x * ry * z
22
+ c2 = rx * y * z
23
+ d1 = x * y * rz
24
+ d2 = x * y * z
25
+
26
+ for i1 in range(n1):
27
+ for i2 in range(n2):
28
+ ldp[i1, i2] = (data[0, 0, 0, i1, i2] * a1 +
29
+ data[1, 0, 0, i1, i2] * a2 +
30
+ data[0, 1, 0, i1, i2] * b1 +
31
+ data[0, 0, 1, i1, i2] * b2 +
32
+ data[1, 0, 1, i1, i2] * c1 +
33
+ data[0, 1, 1, i1, i2] * c2 +
34
+ data[1, 1, 0, i1, i2] * d1 +
35
+ data[1, 1, 1, i1, i2] * d2)
36
+ return ldp
37
+
38
+
39
+ @njit
40
+ def trilinear_interpolation_single(data, x, y, z, x0, dx, nx, y0, dy, ny, z0, dz, nz):
41
+ x = min(max(x, x0), x0 + nx * dx)
42
+ y = min(max(y, y0), y0 + ny * dy)
43
+ z = min(max(z, z0), z0 + nz * dz)
44
+ ix = int(floor((x - x0) / dx))
45
+ iy = int(floor((y - y0) / dy))
46
+ iz = int(floor((z - z0) / dz))
47
+ ax = (x - x0 - ix * dx) / dx
48
+ ay = (y - y0 - iy * dy) / dy
49
+ az = (z - z0 - iz * dz) / dz
50
+ return trilinear_interpolation_unit_cube(data[ix:ix + 2, iy:iy + 2, iz:iz + 2, :, :], ax, ay, az)
51
+
52
+
53
+ @njit(parallel=True)
54
+ def trilinear_interpolation_set(data, xs, ys, zs, x0, dx, nx, y0, dy, ny, z0, dz, nz):
55
+ npv = xs.shape[0]
56
+ ldp = zeros((npv, data.shape[3], data.shape[4]))
57
+ for ipv in prange(npv):
58
+ ldp[ipv, :, :] = trilinear_interpolation_single(data, xs[ipv], ys[ipv], zs[ipv], x0, dx, nx, y0, dy, ny, z0, dz,
59
+ nz)
60
+ return ldp
61
+
62
+
63
+ @njit
64
+ def integrate_profiles_single(mu, ldp):
65
+ nmu = mu.size
66
+ npb = ldp.shape[0]
67
+ ldi = zeros(npb)
68
+
69
+ z = sqrt(1.0 - mu ** 2)
70
+ dz = z[1:] - z[:-1]
71
+ for ipb in range(npb):
72
+ for i in range(1, nmu):
73
+ ldi[ipb] += dz[i - 1] * 0.5 * (z[i] * ldp[ipb, i] + z[i - 1] * ldp[ipb, i - 1])
74
+ return 2.0 * pi * ldi
75
+
76
+
77
+ @njit(parallel=True)
78
+ def integrate_profiles_set(mu, ldp):
79
+ nmu = mu.size
80
+ npv = ldp.shape[0]
81
+ npb = ldp.shape[1]
82
+ ldi = zeros((npv, npb))
83
+
84
+ z = sqrt(1.0 - mu ** 2)
85
+ dz = z[1:] - z[:-1]
86
+ for j in prange(npv * npb):
87
+ ipv = j // npb
88
+ ipb = j % npb
89
+ for i in range(1, nmu):
90
+ ldi[ipv, ipb] += dz[i - 1] * 0.5 * (z[i] * ldp[ipv, ipb, i] + z[i - 1] * ldp[ipv, ipb, i - 1])
91
+ return 2.0 * pi * ldi
@@ -0,0 +1,137 @@
1
+ from math import cos, sin, sqrt, isfinite, nan
2
+
3
+ from numpy import ndarray, fabs, pi, full, arange
4
+ from numba import njit
5
+
6
+ @njit
7
+ def create_ellipse(ny: int, k: float, f: float, a: float) -> (ndarray, ndarray):
8
+ """
9
+ Create the coordinates for a rotated ellipse.
10
+
11
+ Parameters
12
+ ----------
13
+ ny : int
14
+ The number of sample points along the y-axis.
15
+ k : float
16
+ Scale factor for the ellipse.
17
+ f : float
18
+ Flattening factor for the ellipse. Determines the extent to which the ellipse is squashed along the y-axis.
19
+ a : float
20
+ The angle of rotation for the ellipse in radians.
21
+
22
+ Returns
23
+ -------
24
+ (ndarray, ndarray)
25
+ A tuple containing two ndarrays. The first ndarray is a 1D array of y-coordinates, and the second is a 2D array of x-coordinates
26
+ corresponding to the left and right intersections of the ellipse with vertical lines through the y-coordinates.
27
+
28
+ Notes
29
+ -----
30
+ The ellipse is initially defined with its major axis aligned with the x-axis. It is then rotated by an angle `a` and scaled by a factor `k`.
31
+ The flattening factor `f` adjusts the size of the minor axis relative to the major axis, with a smaller value indicating a more flattened ellipse.
32
+ """
33
+ dy = 2 / (ny+1)
34
+ ys = arange(1, 1+ny)*dy - 1
35
+ xs = full((ny, 2), nan)
36
+ ca, sa = cos(a), sin(a)
37
+ b = 1.0 - f
38
+ b2 = b * b
39
+ ca2 = ca * ca
40
+ sa2 = sa * sa
41
+
42
+ for i in range(ny):
43
+ y = ys[i]
44
+ y2 = y * y
45
+ d = b2 * ca2 + ca2 * ca2 * (-y2) - 2 * ca2 * sa2 * y2 - sa2 * sa2 * y2 + sa2
46
+ if d >= 0:
47
+ d = sqrt(d) / b
48
+ u = (ca * sa * y) / b2 - ca * sa * y
49
+ v = sa2 / b2 + ca2
50
+ xs[i, 0] = (-d + u) / v
51
+ xs[i, 1] = (d + u) / v
52
+ return k*ys, k*xs
53
+
54
+
55
+ @njit
56
+ def ellipse_circle_intersection_area(cx: float, cy: float, z: float, k: float, f: float, xs: ndarray, ys: ndarray) -> float:
57
+ """
58
+ Calculate the intersection area between a rotated ellipse and a circle using a scanline fill approach.
59
+
60
+ Parameters
61
+ ----------
62
+ cx : float
63
+ The ellipse's center x coordinate.
64
+ cy : float
65
+ The ellipse's center y coordinate.
66
+ z : float
67
+ The center-center distance.
68
+ k : float
69
+ Radius ratio.
70
+ f : float
71
+ Flattening factor for the ellipse. Determines the extent to which the ellipse is squashed along the y-axis.
72
+ xs : ndarray
73
+ 2D array of x-coordinates corresponding to the left and right intersections of the ellipse with vertical lines through the y-coordinates.
74
+ ys : ndarray
75
+ 1D array of y-coordinates.
76
+
77
+ Returns
78
+ -------
79
+ float
80
+ The area of the intersection between the given ellipse and circle.
81
+
82
+ Notes
83
+ -----
84
+ This function employs a numerical method that iterates over a set of horizontal lines (scanlines)
85
+ to approximate the area of intersection between a circle and a rotated ellipse. The calculation considers
86
+ the rotation of the ellipse, its eccentricity, and the relative position of the ellipse to the circle.
87
+ The approach is based on the principles of scanline fill in computer graphics, adapted to the mathematical
88
+ properties of ellipses and circles.
89
+
90
+ The algorithm calculates the intersection points between each scanline and the ellipse, then integrates these
91
+ intersections over the range of y-coordinates to find the total area. It handles different cases based on the
92
+ relative position and size of the ellipse to optimize calculations.
93
+ """
94
+ if z <= 1.0 - k:
95
+ return pi * k * (1.0 - f) * k
96
+ elif z >= 1.0 + k:
97
+ return 0.0
98
+ else:
99
+ ny = ys.size
100
+ dy = (ys[1] - ys[0])
101
+ l = 0.0
102
+ if cx < -k:
103
+ for i in range(ny):
104
+ if isfinite(xs[i, 0]):
105
+ xstar = -sqrt(1.0 - (ys[i] + cy) ** 2) - cx
106
+ if xstar <= xs[i, 0]:
107
+ l += xs[i, 1] - xs[i, 0]
108
+ elif xstar <= xs[i, 1]:
109
+ l += xs[i, 1] - xstar
110
+ elif cx > k:
111
+ for i in range(ny):
112
+ if isfinite(xs[i, 0]):
113
+ xstar = sqrt(1.0 - (ys[i] + cy) ** 2) - cx
114
+ if xstar >= xs[i, 1]:
115
+ l += xs[i, 1] - xs[i, 0]
116
+ elif xstar >= xs[i, 0]:
117
+ l += xstar - xs[i, 0]
118
+ else:
119
+ for i in range(ny):
120
+ if isfinite(xs[i, 0]):
121
+ if fabs(ys[i] + cy) <= 1.0:
122
+ xstar = sqrt(1.0 - (ys[i] + cy) ** 2)
123
+ xst1 = -xstar - cx
124
+ xst2 = xstar - cx
125
+ if xst1 <= xs[i, 0]:
126
+ l += min(xst2, xs[i, 1]) - xs[i, 0]
127
+ elif xst1 > xs[i, 0]:
128
+ l += min(xst2, xs[i, 1]) - xst1
129
+ return l*dy
130
+
131
+ #else:
132
+ # for i in range(ny):
133
+ # if isfinite(xs[i,0]):
134
+ # xstar = sqrt(1.0 - (ys[i])**2) - b
135
+ # if xstar < xs[i,1]:
136
+ # l += xs[i,1]- max(xstar, xs[i,0])
137
+ # return pi*k*k*(1.0-f) - l*dy
@@ -1,5 +1,5 @@
1
1
  from math import fabs, floor
2
- from numba import njit, prange
2
+ from numba import njit, prange, get_num_threads, set_num_threads
3
3
  from numpy import zeros, dot, ndarray, isnan, full, nan, mean, floor, fabs
4
4
 
5
5
  from meepmeep.xy.position import solve_xy_p5s, pd_t15sc
@@ -13,7 +13,7 @@ from .common import circle_circle_intersection_area_kite as ccia
13
13
  def tsmodel_serial(times: ndarray,
14
14
  k: ndarray, t0: ndarray, p: ndarray, a: ndarray, i: ndarray, e: ndarray, w: ndarray,
15
15
  nsamples: ndarray, exptimes: ndarray, ldp: ndarray, istar: ndarray,
16
- weights: ndarray, dk: float, kmin: float, kmax: float, dg: float, z_edges: ndarray) -> ndarray:
16
+ weights: ndarray, dk: float, kmin: float, kmax: float, ng: int, dg: float, z_edges: ndarray) -> ndarray:
17
17
  if k.ndim != 2:
18
18
  raise ValueError(" The radius ratios must be given as a 2D array with shape (npv, npb)")
19
19
 
@@ -26,7 +26,9 @@ def tsmodel_serial(times: ndarray,
26
26
  npt = times.size
27
27
  npv = k.shape[0]
28
28
  npb = k.shape[1]
29
- ng = weights.shape[1]
29
+
30
+ if weights is not None:
31
+ ng = weights.shape[1]
30
32
 
31
33
  flux = zeros((npv, npb, npt)) # Model flux
32
34
  ldm = zeros((npb, ng)) # Limb darkening means
@@ -43,14 +45,13 @@ def tsmodel_serial(times: ndarray,
43
45
  # -----------------------------------#
44
46
  # Calculate the limb darkening means #
45
47
  # -----------------------------------#
46
- if kmin <= kmean <= kmax:
48
+ if weights is not None and kmin <= kmean <= kmax:
47
49
  ik = int(floor((kmean - kmin) / dk))
48
50
  ak = (kmean - kmin - ik * dk) / dk
49
51
  for ipb in range(npb):
50
- ldm[ipb, :] = (1.0 - ak) * dot(weights[ik], ldp[ipv, ipb, :]) + ak * dot(weights[ik + 1],
51
- ldp[ipv, ipb, :])
52
+ ldm[ipb, :] = (1.0 - ak) * dot(weights[ik], ldp[ipv, ipb, :]) + ak * dot(weights[ik + 1], ldp[ipv, ipb, :])
52
53
  else:
53
- _, _, wg = calculate_weights_2d(kmean, z_edges, ng)
54
+ _, dg, wg = calculate_weights_2d(kmean, z_edges, ng)
54
55
  for ipb in range(npb):
55
56
  ldm[ipb, :] = dot(wg, ldp[ipv, ipb, :])
56
57
 
@@ -89,7 +90,12 @@ def tsmodel_serial(times: ndarray,
89
90
  def tsmodel_parallel(times: ndarray,
90
91
  k: ndarray, t0: ndarray, p: ndarray, a: ndarray, i: ndarray, e: ndarray, w: ndarray,
91
92
  nsamples: ndarray, exptimes: ndarray, ldp: ndarray, istar: ndarray,
92
- weights: ndarray, dk: float, kmin: float, kmax: float, dg: float, z_edges: ndarray) -> ndarray:
93
+ weights: ndarray, dk: float, kmin: float, kmax: float, ng: int, dg: float, z_edges: ndarray,
94
+ nthreads: int) -> ndarray:
95
+
96
+ nthreads_current = get_num_threads()
97
+ set_num_threads(nthreads)
98
+
93
99
  if k.ndim != 2:
94
100
  raise ValueError(" The radius ratios must be given as a 2D array with shape (npv, npb)")
95
101
 
@@ -102,13 +108,14 @@ def tsmodel_parallel(times: ndarray,
102
108
  npt = times.size
103
109
  npv = k.shape[0]
104
110
  npb = k.shape[1]
105
- ng = weights.shape[1]
111
+ if weights is not None:
112
+ ng = weights.shape[1]
106
113
 
107
114
  flux = zeros((npv, npb, npt)) # Model flux
108
115
  ldm = zeros((npb, ng)) # Limb darkening means
109
116
  xyc = zeros((2, 5)) # Taylor series coefficients for the (x, y) position
110
117
 
111
- for ipv in prange(npv):
118
+ for ipv in range(npv):
112
119
  if isnan(a[ipv]) or (a[ipv] <= 1.0) or (e[ipv] < 0.0):
113
120
  flux[ipv, :, :] = nan
114
121
  continue
@@ -119,15 +126,15 @@ def tsmodel_parallel(times: ndarray,
119
126
  # -----------------------------------#
120
127
  # Calculate the limb darkening means #
121
128
  # -----------------------------------#
122
- if kmin <= kmean <= kmax:
129
+ if weights is not None and kmin <= kmean <= kmax:
123
130
  ik = int(floor((kmean - kmin) / dk))
124
131
  ak = (kmean - kmin - ik * dk) / dk
125
132
  for ipb in range(npb):
126
133
  ldm[ipb, :] = (1.0 - ak) * dot(weights[ik], ldp[ipv, ipb, :]) + ak * dot(weights[ik + 1],
127
134
  ldp[ipv, ipb, :])
128
135
  else:
129
- _, _, wg = calculate_weights_2d(kmean, z_edges, ng)
130
- for ipb in range(npb):
136
+ dk, dg, wg = calculate_weights_2d(kmean, z_edges, ng)
137
+ for ipb in prange(npb):
131
138
  ldm[ipb, :] = dot(wg, ldp[ipv, ipb, :])
132
139
 
133
140
  # -----------------------------------------------------#
@@ -144,7 +151,7 @@ def tsmodel_parallel(times: ndarray,
144
151
  # --------------------------#
145
152
  # Calculate the light curve #
146
153
  # --------------------------#
147
- for ipt in range(npt):
154
+ for ipt in prange(npt):
148
155
  epoch = floor((times[ipt] - t0[ipv] + 0.5 * p[ipv]) / p[ipv])
149
156
  tc = times[ipt] - (t0[ipv] + epoch * p[ipv])
150
157
  if fabs(tc) > hww:
@@ -158,4 +165,5 @@ def tsmodel_parallel(times: ndarray,
158
165
  iplanet = interpolate_mean_limb_darkening_s(z / (1.0 + kmean), dg, ldm[ipb])
159
166
  flux[ipv, ipb, ipt] += (istar[ipv, ipb] - iplanet * aplanet * afac[ipb]) / istar[ipv, ipb]
160
167
  flux[ipv, :, ipt] /= nsamples[0]
168
+ set_num_threads(nthreads_current)
161
169
  return flux
@@ -0,0 +1,104 @@
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 Tuple, Callable, Union, List, Optional
30
+
31
+ from numpy import ndarray, linspace, isscalar, unique, atleast_1d
32
+ from scipy.integrate import trapz
33
+
34
+ from ..ldmodel import LDModel
35
+ from ..numba.ldmodels import *
36
+
37
+ from .opmodel_full import opmodel
38
+ from .rrmodel import RoadRunnerModel
39
+
40
+ __all__ = ['OblatePlanetModel']
41
+
42
+
43
+ class OblatePlanetModel(RoadRunnerModel):
44
+ def evaluate(self, k: Union[float, ndarray], f: Union[float, ndarray], alpha: Union[float, ndarray],
45
+ ldc: Union[ndarray, List],
46
+ t0: Union[float, ndarray], p: Union[float, ndarray], a: Union[float, ndarray],
47
+ i: Union[float, ndarray], e: Union[float, ndarray] = 0.0, w: Union[float, ndarray] = 0.0,
48
+ copy: bool = True) -> ndarray:
49
+ """Evaluate the transit model for a set of scalar or vector parameters.
50
+
51
+ Parameters
52
+ ----------
53
+ k
54
+ Radius ratio(s) either as a single float, 1D vector, or 2D array.
55
+ ldc
56
+ Limb darkening coefficients as a 1D or 2D array.
57
+ t0
58
+ Transit center(s) as a float or a 1D vector.
59
+ p
60
+ Orbital period(s) as a float or a 1D vector.
61
+ a
62
+ Orbital semi-major axis (axes) divided by the stellar radius as a float or a 1D vector.
63
+ i
64
+ Orbital inclination(s) as a float or a 1D vector.
65
+ e : optional
66
+ Orbital eccentricity as a float or a 1D vector.
67
+ w : optional
68
+ Argument of periastron as a float or a 1D vector.
69
+
70
+ Notes
71
+ -----
72
+ The model can be evaluated either for one set of parameters or for many sets of parameters simultaneously. In
73
+ the first case, the orbital parameters should all be given as floats. In the second case, the orbital parameters
74
+ should be given as a 1D array-like.
75
+
76
+ Returns
77
+ -------
78
+ ndarray
79
+ Modelled flux either as a 1D or 2D ndarray.
80
+ """
81
+
82
+ npv = 1 if isscalar(p) else p.size
83
+ ldc = atleast_1d(ldc)
84
+
85
+ if isinstance(self.ldmodel, LDModel):
86
+ ldp, istar = self.ldmodel(self.mu, ldc)
87
+ else:
88
+ ldp = evaluate_ld(self.ldmodel, self.mu, ldc)
89
+
90
+ if self.ldmmean is not None:
91
+ istar = evaluate_ldi(self.ldmmean, ldc)
92
+ else:
93
+ istar = zeros((npv, self.npb))
94
+ ldpi = evaluate_ld(self.ldmodel, self._ldmu, ldc)
95
+ for ipv in range(npv):
96
+ for ipb in range(self.npb):
97
+ istar[ipv, ipb] = 2 * pi * trapz(self._ldz * ldpi[ipv, ipb], self._ldz)
98
+
99
+ flux = opmodel(self.time, k, f, alpha, t0, p, a, i, e, w, self.parallel,
100
+ self.nlc, self.npb, self.nep, 100,
101
+ self.lcids, self.pbids, self.epids, self.nsamples, self.exptimes,
102
+ ldp, istar, self.weights, self.dk, self.klims[0], self.klims[1], self.dg, self.ze)
103
+
104
+ return flux