Skip to content

Commit

Permalink
Added the cloud_wavel parameter to ReadRadtrans.get_model
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed May 7, 2021
1 parent 6efd32d commit 442af08
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 10 additions & 2 deletions species/read/read_radtrans.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def get_model(self,
quenching: Optional[str] = None,
spec_res: Optional[float] = None,
wavel_resample: Optional[np.ndarray] = None,
plot_contribution: Optional[str] = None) -> box.ModelBox:
plot_contribution: Optional[str] = None,
cloud_wavel: Optional[Tuple[float, float]] = None) -> box.ModelBox:
"""
Function for calculating a model spectrum with ``petitRADTRANS``.
Expand All @@ -167,6 +168,12 @@ def get_model(self,
plot_contribution : str, None
Filename for the plot with the emission contribution. The plot is not created if the
argument is set to ``None``.
cloud_wavel : tuple(float, float), None
Tuple with the wavelength range (um) that is used for calculating the median optical
depth of the clouds at the gas-only photosphere and then scaling the cloud optical
depth to the value of ``log_tau_cloud``. The range of ``cloud_wavel`` should be
encompassed by the range of ``wavel_range``. The full wavelength range (i.e.
``wavel_range``) is used if the argument is set to ``None``.
Returns
-------
Expand Down Expand Up @@ -366,7 +373,8 @@ def get_model(self,
p_quench, log_x_abund, log_x_base, model_param['fsed'],
log_kzz, model_param['logg'], model_param['sigma_lnorm'],
chemistry=chemistry, pressure_grid=self.pressure_grid,
plotting=False, contribution=True, tau_cloud=tau_cloud)
plotting=False, contribution=True, tau_cloud=tau_cloud,
cloud_wavel=cloud_wavel)

elif chemistry == 'equilibrium':
# Calculate the petitRADTRANS spectrum for a clear atmosphere
Expand Down
15 changes: 11 additions & 4 deletions species/util/retrieval_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,9 @@ def calc_spectrum_clouds(rt_object,
pressure_grid: str = 'smaller',
plotting: bool = False,
contribution: bool = False,
tau_cloud: Optional[float] = None) -> Tuple[Optional[np.ndarray],
Optional[np.ndarray],
Optional[np.ndarray]]:
tau_cloud: Optional[float] = None,
cloud_wavel: Optional[Tuple[float, float]] = None) -> Tuple[
Optional[np.ndarray], Optional[np.ndarray], Optional[np.ndarray]]:
"""
Function to simulate an emission spectrum of a cloudy atmosphere.
Expand Down Expand Up @@ -766,6 +766,12 @@ def calc_spectrum_clouds(rt_object,
tau_cloud : float, None
Total cloud optical that will be used for scaling the cloud mass fractions. The mass
fractions will not be scaled if the parameter is set to ``None``.
cloud_wavel : tuple(float, float), None
Tuple with the wavelength range (um) that is used for calculating the median optical
depth of the clouds at the gas-only photosphere and then scaling the cloud optical
depth to the value of ``log_tau_cloud``. The range of ``cloud_wavel`` should be
encompassed by the range of ``wavel_range``. The full wavelength range (i.e.
``wavel_range``) is used if the argument is set to ``None``.
Returns
-------
Expand Down Expand Up @@ -925,7 +931,8 @@ def calc_spectrum_clouds(rt_object,
kappa_zero=None,
gamma_scat=None,
add_cloud_scat_as_abs=False,
hack_cloud_photospheric_tau=tau_cloud)
hack_cloud_photospheric_tau=tau_cloud,
cloud_wlen=cloud_wavel)

if check_scaling is None:
wlen_micron = constants.LIGHT*1e2/rt_object.freq/1e-4
Expand Down

0 comments on commit 442af08

Please sign in to comment.