platon 6.3__tar.gz → 7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {platon-6.3/platon.egg-info → platon-7.0}/PKG-INFO +26 -11
  2. {platon-6.3 → platon-7.0}/README.md +6 -4
  3. platon-7.0/platon/TP_profile.py +163 -0
  4. platon-7.0/platon/__init__.py +20 -0
  5. platon-7.0/platon/_atmosphere_solver.py +794 -0
  6. platon-7.0/platon/_forward_model.py +799 -0
  7. platon-7.0/platon/_forward_prep.py +216 -0
  8. platon-7.0/platon/_get_data.py +83 -0
  9. platon-7.0/platon/_hist.py +29 -0
  10. platon-7.0/platon/_interpolator_3D.py +115 -0
  11. platon-7.0/platon/_loader.py +18 -0
  12. platon-7.0/platon/_mie_cache.py +77 -0
  13. platon-7.0/platon/_mie_jax.py +407 -0
  14. {platon-6.3 → platon-7.0}/platon/_output_writer.py +0 -3
  15. {platon-6.3 → platon-7.0}/platon/_params.py +4 -3
  16. {platon-6.3 → platon-7.0}/platon/_species_data_reader.py +11 -13
  17. {platon-6.3 → platon-7.0}/platon/abundance_getter.py +26 -20
  18. platon-7.0/platon/combined_retriever.py +958 -0
  19. platon-7.0/platon/eclipse_depth_calculator.py +220 -0
  20. {platon-6.3 → platon-7.0}/platon/fit_info.py +57 -1
  21. platon-7.0/platon/plotter.py +368 -0
  22. platon-7.0/platon/terminator.py +159 -0
  23. platon-7.0/platon/transit_depth_calculator.py +412 -0
  24. {platon-6.3 → platon-7.0/platon.egg-info}/PKG-INFO +26 -11
  25. {platon-6.3 → platon-7.0}/platon.egg-info/SOURCES.txt +13 -13
  26. platon-7.0/platon.egg-info/requires.txt +11 -0
  27. {platon-6.3 → platon-7.0}/platon.egg-info/top_level.txt +0 -1
  28. platon-7.0/pyproject.toml +49 -0
  29. platon-7.0/setup.cfg +4 -0
  30. platon-7.0/tests/test_TP_profiles.py +87 -0
  31. platon-7.0/tests/test_eclipse_depth_calculator.py +84 -0
  32. {platon-6.3 → platon-7.0}/tests/test_eclipse_retrieval.py +2 -2
  33. platon-7.0/tests/test_get_data.py +115 -0
  34. platon-7.0/tests/test_hydrostatic.py +41 -0
  35. {platon-6.3 → platon-7.0}/tests/test_mie_absorption.py +14 -15
  36. platon-7.0/tests/test_mie_jax.py +103 -0
  37. platon-7.0/tests/test_mie_overflow.py +41 -0
  38. platon-7.0/tests/test_multinest.py +70 -0
  39. platon-7.0/tests/test_nautilus.py +101 -0
  40. {platon-6.3 → platon-7.0}/tests/test_params.py +2 -2
  41. platon-7.0/tests/test_retrieve.py +277 -0
  42. platon-7.0/tests/test_stellar_grid.py +45 -0
  43. platon-7.0/tests/test_transit_depth_calculator.py +389 -0
  44. platon-7.0/tests/test_two_sector.py +344 -0
  45. platon-6.3/platon/TP_profile.py +0 -117
  46. platon-6.3/platon/__init__.py +0 -4
  47. platon-6.3/platon/_atmosphere_solver.py +0 -485
  48. platon-6.3/platon/_cupy_numpy.py +0 -25
  49. platon-6.3/platon/_get_data.py +0 -72
  50. platon-6.3/platon/_hist.py +0 -22
  51. platon-6.3/platon/_hydrostatic_solver.py +0 -49
  52. platon-6.3/platon/_interpolator_3D.py +0 -77
  53. platon-6.3/platon/_loader.py +0 -14
  54. platon-6.3/platon/_mie_cache.py +0 -66
  55. platon-6.3/platon/_tau_calculator.py +0 -26
  56. platon-6.3/platon/backup.py +0 -470
  57. platon-6.3/platon/combined_retriever.py +0 -681
  58. platon-6.3/platon/custom_dynesty_result.py +0 -36
  59. platon-6.3/platon/eclipse_depth_calculator.py +0 -225
  60. platon-6.3/platon/plotter.py +0 -258
  61. platon-6.3/platon/retriever.py +0 -137
  62. platon-6.3/platon/surface_calculator.py +0 -287
  63. platon-6.3/platon/transit_depth_calculator.py +0 -315
  64. platon-6.3/platon/visualizer.py +0 -120
  65. platon-6.3/platon.egg-info/requires.txt +0 -10
  66. platon-6.3/setup.cfg +0 -7
  67. platon-6.3/setup.py +0 -30
  68. platon-6.3/tests/__init__.py +0 -0
  69. platon-6.3/tests/test_TP_profiles.py +0 -70
  70. platon-6.3/tests/test_eclipse_depth_calculator.py +0 -104
  71. platon-6.3/tests/test_get_data.py +0 -28
  72. platon-6.3/tests/test_retrieve.py +0 -136
  73. platon-6.3/tests/test_tau_calculator.py +0 -63
  74. platon-6.3/tests/test_transit_depth_calculator.py +0 -201
  75. {platon-6.3 → platon-7.0}/LICENSE +0 -0
  76. {platon-6.3 → platon-7.0}/MANIFEST.in +0 -0
  77. {platon-6.3 → platon-7.0}/platon/_mie_multi_x.py +0 -0
  78. {platon-6.3 → platon-7.0}/platon/constants.py +0 -0
  79. {platon-6.3 → platon-7.0}/platon/errors.py +0 -0
  80. {platon-6.3 → platon-7.0}/platon/params.py +0 -0
  81. {platon-6.3 → platon-7.0}/platon/psis.py +0 -0
  82. {platon-6.3 → platon-7.0}/platon/retrieval_result.py +0 -0
  83. {platon-6.3 → platon-7.0}/platon.egg-info/dependency_links.txt +0 -0
  84. {platon-6.3 → platon-7.0}/platon.egg-info/not-zip-safe +0 -0
  85. {platon-6.3 → platon-7.0}/tests/test_mie.py +0 -0
@@ -1,23 +1,38 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: platon
3
- Version: 6.3
3
+ Version: 7.0
4
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
5
+ Author: Yayaati Chachan, Tyler Fairnington
6
+ Author-email: Michael Zhang <zmzhang@uchicago.edu>
7
+ License-Expression: GPL-3.0-only
8
+ Project-URL: Homepage, https://github.com/ideasrule/platon
8
9
  Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
10
  Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
11
12
  Description-Content-Type: text/markdown
12
13
  License-File: LICENSE
13
-
14
- # PLanetary Atmospheric Transmission for Observer Noobs
14
+ Requires-Dist: numpy>=2.0
15
+ Requires-Dist: scipy
16
+ Requires-Dist: jax[cuda12]
17
+ Requires-Dist: emcee
18
+ Requires-Dist: dynesty
19
+ Requires-Dist: corner
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: pandas
22
+ Requires-Dist: astropy
23
+ Requires-Dist: nautilus-sampler
24
+ Requires-Dist: pytest
25
+ Dynamic: license-file
26
+
27
+ # PLanetary Atmospheric Tool for Observer Noobs
15
28
  <img src="logo.png" height="315">
16
29
 
17
30
  [![codecov](https://codecov.io/gh/ideasrule/platon/branch/devel/graph/badge.svg)](https://codecov.io/gh/ideasrule/platon)
18
31
  [![arXiv](http://img.shields.io/badge/arXiv-2004.09513-orange.svg)](https://arxiv.org/abs/2004.09513)
19
32
  [![arXiv](http://img.shields.io/badge/arXiv-1811.11761-orange.svg)](https://arxiv.org/abs/1811.11761)
20
33
 
34
+ **Oct 30, 2026: PLATON v7.0 is out! After a complete rewrite by Claude, PLATON is now based on JAX and ~100x faster than it used to be. Other improvements include support for multiple instrumental offsets, constant-VMR overrides in equilibrium retrievals, patchy clouds, non-isothermal T/P profiles in transit, separate morning and evening terminators, two stellar heterogeneity sources (e.g. spots + faculae), and a more robust and efficient nested sampler based on neural networks (nautilus).**
35
+
21
36
  **Feb 24, 2025: PLATON v6.3 is out! The main difference from v6.2 is that we now include realistic emission from rocky surfaces using the emissivity library from [Paragas et al 2025](https://arxiv.org/abs/2502.04433). The library contains 11 mineral compositions across 3 surface textures, and were obtained via lab reflectance measurements.**
22
37
 
23
38
  **Oct 30, 2024: PLATON v6.2 is out, with major updates! This corresponds most closely to the version described in [Zhang et al 2024](https://arxiv.org/abs/2410.22398). 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.**
@@ -29,14 +44,14 @@ which respects GitHub's size limit.**
29
44
 
30
45
  **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.**
31
46
 
32
- **NEW (October 1): Version 2 is out, with a huge number of changes! Make sure to check out the release notes, and upgrade.**
47
+ **October 1, 2018: Version 2 is out, with a huge number of changes! Make sure to check out the release notes, and upgrade.**
33
48
 
34
49
  PLATON is a fast and easy to use forward modelling and retrieval tool for
35
- exoplanet atmospheres. It was written by Michael Zhang and Yayaati Chachan, and
50
+ exoplanet atmospheres. It was written by Michael Zhang, Yayaati Chachan, and Tyler Fairnington, and
36
51
  is based on ExoTransmit by Eliza Kempton.
37
52
 
38
53
  We welcome any feedback. Please send any comments, suggestions, or bug reports
39
- to Michael Zhang: zmzhang "at" caltech.edu
54
+ to Michael Zhang: zmzhang "at" uchicago.edu
40
55
  **
41
56
  To find installation instructions and quickstart examples, read the
42
57
  documentation at: https://platon.readthedocs.io
@@ -1,10 +1,12 @@
1
- # PLanetary Atmospheric Transmission for Observer Noobs
1
+ # PLanetary Atmospheric Tool for Observer Noobs
2
2
  <img src="logo.png" height="315">
3
3
 
4
4
  [![codecov](https://codecov.io/gh/ideasrule/platon/branch/devel/graph/badge.svg)](https://codecov.io/gh/ideasrule/platon)
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
+ **Oct 30, 2026: PLATON v7.0 is out! After a complete rewrite by Claude, PLATON is now based on JAX and ~100x faster than it used to be. Other improvements include support for multiple instrumental offsets, constant-VMR overrides in equilibrium retrievals, patchy clouds, non-isothermal T/P profiles in transit, separate morning and evening terminators, two stellar heterogeneity sources (e.g. spots + faculae), and a more robust and efficient nested sampler based on neural networks (nautilus).**
9
+
8
10
  **Feb 24, 2025: PLATON v6.3 is out! The main difference from v6.2 is that we now include realistic emission from rocky surfaces using the emissivity library from [Paragas et al 2025](https://arxiv.org/abs/2502.04433). The library contains 11 mineral compositions across 3 surface textures, and were obtained via lab reflectance measurements.**
9
11
 
10
12
  **Oct 30, 2024: PLATON v6.2 is out, with major updates! This corresponds most closely to the version described in [Zhang et al 2024](https://arxiv.org/abs/2410.22398). 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.**
@@ -16,14 +18,14 @@ which respects GitHub's size limit.**
16
18
 
17
19
  **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.**
18
20
 
19
- **NEW (October 1): Version 2 is out, with a huge number of changes! Make sure to check out the release notes, and upgrade.**
21
+ **October 1, 2018: Version 2 is out, with a huge number of changes! Make sure to check out the release notes, and upgrade.**
20
22
 
21
23
  PLATON is a fast and easy to use forward modelling and retrieval tool for
22
- exoplanet atmospheres. It was written by Michael Zhang and Yayaati Chachan, and
24
+ exoplanet atmospheres. It was written by Michael Zhang, Yayaati Chachan, and Tyler Fairnington, and
23
25
  is based on ExoTransmit by Eliza Kempton.
24
26
 
25
27
  We welcome any feedback. Please send any comments, suggestions, or bug reports
26
- to Michael Zhang: zmzhang "at" caltech.edu
28
+ to Michael Zhang: zmzhang "at" uchicago.edu
27
29
  **
28
30
  To find installation instructions and quickstart examples, read the
29
31
  documentation at: https://platon.readthedocs.io
@@ -0,0 +1,163 @@
1
+ import numpy as np
2
+ from scipy.special import expn
3
+
4
+ from .constants import G
5
+ from .params import NUM_LAYERS, MIN_P, MAX_P
6
+
7
+
8
+ def _default_pressures():
9
+ return np.logspace(np.log10(MIN_P), np.log10(MAX_P), NUM_LAYERS)
10
+
11
+
12
+ class Profile:
13
+ """A temperature/pressure profile.
14
+
15
+ Create one with Profile(pressures, temperatures) to use arbitrary arrays
16
+ directly, or with one of the class-method constructors, which compute
17
+ the temperatures on the default pressure grid::
18
+
19
+ Profile.isothermal(1000)
20
+ Profile.parametric(T0, P1, alpha1, alpha2, P3, T3)
21
+ Profile.guillot(T_star, Rs, a, Mp, Rp, beta, log_k_th, log_gamma)
22
+ Profile.radiative_solution(T_star, Rs, a, Mp, Rp, beta, ...)
23
+ Profile.from_arrays(P_profile, T_profile)
24
+ Profile.from_params_dict(profile_type, params_dict)
25
+
26
+ T/P profiles are computed on the host in numpy (float64); they are tiny
27
+ arrays, and several profile types need scipy.special.expn."""
28
+
29
+ def __init__(self, pressures, temperatures):
30
+ """Profile with the given temperatures (K) at the given pressures
31
+ (Pa), used as-is with no interpolation."""
32
+ self.pressures = np.asarray(pressures, dtype=np.float64)
33
+ self.temperatures = np.asarray(temperatures, dtype=np.float64)
34
+ if self.pressures.shape != self.temperatures.shape:
35
+ raise ValueError(
36
+ "pressures and temperatures must have the same shape")
37
+ self.profile_type = None
38
+ self.profile_params = {}
39
+
40
+ @classmethod
41
+ def _parameterized(cls, temperatures, profile_type, profile_params):
42
+ profile = cls(_default_pressures(), temperatures)
43
+ profile.profile_type = profile_type
44
+ profile.profile_params = profile_params
45
+ return profile
46
+
47
+ def get_temperatures(self):
48
+ return np.array(self.temperatures)
49
+
50
+ def get_pressures(self):
51
+ return np.array(self.pressures)
52
+
53
+ @classmethod
54
+ def from_params_dict(cls, profile_type, params_dict, suffix=""):
55
+ """Creates the profile from parameters named in params_dict. If
56
+ suffix is given (e.g. "_transit"), parameters with the suffixed name
57
+ (e.g. T0_transit) override the unsuffixed ones (e.g. T0), allowing
58
+ separate profiles to coexist in one params_dict."""
59
+ if suffix:
60
+ params_dict = dict(params_dict)
61
+ for name, value in list(params_dict.items()):
62
+ if name.endswith(suffix) and value is not None:
63
+ params_dict[name[:-len(suffix)]] = value
64
+ if profile_type == "isothermal":
65
+ return cls.isothermal(params_dict["T"])
66
+ elif profile_type == "parametric":
67
+ return cls.parametric(
68
+ params_dict["T0"], 10**params_dict["log_P1"],
69
+ params_dict["alpha1"], params_dict["alpha2"],
70
+ 10**params_dict["log_P3"], params_dict["T3"])
71
+ elif profile_type == "radiative_solution":
72
+ return cls.radiative_solution(**params_dict)
73
+ elif profile_type == "guillot":
74
+ return cls.guillot(
75
+ params_dict["T_star"], params_dict["Rs"], params_dict["a"],
76
+ params_dict["Mp"], params_dict["Rp"], params_dict["beta"],
77
+ params_dict["log_k_th"], params_dict["log_gamma"],
78
+ params_dict.get("T_int", 100))
79
+ else:
80
+ raise ValueError("Unknown profile type: {}".format(profile_type))
81
+
82
+ @classmethod
83
+ def from_arrays(cls, P_profile, T_profile):
84
+ """Interpolates the given profile (in log P) onto the default pressure
85
+ grid. To use the arrays as-is, call Profile(pressures, temperatures)
86
+ instead."""
87
+ P_profile = np.asarray(P_profile)
88
+ T_profile = np.asarray(T_profile)
89
+ temperatures = np.interp(np.log10(_default_pressures()),
90
+ np.log10(P_profile), T_profile)
91
+ return cls._parameterized(temperatures, "arrays", {})
92
+
93
+ @classmethod
94
+ def isothermal(cls, T_day):
95
+ temperatures = np.ones(NUM_LAYERS) * T_day
96
+ return cls._parameterized(temperatures, "isothermal", {"T": T_day})
97
+
98
+ @classmethod
99
+ def parametric(cls, T0, P1, alpha1, alpha2, P3, T3):
100
+ '''Parametric model from https://arxiv.org/pdf/0910.1347.pdf'''
101
+ P = _default_pressures()
102
+ P0 = np.min(P)
103
+
104
+ ln_P2 = alpha2**2 * (T0 + np.log(P1 / P0)**2 / alpha1**2 - T3) - \
105
+ np.log(P1)**2 + np.log(P3)**2
106
+ ln_P2 /= 2 * np.log(P3 / P1)
107
+ P2 = np.exp(ln_P2)
108
+ T2 = T3 - np.log(P3 / P2)**2 / alpha2**2
109
+
110
+ with np.errstate(divide="ignore", invalid="ignore"):
111
+ temperatures = np.where(
112
+ P < P1, T0 + np.log(P / P0)**2 / alpha1**2,
113
+ np.where(P < P3, T2 + np.log(P / P2)**2 / alpha2**2, T3))
114
+ return cls._parameterized(temperatures, "parametric", dict(
115
+ T0=T0, P1=P1, alpha1=alpha1, alpha2=alpha2, P3=P3, T3=T3))
116
+
117
+ @classmethod
118
+ def guillot(cls, T_star, Rs, a, Mp, Rp, beta, log_k_th, log_gamma,
119
+ T_int=100):
120
+ """The one-visible-channel profile from Guillot (2010). As in
121
+ radiative_solution, the irradiation temperature is
122
+ beta * T_star * sqrt(Rs / (2a)); this is radiative_solution with a
123
+ single visible channel. log_k_th is log10 of the thermal opacity in
124
+ m^2/kg; all other inputs are SI."""
125
+ temperatures = cls.radiative_solution(
126
+ T_star, Rs, a, Mp, Rp, beta, log_k_th, log_gamma,
127
+ T_int=T_int).temperatures
128
+ return cls._parameterized(temperatures, "guillot", dict(
129
+ T_star=T_star, Rs=Rs, a=a, Mp=Mp, Rp=Rp, beta=beta,
130
+ log_k_th=log_k_th, log_gamma=log_gamma, T_int=T_int))
131
+
132
+ @classmethod
133
+ def radiative_solution(cls, T_star, Rs, a, Mp, Rp, beta,
134
+ log_k_th, log_gamma, log_gamma2=None,
135
+ alpha=0, T_int=100, **ignored_kwargs):
136
+ '''From Line et al. 2013: http://adsabs.harvard.edu/abs/2013ApJ...775..137L, Equation 13 - 16.'''
137
+
138
+ k_th = 10.0**log_k_th
139
+ gamma = 10.0**log_gamma
140
+ if log_gamma2 is None and alpha != 0:
141
+ raise ValueError("log_gamma2 must be given when alpha != 0")
142
+ gamma2 = 10.0**log_gamma2 if log_gamma2 is not None else None
143
+
144
+ g = G * Mp / Rp**2
145
+ T_eq = beta * np.sqrt(Rs / (2 * a)) * T_star
146
+ taus = k_th * _default_pressures() / g
147
+
148
+ def incoming_stream_contribution(gamma):
149
+ return 3.0 / 4 * T_eq**4 * \
150
+ (2.0 / 3 + 2.0 / 3 / gamma *
151
+ (1 + (gamma * taus / 2 - 1) * np.exp(-gamma * taus)) +
152
+ 2.0 * gamma / 3 * (1 - taus**2 / 2) * expn(2, gamma * taus))
153
+
154
+ e1 = incoming_stream_contribution(gamma)
155
+ T4 = 3.0 / 4 * T_int**4 * (2.0 / 3 + taus) + (1 - alpha) * e1
156
+
157
+ if gamma2 is not None:
158
+ e2 = incoming_stream_contribution(gamma2)
159
+ T4 += alpha * e2
160
+ return cls._parameterized(T4 ** 0.25, "radiative_solution", dict(
161
+ T_star=T_star, Rs=Rs, a=a, Mp=Mp, Rp=Rp, beta=beta,
162
+ log_k_th=log_k_th, log_gamma=log_gamma,
163
+ log_gamma2=log_gamma2, alpha=alpha, T_int=T_int))
@@ -0,0 +1,20 @@
1
+ name = "platon"
2
+ __version__ = "7.0"
3
+ __md5sum__ = "8a209c5acecef4805d64d2714587df2f"
4
+ __data_url__ = "https://astro.uchicago.edu/~mz/data_{}.zip".format(__md5sum__)
5
+
6
+ # Capture small GPU kernel sequences into CUDA graphs (XLA's default
7
+ # threshold is conservative); saves ~15% wall time per forward model by
8
+ # eliminating kernel launch overhead. Appended so user-set XLA_FLAGS win.
9
+ import os as _os
10
+ if "--xla_gpu_graph_min_graph_size" not in _os.environ.get("XLA_FLAGS", ""):
11
+ _os.environ["XLA_FLAGS"] = (_os.environ.get("XLA_FLAGS", "") +
12
+ " --xla_gpu_graph_min_graph_size=2").strip()
13
+
14
+ # PLATON performs all heavy computation with JAX in single precision (FP32).
15
+ # jax_enable_x64 must be False so that computation actually happens in FP32.
16
+ from jax import config as _jax_config
17
+ _jax_config.update("jax_enable_x64", False)
18
+ # Do not let matmuls/einsums silently drop to TF32 (10-bit mantissa) on
19
+ # Ampere+ GPUs; full FP32 precision is required for accurate depths.
20
+ _jax_config.update("jax_default_matmul_precision", "highest")