platon 5.4__tar.gz → 6.2__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 (197) hide show
  1. platon-6.2/PKG-INFO +55 -0
  2. {platon-5.4 → platon-6.2}/README.md +1 -2
  3. {platon-5.4 → platon-6.2}/docs/conf.py +1 -1
  4. {platon-5.4 → platon-6.2}/docs/eclipse_depths.rst +6 -4
  5. {platon-5.4 → platon-6.2}/docs/index.rst +3 -0
  6. platon-6.2/docs/install.rst +29 -0
  7. platon-6.2/docs/intro.rst +28 -0
  8. {platon-5.4 → platon-6.2}/docs/mie_scattering.rst +2 -3
  9. platon-6.2/docs/questions_and_answers.rst +110 -0
  10. {platon-5.4 → platon-6.2}/docs/quickstart.rst +44 -21
  11. platon-6.2/docs/surface_emission.rst +16 -0
  12. {platon-5.4 → platon-6.2}/examples/eclipse_depths_example.py +1 -1
  13. platon-6.2/examples/retrieve_dynesty.py +106 -0
  14. {platon-5.4 → platon-6.2}/examples/retrieve_eclipses.py +15 -5
  15. {platon-5.4 → platon-6.2}/examples/retrieve_emcee.py +4 -5
  16. {platon-5.4 → platon-6.2}/examples/retrieve_multinest.py +2 -4
  17. platon-6.2/examples/surface_example.py +59 -0
  18. {platon-5.4 → platon-6.2}/examples/transit_depth_example.py +7 -7
  19. platon-6.2/misc/calc_k_coeffs.py +30 -0
  20. {platon-5.4 → platon-6.2}/misc/create_stellar_spectrum_grid.py +16 -9
  21. platon-6.2/misc/gather_fastchem_abunds.py +27 -0
  22. platon-6.2/misc/gen_mie_data.py +56 -0
  23. platon-6.2/misc/generate_CIA_files.py +50 -0
  24. {platon-5.4 → platon-6.2}/misc/retrieve_exotransmit.py +1 -1
  25. {platon-5.4 → platon-6.2}/misc/retrieve_fake_data.py +1 -1
  26. platon-6.2/misc/run_fastchem.py +112 -0
  27. platon-6.2/misc/save_output.py +666 -0
  28. {platon-5.4 → platon-6.2}/platon/TP_profile.py +44 -37
  29. platon-6.2/platon/__init__.py +4 -0
  30. {platon-5.4 → platon-6.2}/platon/_atmosphere_solver.py +163 -150
  31. platon-6.2/platon/_cupy_numpy.py +25 -0
  32. platon-6.2/platon/_hist.py +22 -0
  33. platon-6.2/platon/_hydrostatic_solver.py +49 -0
  34. platon-6.2/platon/_interpolator_3D.py +77 -0
  35. platon-6.2/platon/_loader.py +14 -0
  36. {platon-5.4 → platon-6.2}/platon/_species_data_reader.py +5 -5
  37. {platon-5.4 → platon-6.2}/platon/_tau_calculator.py +5 -6
  38. {platon-5.4 → platon-6.2}/platon/abundance_getter.py +17 -26
  39. {platon-5.4 → platon-6.2}/platon/combined_retriever.py +262 -73
  40. {platon-5.4 → platon-6.2}/platon/constants.py +2 -0
  41. platon-6.2/platon/eclipse_depth_calculator.py +214 -0
  42. {platon-5.4 → platon-6.2}/platon/fit_info.py +19 -2
  43. platon-6.2/platon/params.py +5 -0
  44. platon-6.2/platon/plotter.py +258 -0
  45. platon-6.2/platon/psis.py +395 -0
  46. platon-6.2/platon/retrieval_result.py +67 -0
  47. platon-6.2/platon/surface_calculator.py +287 -0
  48. {platon-5.4 → platon-6.2}/platon/transit_depth_calculator.py +55 -47
  49. platon-6.2/platon.egg-info/PKG-INFO +55 -0
  50. {platon-5.4 → platon-6.2}/platon.egg-info/SOURCES.txt +15 -0
  51. {platon-5.4 → platon-6.2}/tests/test_eclipse_depth_calculator.py +4 -4
  52. {platon-5.4 → platon-6.2}/tests/test_eclipse_retrieval.py +4 -4
  53. {platon-5.4 → platon-6.2}/tests/test_mie_absorption.py +8 -6
  54. {platon-5.4 → platon-6.2}/tests/test_retrieve.py +4 -4
  55. {platon-5.4 → platon-6.2}/tests/test_tau_calculator.py +10 -9
  56. {platon-5.4 → platon-6.2}/tests/test_transit_depth_calculator.py +9 -11
  57. platon-5.4/PKG-INFO +0 -47
  58. platon-5.4/docs/install.rst +0 -47
  59. platon-5.4/docs/intro.rst +0 -43
  60. platon-5.4/docs/questions_and_answers.rst +0 -131
  61. platon-5.4/platon/__init__.py +0 -4
  62. platon-5.4/platon/_hydrostatic_solver.py +0 -58
  63. platon-5.4/platon/_interpolator_3D.py +0 -27
  64. platon-5.4/platon/_loader.py +0 -10
  65. platon-5.4/platon/eclipse_depth_calculator.py +0 -169
  66. platon-5.4/platon/retrieval_result.py +0 -117
  67. platon-5.4/platon.egg-info/PKG-INFO +0 -47
  68. {platon-5.4 → platon-6.2}/.gitignore +0 -0
  69. {platon-5.4 → platon-6.2}/.travis.yml +0 -0
  70. {platon-5.4 → platon-6.2}/LICENSE +0 -0
  71. {platon-5.4 → platon-6.2}/MANIFEST.in +0 -0
  72. {platon-5.4 → platon-6.2}/codecov.yaml +0 -0
  73. {platon-5.4 → platon-6.2}/docs/Makefile +0 -0
  74. {platon-5.4 → platon-6.2}/docs/make.bat +0 -0
  75. {platon-5.4 → platon-6.2}/docs/source/modules.rst +0 -0
  76. {platon-5.4 → platon-6.2}/docs/source/platon.rst +0 -0
  77. {platon-5.4 → platon-6.2}/docs/visualizer.rst +0 -0
  78. {platon-5.4 → platon-6.2}/docs/visualizer_disk.png +0 -0
  79. {platon-5.4 → platon-6.2}/docs/visualizer_layers.png +0 -0
  80. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_0p1Xsolar_cond.dat +0 -0
  81. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_0p1Xsolar_gas.dat +0 -0
  82. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_1000Xsolar_cond.dat +0 -0
  83. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_1000Xsolar_cond_graphite.dat +0 -0
  84. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_1000Xsolar_gas.dat +0 -0
  85. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_100Xsolar_cond.dat +0 -0
  86. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_100Xsolar_cond_graphite.dat +0 -0
  87. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_100Xsolar_gas.dat +0 -0
  88. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_10Xsolar_cond.dat +0 -0
  89. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_10Xsolar_cond_graphite.dat +0 -0
  90. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_10Xsolar_gas.dat +0 -0
  91. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_1Xsolar_cond.dat +0 -0
  92. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_1Xsolar_gas.dat +0 -0
  93. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_30Xsolar_cond.dat +0 -0
  94. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_30Xsolar_cond_graphite.dat +0 -0
  95. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_30Xsolar_gas.dat +0 -0
  96. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_50Xsolar_cond.dat +0 -0
  97. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_50Xsolar_cond_graphite.dat +0 -0
  98. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_50Xsolar_gas.dat +0 -0
  99. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_5Xsolar_cond.dat +0 -0
  100. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_5Xsolar_cond_graphite.dat +0 -0
  101. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_5Xsolar_gas.dat +0 -0
  102. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_C2H2.dat +0 -0
  103. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_C2H4.dat +0 -0
  104. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_C2H6.dat +0 -0
  105. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_CH4.dat +0 -0
  106. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_CO.dat +0 -0
  107. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_CO2.dat +0 -0
  108. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_H2CO.dat +0 -0
  109. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_H2O.dat +0 -0
  110. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_H2S.dat +0 -0
  111. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_HCN.dat +0 -0
  112. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_HCl.dat +0 -0
  113. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_HF.dat +0 -0
  114. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_MgH.dat +0 -0
  115. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_N2.dat +0 -0
  116. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_NH3.dat +0 -0
  117. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_NO.dat +0 -0
  118. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_NO2.dat +0 -0
  119. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_O2.dat +0 -0
  120. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_O3.dat +0 -0
  121. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_OCS.dat +0 -0
  122. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_OH.dat +0 -0
  123. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_PH3.dat +0 -0
  124. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_SH.dat +0 -0
  125. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_SO2.dat +0 -0
  126. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_SiH.dat +0 -0
  127. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_SiO.dat +0 -0
  128. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_TiO.dat +0 -0
  129. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_VO.dat +0 -0
  130. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p2_CtoO_cond.dat +0 -0
  131. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p2_CtoO_gas.dat +0 -0
  132. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p4_CtoO_cond.dat +0 -0
  133. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p4_CtoO_gas.dat +0 -0
  134. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p6_CtoO_cond.dat +0 -0
  135. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p6_CtoO_gas.dat +0 -0
  136. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p8_CtoO_cond.dat +0 -0
  137. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_0p8_CtoO_gas.dat +0 -0
  138. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p0_CtoO_cond.dat +0 -0
  139. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p0_CtoO_cond_graphite.dat +0 -0
  140. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p0_CtoO_gas.dat +0 -0
  141. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p2_CtoO_cond.dat +0 -0
  142. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p2_CtoO_cond_graphite.dat +0 -0
  143. {platon-5.4 → platon-6.2}/examples/custom_abundances/abund_solar_1p2_CtoO_gas.dat +0 -0
  144. {platon-5.4 → platon-6.2}/examples/transit_depth_binned_example.py +0 -0
  145. {platon-5.4 → platon-6.2}/examples/visualize.py +0 -0
  146. {platon-5.4 → platon-6.2}/logo.png +0 -0
  147. {platon-5.4 → platon-6.2}/misc/README +0 -0
  148. {platon-5.4 → platon-6.2}/misc/compare_abundances.py +0 -0
  149. {platon-5.4 → platon-6.2}/misc/deploy_to_pypi.sh +0 -0
  150. {platon-5.4 → platon-6.2}/misc/exotransmit_spectrum.dat +0 -0
  151. {platon-5.4 → platon-6.2}/misc/high_res_create_stellar_spectrum.py +0 -0
  152. {platon-5.4 → platon-6.2}/misc/hitran/compute_cross_sections.py +0 -0
  153. {platon-5.4 → platon-6.2}/misc/hitran/compute_cross_sections_trunc.py +0 -0
  154. {platon-5.4 → platon-6.2}/misc/load_grid.py +0 -0
  155. {platon-5.4 → platon-6.2}/misc/plot_CO.py +0 -0
  156. {platon-5.4 → platon-6.2}/misc/read_one.py +0 -0
  157. {platon-5.4 → platon-6.2}/misc/run_grid/abund_solar.in +0 -0
  158. {platon-5.4 → platon-6.2}/misc/run_grid/gen_abund_dicts.sh +0 -0
  159. {platon-5.4 → platon-6.2}/misc/run_grid/makeAbun.py +0 -0
  160. {platon-5.4 → platon-6.2}/misc/run_grid/model_template.in +0 -0
  161. {platon-5.4 → platon-6.2}/misc/run_grid/read_ggchem.py +0 -0
  162. {platon-5.4 → platon-6.2}/misc/run_grid/run_with_CO.sh +0 -0
  163. {platon-5.4 → platon-6.2}/misc/upload_data.sh +0 -0
  164. {platon-5.4 → platon-6.2}/platon/_get_data.py +0 -0
  165. {platon-5.4 → platon-6.2}/platon/_mie_cache.py +0 -0
  166. {platon-5.4 → platon-6.2}/platon/_mie_multi_x.py +0 -0
  167. {platon-5.4 → platon-6.2}/platon/_output_writer.py +0 -0
  168. {platon-5.4 → platon-6.2}/platon/_params.py +0 -0
  169. {platon-5.4 → platon-6.2}/platon/custom_dynesty_result.py +0 -0
  170. {platon-5.4 → platon-6.2}/platon/errors.py +0 -0
  171. {platon-5.4 → platon-6.2}/platon/retriever.py +0 -0
  172. {platon-5.4 → platon-6.2}/platon/visualizer.py +0 -0
  173. {platon-5.4 → platon-6.2}/platon.egg-info/dependency_links.txt +0 -0
  174. {platon-5.4 → platon-6.2}/platon.egg-info/not-zip-safe +0 -0
  175. {platon-5.4 → platon-6.2}/platon.egg-info/requires.txt +0 -0
  176. {platon-5.4 → platon-6.2}/platon.egg-info/top_level.txt +0 -0
  177. {platon-5.4 → platon-6.2}/setup.cfg +0 -0
  178. {platon-5.4 → platon-6.2}/setup.py +0 -0
  179. {platon-5.4 → platon-6.2}/tests/__init__.py +0 -0
  180. {platon-5.4 → platon-6.2}/tests/test_TP_profiles.py +0 -0
  181. {platon-5.4 → platon-6.2}/tests/test_get_data.py +0 -0
  182. {platon-5.4 → platon-6.2}/tests/test_mie.py +0 -0
  183. {platon-5.4 → platon-6.2}/tests/test_params.py +0 -0
  184. {platon-5.4 → platon-6.2}/tests/testing_data/abund_1Xsolar_cond.dat +0 -0
  185. {platon-5.4 → platon-6.2}/tests/testing_data/exotransmit_heights +0 -0
  186. {platon-5.4 → platon-6.2}/tests/testing_data/exotransmit_kappa +0 -0
  187. {platon-5.4 → platon-6.2}/tests/testing_data/exotransmit_tau +0 -0
  188. {platon-5.4 → platon-6.2}/tests/testing_data/hd209458b_transit_depths +0 -0
  189. {platon-5.4 → platon-6.2}/tests/testing_data/hot_earth_spectra.dat +0 -0
  190. {platon-5.4 → platon-6.2}/tests/testing_data/hot_jupiter_spectra.dat +0 -0
  191. {platon-5.4 → platon-6.2}/tests/testing_data/interp_data.npy +0 -0
  192. {platon-5.4 → platon-6.2}/tests/testing_data/interp_grid_x.npy +0 -0
  193. {platon-5.4 → platon-6.2}/tests/testing_data/interp_grid_y.npy +0 -0
  194. {platon-5.4 → platon-6.2}/tests/testing_data/interp_result.npy +0 -0
  195. {platon-5.4 → platon-6.2}/tests/testing_data/interp_target_x.npy +0 -0
  196. {platon-5.4 → platon-6.2}/tests/testing_data/interp_target_y.npy +0 -0
  197. {platon-5.4 → platon-6.2}/tests/testing_data/lx_mie_output.dat +0 -0
platon-6.2/PKG-INFO ADDED
@@ -0,0 +1,55 @@
1
+ Metadata-Version: 2.1
2
+ Name: platon
3
+ Version: 6.2
4
+ Summary: A package to compute transmission spectra and retrieve atmospheric parameters from transmission spectra
5
+ Home-page: https://github.com/ideasrule/platon
6
+ Author: Michael Zhang, Yayaati Chachan
7
+ Author-email: zmzhang@caltech.edu
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
+ Classifier: Operating System :: OS Independent
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: numpy
14
+ Requires-Dist: scipy
15
+ Requires-Dist: emcee
16
+ Requires-Dist: dynesty
17
+ Requires-Dist: corner
18
+ Requires-Dist: future
19
+ Requires-Dist: nose
20
+ Requires-Dist: setuptools
21
+ Requires-Dist: configparser
22
+ Requires-Dist: matplotlib
23
+
24
+ # PLanetary Atmospheric Transmission for Observer Noobs
25
+ <img src="logo.png" height="315">
26
+
27
+ [![codecov](https://codecov.io/gh/ideasrule/platon/branch/devel/graph/badge.svg)](https://codecov.io/gh/ideasrule/platon)
28
+ [![arXiv](http://img.shields.io/badge/arXiv-2004.09513-orange.svg)](https://arxiv.org/abs/2004.09513)
29
+ [![arXiv](http://img.shields.io/badge/arXiv-1811.11761-orange.svg)](https://arxiv.org/abs/1811.11761)
30
+
31
+ **Oct 30, 2024: PLATON v6.2 is out, with major updates! This corresponds most closely to the version described in Zhang et al 2024. Major changes include GPU support, free retrievals, surface emission, higher-resolution (R=20k) and more up-to-date opacities, leave-one-out cross-validation, pymultinest, and much better plotting tools.**
32
+
33
+ **February 2, 2020: PLEASE re-clone your repository if you cloned it before this
34
+ date! On this date, all data files were deleted from the repository, including
35
+ from its history. This shrank the repository's size from 1.2 GB to 36 MB,
36
+ which respects GitHub's size limit.**
37
+
38
+ **November 29, 2018: PLATON v3.0 is out! Please check the release notes on GitHub for the list of new features. Our paper actually describes v2.1, but v3 has a substantial number of improvements, and we strongly recommend everyone use it.**
39
+
40
+ **NEW (October 1): Version 2 is out, with a huge number of changes! Make sure to check out the release notes, and upgrade.**
41
+
42
+ PLATON is a fast and easy to use forward modelling and retrieval tool for
43
+ exoplanet atmospheres. It was written by Michael Zhang and Yayaati Chachan, and
44
+ is based on ExoTransmit by Eliza Kempton.
45
+
46
+ We welcome any feedback. Please send any comments, suggestions, or bug reports
47
+ to Michael Zhang: zmzhang "at" caltech.edu
48
+ **
49
+ To find installation instructions and quickstart examples, read the
50
+ documentation at: https://platon.readthedocs.io
51
+
52
+ *Now, these points of data
53
+ make a beautiful line
54
+ And we're out of beta
55
+ We're releasing on time!*
@@ -5,8 +5,7 @@
5
5
  [![arXiv](http://img.shields.io/badge/arXiv-2004.09513-orange.svg)](https://arxiv.org/abs/2004.09513)
6
6
  [![arXiv](http://img.shields.io/badge/arXiv-1811.11761-orange.svg)](https://arxiv.org/abs/1811.11761)
7
7
 
8
- **April 18, 2020: PLATON v5.1 corresponds most closely to the version described
9
- in our second PLATON paper (https://arxiv.org/abs/2004.09513).**
8
+ **Oct 30, 2024: PLATON v6.2 is out, with major updates! This corresponds most closely to the version described in Zhang et al 2024. Major changes include GPU support, free retrievals, surface emission, higher-resolution (R=20k) and more up-to-date opacities, leave-one-out cross-validation, pymultinest, and much better plotting tools.**
10
9
 
11
10
  **February 2, 2020: PLEASE re-clone your repository if you cloned it before this
12
11
  date! On this date, all data files were deleted from the repository, including
@@ -68,7 +68,7 @@ master_doc = 'index'
68
68
  #
69
69
  # This is also used if you do content translation via gettext catalogs.
70
70
  # Usually you set "language" from the command line for these cases.
71
- language = None
71
+ language = 'en'
72
72
 
73
73
  # List of patterns, relative to source directory, that match files and
74
74
  # directories to ignore when looking for source files.
@@ -25,10 +25,13 @@ Then, call the eclipse depth calculator::
25
25
 
26
26
  from platon.eclipse_depth_calculator import EclipseDepthCalculator
27
27
  calc = EclipseDepthCalculator(method="xsec") #"ktables" for correlated k
28
- wavelengths, depths = calc.compute_depths(p, Rs, Mp, Rp, Tstar)
28
+ wavelengths, depths, _ = calc.compute_depths(p, Rs, Mp, Rp, Tstar)
29
29
 
30
30
  Most of the same parameters accepted by the transit depth calculator are also
31
- accepted by the eclipse depth calculator.
31
+ accepted by the eclipse depth calculator. Surface emission can be included by
32
+ passing surface_temp. Only blackbody emission is supported at the moment, but
33
+ non-blackbody emissivities (from new, state of the art lab data!) will be
34
+ included in the next release (Paragas et al. 2024, in prep).
32
35
 
33
36
  It is also possible to retrieve on combined transit and eclipse depths::
34
37
 
@@ -41,7 +44,7 @@ It is also possible to retrieve on combined transit and eclipse depths::
41
44
  fit_info.add_uniform_fit_param(...)
42
45
  fit_info.add_uniform_fit_param(...)
43
46
 
44
- result = retriever.run_multinest(transit_bins, transit_depths, transit_errors,
47
+ result = retriever.run_dynesty(transit_bins, transit_depths, transit_errors,
45
48
  eclipse_bins, eclipse_depths, eclipse_errors,
46
49
  fit_info,
47
50
  rad_method="xsec") #"ktables" for corr-k
@@ -50,4 +53,3 @@ Here, T_limb is the temperature at the planetary limb (used for transit depths),
50
53
  while the T-P profile parameters are for the dayside (used for eclipse depths).
51
54
 
52
55
  To do an eclipse-only retrieval, set transit_bins, transit_depths, and transit_errors to None, and likewise to do a transit-only retrieval.
53
-
@@ -5,6 +5,8 @@
5
5
 
6
6
  Welcome to PLATON's documentation!
7
7
  ==================================
8
+ **Oct 30, 2024: PLATON v6.2 is out, with major updates! This corresponds most closely to the version described in Zhang et al 2024. Major changes include GPU support, free retrievals, surface emission, higher-resolution (R=20k) and more up-to-date opacities, leave-one-out cross-validation, pymultinest, and much better plotting tools.**
9
+
8
10
  **April 18, 2020: PLATON v5.1 corresponds most closely to the version described
9
11
  in our second PLATON paper.**
10
12
 
@@ -21,6 +23,7 @@ in our second PLATON paper.**
21
23
  quickstart
22
24
  mie_scattering
23
25
  eclipse_depths
26
+ surface_emission
24
27
  visualizer
25
28
  questions_and_answers
26
29
  source/modules
@@ -0,0 +1,29 @@
1
+ Install
2
+ *******
3
+ We highly recommend installing PLATON in a conda environment, which typically comes with optimized BLAS libraries. Once in the conda environment::
4
+
5
+ git clone https://github.com/ideasrule/platon.git
6
+ cd platon/
7
+ pip install -e .
8
+
9
+ Doing "pip install -e ." instead of "pip install ." installs PLATON in-place instead of copying the source files somewhere else. This way, you can modify the source code and have the changes reflected instantly.
10
+
11
+ PLATON 6.2 uses the GPU by default, and falls back on the CPU if it can't find one. If you have a Nvidia GPU, we highly recommend that you install CUDA and cupy, which will speed up PLATON many-fold::
12
+
13
+ conda install -c conda-forge cupy
14
+
15
+ PLATON will automatically detect the existence of cupy and use the GPU. You can force it to use the CPU by setting FORCE_CPU = True in _cupy_numpy.py.
16
+
17
+ PLATON supports both dynesty and pymultinest for nested sampling. dynesty is installed by default. To install pymultinest::
18
+
19
+ conda install -c conda-forge mpi4py pymultinest
20
+
21
+ After installing PLATON, you can run unit tests to make sure everything works::
22
+
23
+ nosetests -v
24
+
25
+ The unit tests should also give you a good idea of how fast the code will be.
26
+ On a decent Ubuntu machine with OpenBLAS, it takes 3 minutes.
27
+
28
+ The default data files (in platon/data) have a wavelength resolution of R=20k.
29
+ If you want higher resolution, you can download higher-resolution opacities from the `DACE opacity database <https://dace.unige.ch/opacityDatabase>`_ and interpolate to PLATON's temperature and pressure grid.
@@ -0,0 +1,28 @@
1
+ Introduction
2
+ ************
3
+
4
+ PLATON (PLanetary Atmospheric Tool for Observer Noobs) is a
5
+ fast and easy to use forward modelling and retrieval tool for
6
+ exoplanet atmospheres. Its roots are in ExoTransmit by Eliza Kempton, but
7
+ it has dramatically changed since then.
8
+
9
+ The main modules are:
10
+
11
+ 1. :class:`.TransitDepthCalculator`: computes a transit spectrum for an
12
+ exoplanet
13
+ 2. :class:`.EclipseDepthCalculator`: computes an eclipse spectrum
14
+ 3. :class:`.CombinedRetriever`: can retrieve atmospheric properties for
15
+ transit depths, eclipse depths, or a combination of the two.
16
+
17
+ The transit spectrum is calculated from 0.2 um to 30 um, taking into
18
+ account gas absorption, H- absorption, collisionally induced absorption,
19
+ clouds, and scattering. The eclipse spectrum is calculated with the same physics included, but it does not include scattering as a source of emission; scattering is only included as a source of absorption.
20
+
21
+ The retrievers use TransitDepthCalculator/EclipseDepthCalculator as a forward
22
+ model, and can retrieve atmospheric properties using either MCMC or nested
23
+ sampling. The speed of these retrievals is highly dependent on the wavelength
24
+ range, data precision, prior ranges, opacity resolution, and number of live points (nested sampling)
25
+ or iterations/walkers (MCMC). A very rough guideline is that a retrieval with
26
+ 250 live points and R=20k for
27
+ STIS + WFC3 + IRAC 3.6 um + IRAC 4.5 um data takes 19 minutes with multinest, or 75 minutes with dynesty. There are a variety of ways to speed up the retrieval, as
28
+ described on the Q&A page.
@@ -24,11 +24,10 @@ their actual, wavelength-dependent refractive indices, assuming a standard
24
24
  deviation in the lognormal size distribution of 0.5::
25
25
 
26
26
  calculator.compute_depths(Rs, Mp, Rp, T,
27
- ri = "TiO2", frac_scale_height = 0.5, number_density = 1e9,
27
+ ri = "TiO2_anatase", frac_scale_height = 0.5, number_density = 1e9,
28
28
  part_size = 1e-6, cloudtop_pressure=1e5)
29
29
 
30
- The supported species are MgSiO3_sol, SiO2_amorph, and TiO2, using the
31
- refractive index data of `Kitzmann et al 2017 <https://arxiv.org/abs/1710.04946>`_.
30
+ The supported species are those with `data in LX-MIE <https://github.com/NewStrangeWorlds/LX-MIE/tree/master/compilation>`, with the exception of Fe2SiO4 and MgAl2O4 (which do not have refractive index data all the way to 0.2 um).
32
31
 
33
32
  To retrieve Mie scattering parameters, make sure to set log_scatt_factor to 0,
34
33
  and log_number_density to a finite value. n and log_k specify the real component and log10 of the imaginary component of the complex refractive index. We recommend fixing at least n. Example::
@@ -0,0 +1,110 @@
1
+ Questions & Answers
2
+ *******************
3
+
4
+ This document describes niche use cases that the Quick Start does not cover.
5
+ For typical usage patterns, consult the files in examples/ and the Quick Start,
6
+ in that order.
7
+
8
+ * **What physics does PLATON take into account?**
9
+
10
+ We account for gas absorption, collisional absorption, an opaque
11
+ cloud deck, Rayleigh scattering, and haze scattering--either a user-specified slope and amplitude, or Mie scattering. H- bound-free and free-free absorption
12
+ is not enabled by default, but can be turned on by passing add_H_minus_absorption=True to compute_depths. 35 chemical species are included
13
+ in our calculations, namely the ones listed in data/species_info.
14
+ The abundances of these species were calculated using FastChem for a
15
+ grid of metallicity, C/O ratio, temperature, and pressure, assuming
16
+ equilibrium chemistry with or without condensation. Condensation can be
17
+ toggled using include_condensation=True/False. Metallicity ranges from 10^-2 to 10^3 times solar, C/O
18
+ ratio from 0.001 to 2, temperature from 200 to 3000 K, and pressure
19
+ from 10^-4 to 10^8 Pa. If you wander outside these limits, PLATON
20
+ will throw a ValueError.
21
+
22
+ * **How do I specify custom abundances and T/P profiles?**
23
+
24
+ One can set vertically constant abundances for some species
25
+ by getting the equilibrium abundances, then modifying them ::
26
+
27
+ from platon.abundance_getter import AbundanceGetter
28
+ getter = AbundanceGetter()
29
+ # Solar logZ and C/O ratio. Modify as required.
30
+ abundances = getter.get(0, 0.5)
31
+
32
+ # Zero out CO. (Note that if CO is a major component, you should probably
33
+ # renormalize the abundances of other species so that they add up to 1.)
34
+ abundances["CO"] *= 0
35
+
36
+ # Set CH4 abundance to a constant throughout the atmosphere
37
+ abundances["CH4"] *= 0
38
+ abundances["CH4"] += 1e-5
39
+
40
+
41
+ * **How do I do check what effect a species has on the spectrum?**
42
+ You can zero out its opacity:
43
+
44
+ calculator.compute_depths(..., zero_opacities=["H2O"])
45
+
46
+ Alternatively, you can delete absorption coefficients from PLATON_DIR/platon/data/Absorption,
47
+ which also has the effect of zeroing the opacity of those molecules.
48
+
49
+
50
+ * **Which parameters are supported in retrieval?**
51
+ See the documentation for :func:`~platon.combined_retriever.CombinedRetriever.get_default_fit_info`.
52
+ All arguments to this method are possible fit parameters. However, we
53
+ recommend not fitting for T_star, as it has a very small effect on the result
54
+ to begin with. Mp and Rs are usually measured to greater precision than you
55
+ can achieve in a fit, but we recommend fitting them with Gaussian priors to
56
+ take into account the measurement errors.
57
+
58
+ * **Should I use run_dynesty, run_multinest, or run_emcee?**
59
+ We recommend run_multinest. We recommend nested sampling because it handles multimodal distributions more robustly, and because it has an
60
+ intuitive stopping criterion. With emcee, checking for convergence is non-trivial. Between the two nested sampling algorithms,
61
+ we typically find multinest to be faster, and have anecdotal evidence that it is more robust.
62
+
63
+ * **My corner plots look ugly. What do I do?**
64
+
65
+ If you're using nested sampling, increase the number of live points. This
66
+ will increase the number of samples your corner plot is generated from: ::
67
+
68
+ # By default, nlive is 250
69
+ result = retriever.run_dynesty(bins, depths, errors, fit_info, nlive=1000)
70
+
71
+ If you're using MCMC, increase nsteps from the default of 1000 to 10,000.
72
+
73
+ * **How do I get statistics from the retrieval?**
74
+
75
+ Look at BestFit.txt. It'll have the 16th, 50th, and 84th percentiles of
76
+ all parameters, as well as the best fit values.
77
+
78
+ * **PLATON is still too slow! How do I make it faster?**
79
+
80
+ If you don't have a CUDA-capable GPU, get one! Even a cheap gaming GPU, like a $300 RTX 3060 12 GB, will speed up PLATON many-fold.
81
+
82
+ If PLATON is still too slow, try decreasing num_profile_heights in
83
+ transit_depth_calculator.py (for transit depths) or
84
+ TP_profile (for eclipse depths). Of course, this comes at the expense of
85
+ accuracy. You can also include fewer opacities than the default by passing
86
+ include_opacities, or downsample the opacities by a certain factor by passing downsample::
87
+
88
+ calc = TransitDepthCalculator(include_opacities=["CH4", "H2O", "CO2"], downsample=2)
89
+
90
+ This loads only the CH4, H2O, and CO2 opacities, and downsamples them by a factor of 2 (to a resolution of 10k, if you started with the default R=20k opacities).
91
+
92
+ In some cases, dynesty becomes extremely inefficient with the default
93
+ sampling method. In those cases, pass sample="rwalk" to run_dynesty, which
94
+ will cap the sampling efficiency at 1/25, 25 being the number of random walks to take. According to the dynesty documentation, 25 should be sufficient
95
+ at low dimensionality (<=10), but 50 might be necessary at
96
+ moderate dimensionality (10-20). To change the number of random walks to 50, pass walks=50.
97
+
98
+ * **How small can I set my wavelength bins?**
99
+ The error in the opacity sampling calculation for a given reasonably small bin is equal to the standard deviation of the
100
+ transit/eclipse depths in that bin divided by sqrt(N), where N is the number of points in the bin.
101
+ With the default opacity resolution of R=20000, N = 20000 * (ln(max_wavelength/min_wavelength)). We recommend that you
102
+ keep N above 20 to avoid unreasonably large errors. PLATON will throw a
103
+ warning for N <= 5.
104
+
105
+ * **What opacity resolution should I use? How many live points**
106
+ This is a tradeoff between running time and accuracy. Roughly speaking,
107
+ the running time is proportional to the resolution and to the number of live
108
+ points.
109
+
110
+ We recommend a staged approach to retrievals. Exploratory data analysis can be done with R=10,000 opacities and 250 live points. In the process, intermittent spot checks should be performed with R=20,000 opacities and 500 live points to check the effect of resolution, and with R=10,000 opacities and 1000 live points to check the effect of sparse sampling. When one is satisfied with the exploratory data analysis and is ready to finalize the results, one should run a final retrieval with R=20,000 opacities and 1000 live points.
@@ -21,36 +21,41 @@ To compute transit depths, look at transit_depth_example.py, then go to
21
21
 
22
22
  # The initializer loads all data files. Create a TransitDepthCalculator
23
23
  # object and hold on to it
24
- calculator = TransitDepthCalculator(method="xsec") #"ktables" for correlated k
24
+ calculator = TransitDepthCalculator()
25
25
 
26
26
  # compute_depths is fast once data files are loaded
27
27
  wavelengths, depths, info_dict = calculator.compute_depths(Rs, Mp, Rp, T, logZ=0, CO_ratio=0.53, full_output=True)
28
28
 
29
29
  You can adjust a variety of parameters, including the metallicity (Z) and C/O
30
30
  ratio. By default, logZ = 0 and C/O = 0.53. Any other value for
31
- logZ and C/O in the range -1 < logZ < 3 and 0.05 < C/O < 2 can also be used.
31
+ logZ and C/O in the range -2 < logZ < 3 and 0.001 < C/O < 2 can also be used.
32
32
  full_output=True indicates you'd like extra information about the atmosphere,
33
33
  which is returned in info_dict. info_dict includes parameters like the
34
34
  temperatures, pressures, radii, abundances, and molecular weights of each
35
35
  atmospheric layer, and the line of sight optical depth (tau_los) through each
36
36
  layer.
37
37
 
38
- You can also specify custom abundances, such as by providing the filename of
39
- one of the abundance files included in the package (from ExoTransmit). The
40
- custom abundance files specified by the user must be compatible with the
41
- ExoTransmit format::
38
+ You can also specify custom abundances, albeit in a somewhat hacky way::
39
+
40
+ from platon.abundance_getter import AbundanceGetter
41
+ abundances = AbundanceGetter().get(0, 0.5) #logZ=0, C/O=0.5 equilibrium abundances
42
+ abundances["H2O"] *= 0
43
+ abundances["H2O"] += 1e-4 #10^-4 VMR at all temperatures and pressures
42
44
 
45
+ abundances["CO2"] *= 0
46
+ abundances["CO2"] += 1e-5
47
+
43
48
  calculator.compute_depths(Rs, Mp, Rp, T, logZ=None, CO_ratio=None,
44
- custom_abundances=filename)
45
-
46
- To retrieve atmospheric parameters, look at retrieve_multinest.py, retrieve_emcee.py, or retrieve_eclipses.py, then go to
47
- :class:`.CombinedRetriever` for more info. In short::
49
+ custom_abundances=abundances)
50
+
51
+ To retrieve atmospheric parameters, look at retrieve_dynesty.py, retrieve_multinest.py, retrieve_emcee.py, or retrieve_eclipses.py, then go to
52
+ :class:`.CombinedRetriever` for more info. In short, for an equilibrium retrieval::
48
53
 
49
54
  from platon.fit_info import FitInfo
50
55
  from platon.combined_retriever import CombinedRetriever
51
56
 
52
57
  retriever = CombinedRetriever()
53
- fit_info = retriever.get_default_fit_info(Rs, Mp, Rp, T, logZ=0, T_star=6100)
58
+ fit_info = retriever.get_default_fit_info(Rs, Mp, Rp, T, logZ=0, CO_ratio=0.5, T_star=6100)
54
59
 
55
60
  # Decide what you want to fit for, and add those parameters to fit_info
56
61
 
@@ -64,15 +69,16 @@ To retrieve atmospheric parameters, look at retrieve_multinest.py, retrieve_emce
64
69
  fit_info.add_uniform_fit_param('T', 0.5*T_guess, 1.5*T_guess)
65
70
  fit_info.add_uniform_fit_param("log_scatt_factor", 0, 1)
66
71
  fit_info.add_uniform_fit_param("logZ", -1, 3)
72
+ fit_info.add_uniform_fit_param("CO_ratio", 0.2, 2)
67
73
  fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 5)
68
74
  fit_info.add_uniform_fit_param("error_multiple", 0.5, 5)
69
75
 
70
- # Run nested sampling
71
- result = retriever.run_multinest(
76
+ # Run nested sampling. You can replace run_dynesty with run_pymultinest,
77
+ # which is sometimes much faster and more robust
78
+ result = retriever.run_dynesty(
72
79
  bins, depths, errors, #transit bins, depths, errors
73
80
  None, None, None, #eclipse bins, depths, errors
74
- fit_info, plot_best=True,
75
- rad_method="xsec") #Change this to "ktables" for correlated k
81
+ fit_info, plot_best=True)
76
82
 
77
83
  Here, `bins` is a N x 2 array representing the start and end wavelengths of the
78
84
  bins, in metres; `depths` is a list of N transit depths; and `errors` is a list
@@ -81,7 +87,7 @@ fit solution should be plotted, along with the measured transit depths and
81
87
  their errors.
82
88
 
83
89
  The example above retrieves the planetary radius (at a reference pressure
84
- of 100,000 Pa), the temperature of the isothermal atmosphere, and the
90
+ of 10^5 Pa), the temperature of the isothermal atmosphere, and the
85
91
  metallicity. Other parameters you can retrieve for include the stellar radius,
86
92
  the planetary mass, C/O ratio,
87
93
  the cloudtop pressure, the scattering factor, the scattering slope,
@@ -89,17 +95,32 @@ and the error multiple--which multiplies all errors by a constant. We recommend
89
95
  either fixing the stellar radius and planetary mass to the measured values, or
90
96
  setting Gaussian priors on them to account for measurement errors.
91
97
 
98
+ To do a free retrieval, set logZ=None, CO_ratio=None, and fit_vmr=True in get_default_fit_info, and add::
99
+
100
+ fit_info.add_gases_vmr(["CH4", "CO2", "CO", "H2O", "H2S", "H2-He"], 10**-12, 10**-2)
101
+
102
+ This fits the log VMR of the gases CH4, CO2, CO, H2O, and H2S, with a H2/He mixture
103
+ as the background gas. The VMRs of the non-background gases are given log-uniform
104
+ priors between 1e-12 and 1e-2. Alternatively, you can do a free retrieval with
105
+ centered-log-ratio (CLR) priors::
106
+
107
+ fit_info.add_gases_vmr(["CH4", "CO2", "CO", "H2O", "H2S"])
108
+
109
+ With a CLR prior, all gases are treated equally, and there is no pre-defined background gas.
110
+
92
111
  Once you get the `result` object, you should store the object, in addition
93
112
  to plotting the posterior distribution and the best fit::
94
113
 
95
114
  with open("example_retrieval_result.pkl", "wb") as f:
96
115
  pickle.dump(result, f)
97
-
98
- result.plot_corner("my_corner.png")
99
- result.plot_spectrum("my_best_fit") #leave off .png
116
+
117
+ from platon.plotter import Plotter
118
+ plotter = Plotter()
119
+ plotter.plot_retrieval_transit_spectrum(result, prefix="best_fit")
120
+ plotter.plot_retrieval_corner(result, filename="dynesty_corner.png")
100
121
 
101
122
  If you prefer using MCMC instead of Nested Sampling in your retrieval, you can
102
- use the run_emcee method instead of the run_multinest method. Do note that
123
+ use the run_emcee method instead of the run_dynesty method. Do note that
103
124
  Nested Sampling is recommended, as it is not trivial to deal with multi-modal
104
125
  posteriors or to check for convergence with emcee::
105
126
 
@@ -107,4 +128,6 @@ posteriors or to check for convergence with emcee::
107
128
 
108
129
  For MCMC, the number of walkers and iterations/steps can also be specified. The
109
130
  `result` object returned by run_emcee is different from that returned
110
- by run_multinest, but still supports plot_corner and plot_spectrum.
131
+ by run_dynesty, but the same plotter can be used.
132
+
133
+ After a retrieval, PLATON automatically computes the Pareto importance sampling leave-one-out cross-validation score (PSIS-LOO), first used in an exoplanet context by `Welbanks et al 2023 <https://ui.adsabs.harvard.edu/abs/2023AJ....165..112W/abstract>`_. The values are stored in the retrieval pickle file as "loos" (also see "loo_total" and "loo_ks").
@@ -0,0 +1,16 @@
1
+ Surface emission (beta)
2
+ =======================
3
+ PLATON can now calculate the emission from a rocky planet's surface, using realistic albedos newly measured in a lab by Caltech graduate student Kim Paragas. This feature should be considered beta until Paragas et al. (in prep) comes out.
4
+
5
+ To try out this feature, take a look at examples/surface_example.py. One begins by initializing an eclipse depth calculator with either the "HES2012" (Hu, Ehlmann, Seager 2012) spectral library or the new "Paragas" library::
6
+
7
+ calc = EclipseDepthCalculator(surface_library="Paragas")
8
+
9
+ Then, call compute_depths with all the ordinary eclipse calculator arguments, but also the surface arguments::
10
+
11
+ wavelengths, depths, info_dict = calc.compute_depths(...,
12
+ surface_pressure = Psurf, surface_type=surface_type, semimajor_axis=semi_major_axis, surface_temp = surface_temp
13
+
14
+ )
15
+
16
+ The available surface types are the columns in data/HES2012/hemi_refls.csv or data/Paragas/hemi_refls.csv. surface_temp can be None, in which case the temperature will be automatically calculated from energy balance.
@@ -16,7 +16,7 @@ calc = EclipseDepthCalculator(method="xsec") #"ktables" for correlated k
16
16
  #calc.change_wavelength_bins(bins)
17
17
 
18
18
  wavelengths, depths, info_dict = calc.compute_depths(p, R_sun, M_jup, R_jup, 5700, full_output=True)
19
- plt.semilogy(p.temperatures, p.pressures)
19
+ plt.semilogy(p.get_temperatures(), p.get_pressures())
20
20
  plt.xlabel("Temperature (K)")
21
21
  plt.ylabel("Pressure (Pa)")
22
22
  plt.figure()
@@ -0,0 +1,106 @@
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ import pickle
4
+
5
+ from platon.fit_info import FitInfo
6
+ from platon.combined_retriever import CombinedRetriever
7
+ from platon.constants import R_sun, R_jup, M_jup
8
+ from platon.plotter import Plotter
9
+
10
+ def hd209458b_stis():
11
+ #http://iopscience.iop.org/article/10.1086/510111/pdf
12
+ star_radius = 1.125 * R_sun
13
+ wave_bins = [[302,347], [348,402], [403,457], [458,512], [512,567], [532,629], [629,726], [727,824], [825,922], [922,1019]]
14
+ wave_bins = 1e-9 * np.array(wave_bins)
15
+
16
+ planet_radii = [1.3263, 1.3254, 1.32, 1.3179, 1.3177, 1.3246, 1.3176, 1.3158, 1.32, 1.3268]
17
+ radii_errors = [0.0018, 0.0010, 0.0006, 0.0006, 0.0010, 0.0006, 0.0005, 0.0006, 0.0006, 0.0013]
18
+ transit_depths = (np.array(planet_radii)*R_jup/star_radius)**2 + 60e-6
19
+ transit_errors = np.array(radii_errors)/np.array(planet_radii) * 2 * transit_depths
20
+ return wave_bins, transit_depths, transit_errors
21
+
22
+ def hd209458b_wfc3():
23
+ #https://arxiv.org/pdf/1302.1141.pdf
24
+ wavelengths = 1e-6*np.array([1.119, 1.138, 1.157, 1.175, 1.194, 1.213, 1.232, 1.251, 1.270, 1.288, 1.307, 1.326, 1.345, 1.364, 1.383, 1.401, 1.420, 1.439, 1.458, 1.477, 1.496, 1.515, 1.533, 1.552, 1.571, 1.590, 1.609, 1.628])
25
+ wavelength_bins = [[w-0.0095e-6, w+0.0095e-6] for w in wavelengths]
26
+ depths = 1e-6 * np.array([14512.7, 14546.5, 14566.3, 14523.1, 14528.7, 14549.9, 14571.8, 14538.6, 14522.2, 14538.4, 14535.9, 14604.5, 14685.0, 14779.0, 14752.1, 14788.8, 14705.2, 14701.7, 14677.7, 14695.1, 14722.3, 14641.4, 14676.8, 14666.2, 14642.5, 14594.1, 14530.1, 14642.1])
27
+ errors = 1e-6 * np.array([50.6, 35.5, 35.2, 34.6, 34.1, 33.7, 33.5, 33.6, 33.8, 33.7, 33.4, 33.4, 33.5, 33.9, 34.4, 34.5, 34.7, 35.0, 35.4, 35.9, 36.4, 36.6, 37.1, 37.8, 38.6, 39.2, 39.9, 40.8])
28
+ return np.array(wavelength_bins), depths, errors
29
+
30
+ def hd209458b_spitzer():
31
+ #https://arxiv.org/pdf/1504.05942.pdf
32
+
33
+ wave_bins = []
34
+ depths = []
35
+ errors = []
36
+
37
+ wave_bins.append([3.2, 4.0])
38
+ RpRs = np.average([0.12077, 0.1222, 0.11354, 0.11919], weights=1.0/np.array([0.00085, 0.00062, 0.00087, 0.00032]))
39
+ depths.append(RpRs**2)
40
+ errors.append(0.00032/RpRs * 2 * depths[-1])
41
+
42
+ wave_bins.append([4.0, 5.0])
43
+ RpRs = np.average([0.12199, 0.12099], weights=1.0/np.array([0.00094, 0.00029]))
44
+ depths.append(RpRs**2)
45
+ errors.append(0.00029/RpRs * 2 * depths[-1])
46
+
47
+ wave_bins.append([5.1, 6.3])
48
+ RpRs = np.average([0.12007, 0.11880], weights=1.0/np.array([0.00248, 0.00272]))
49
+ depths.append(RpRs**2)
50
+ errors.append(0.00248/RpRs * 2 * depths[-1])
51
+
52
+ wave_bins.append([6.6, 9.0])
53
+ RpRs = np.average([0.12007, 0.11991], weights=1.0/np.array([0.00114, 0.00073]))
54
+ depths.append(RpRs**2)
55
+ errors.append(0.00073/RpRs * 2 * depths[-1])
56
+
57
+ return 1e-6*np.array(wave_bins), np.array(depths), np.array(errors)
58
+
59
+ stis_bins, stis_depths, stis_errors = hd209458b_stis()
60
+ wfc3_bins, wfc3_depths, wfc3_errors = hd209458b_wfc3()
61
+ spitzer_bins, spitzer_depths, spitzer_errors = hd209458b_spitzer()
62
+
63
+ bins = np.concatenate([stis_bins, wfc3_bins, spitzer_bins])
64
+ depths = np.concatenate([stis_depths, wfc3_depths, spitzer_depths])
65
+ errors = np.concatenate([stis_errors, wfc3_errors, spitzer_errors])
66
+
67
+ R_guess = 1.4 * R_jup
68
+ T_guess = 1200
69
+
70
+ #create a Retriever object
71
+ retriever = CombinedRetriever()
72
+
73
+ #create a FitInfo object and set best guess parameters
74
+ fit_info = retriever.get_default_fit_info(
75
+ Rs=1.19 * R_sun, Mp=0.73 * M_jup, Rp=R_guess, T=T_guess,
76
+ logZ=0, CO_ratio=0.53, log_cloudtop_P=4,
77
+ log_scatt_factor=0, scatt_slope=4, error_multiple=1, T_star=6091)
78
+
79
+ #Add fitting parameters - this specifies which parameters you want to fit
80
+ #e.g. since we have not included cloudtop_P, it will be fixed at the value specified in the constructor
81
+
82
+ fit_info.add_gaussian_fit_param('Rs', 0.02*R_sun)
83
+ fit_info.add_gaussian_fit_param('Mp', 0.04*M_jup)
84
+
85
+ fit_info.add_uniform_fit_param('Rp', 0.9*R_guess, 1.1*R_guess)
86
+ fit_info.add_uniform_fit_param('T', 0.5*T_guess, 1.5*T_guess)
87
+ fit_info.add_uniform_fit_param("log_scatt_factor", 0, 1)
88
+ fit_info.add_uniform_fit_param("logZ", -1, 3)
89
+ fit_info.add_uniform_fit_param("log_cloudtop_P", -0.99, 5)
90
+ fit_info.add_uniform_fit_param("error_multiple", 0.5, 5)
91
+
92
+ #Use Nested Sampling to do the fitting
93
+ result = retriever.run_dynesty(bins, depths, errors,
94
+ None, None, None,
95
+ fit_info,
96
+ sample="rwalk",
97
+ rad_method="xsec") #"ktables" to use corr-k
98
+ with open("example_retrieval_result.pkl", "wb") as f:
99
+ pickle.dump(result, f)
100
+
101
+ #Useful members: result.samples, result.weights, result.logl, result.logp
102
+
103
+ #Plot the spectrum and save it to best_fit.png
104
+ plotter = Plotter()
105
+ plotter.plot_retrieval_transit_spectrum(result, prefix="best_fit")
106
+ plotter.plot_retrieval_corner(result, filename="dynesty_corner.png")
@@ -5,6 +5,7 @@ import pickle
5
5
  from platon.fit_info import FitInfo
6
6
  from platon.combined_retriever import CombinedRetriever
7
7
  from platon.constants import R_sun, R_jup, M_jup, AU
8
+ from platon.plotter import Plotter
8
9
 
9
10
  #Retrieval on HD 189733b eclipse data
10
11
 
@@ -54,7 +55,8 @@ fit_info = retriever.get_default_fit_info(
54
55
  log_scatt_factor=0, scatt_slope=4, error_multiple=1, T_star=T_star,
55
56
  a = 0.03142 * AU,
56
57
  log_k_th = -2.52, log_gamma=-0.8, log_gamma2=-0.8, alpha=0.5, beta=1,
57
- profile_type="radiative_solution" #"isothermal" for isothermal fitting
58
+ profile_type="radiative_solution", #"isothermal" for isothermal fitting
59
+ offset_start=0, offset_end=len(wfc3_bins)
58
60
  )
59
61
 
60
62
  #Add fitting parameters - this specifies which parameters you want to fit
@@ -72,10 +74,10 @@ fit_info.add_uniform_fit_param("alpha", 0, 0.5)
72
74
  fit_info.add_uniform_fit_param("beta", 0, 2)
73
75
 
74
76
  #Nuisance parameters
75
- fit_info.add_gaussian_fit_param("wfc3_offset_eclipse", 39e-6)
77
+ fit_info.add_gaussian_fit_param("offset_eclipse", 39e-6)
76
78
 
77
79
  #Use Nested Sampling to do the fitting
78
- result = retriever.run_multinest(None, None, None,
80
+ result = retriever.run_dynesty(None, None, None,
79
81
  eclipse_bins, eclipse_depths, eclipse_errors,
80
82
  fit_info, nlive=200,
81
83
  sample="rwalk",
@@ -84,8 +86,16 @@ result = retriever.run_multinest(None, None, None,
84
86
  with open("example_retrieval_result.pkl", "wb") as f:
85
87
  pickle.dump(result, f)
86
88
 
89
+ plotter = Plotter()
87
90
  #Plot the spectrum and save it to best_fit.png
88
- result.plot_spectrum("best_fit")
91
+ plotter.plot_retrieval_eclipse_spectrum(result, prefix='best_fit')
89
92
 
90
93
  #Plot the 2D posteriors with "corner" package and save it to multinest_corner.png
91
- result.plot_corner("multinest_corner.png")
94
+ plotter.plot_retrieval_corner(result, filename="dynesty_corner.png")
95
+
96
+ #Plot the contribution function
97
+ plotter.plot_eclipse_contrib_func(result.best_fit_eclipse_dict, prefix='best_fit')
98
+
99
+ #Plot the retrieved TP profiles
100
+ plotter.plot_retrieval_TP_profiles(result, plot_samples=True, plot_1sigma_bounds=False, prefix='dynesty')
101
+
@@ -5,6 +5,7 @@ import pickle
5
5
  from platon.fit_info import FitInfo
6
6
  from platon.combined_retriever import CombinedRetriever
7
7
  from platon.constants import R_sun, R_jup, M_jup
8
+ from platon.plotter import Plotter
8
9
 
9
10
  def hd209458b_stis():
10
11
  #http://iopscience.iop.org/article/10.1086/510111/pdf
@@ -103,8 +104,6 @@ with open("example_retrieval_result.pkl", "wb") as f:
103
104
 
104
105
  #Useful members: result.chain, result.lnprobability, result.flatchain, result.flatlnprobability
105
106
 
106
- #Plot the spectrum and save it to best_fit.png
107
- result.plot_spectrum("best_fit")
108
-
109
- #Plot the 2D posteriors with "corner" package and save it to multinest_corner.png
110
- result.plot_corner("emcee_corner.png")
107
+ plotter = Plotter()
108
+ plotter.plot_retrieval_transit_spectrum(result, prefix="best_fit")
109
+ plotter.plot_retrieval_corner(result, filename="emcee_corner.png")