Skip to content

Commit

Permalink
Any in cloud params vs kzz bug (#99)
Browse files Browse the repository at this point in the history
* any(in cloud params)-> ran black on retrieval.py

* labels: shorten dlnT/dlnP, T_bot; fix fsed
  • Loading branch information
wbalmer authored May 13, 2024
1 parent fe28b8e commit 4661348
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
43 changes: 19 additions & 24 deletions species/fit/retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2204,22 +2204,22 @@ def _lnlike(
log_x_base[item[:-3]] = cube[cube_index[item]]

# Create dictionary with cloud parameters

if "log_kzz" in self.parameters:
cloud_param = [
"fsed",
"log_kzz",
"sigma_lnorm",
"log_kappa_0",
"opa_index",
"log_p_base",
"albedo",
"log_kappa_abs",
"log_kappa_sca",
"opa_abs_index",
"opa_sca_index",
"lambda_ray",
]
cloud_param = [
"fsed",
"log_kzz",
"sigma_lnorm",
"log_kappa_0",
"opa_index",
"log_p_base",
"albedo",
"log_kappa_abs",
"log_kappa_sca",
"opa_abs_index",
"opa_sca_index",
"lambda_ray",
]

if any(param_i in self.parameters for param_i in cloud_param):

cloud_dict = {}
for item in cloud_param:
Expand Down Expand Up @@ -2444,13 +2444,9 @@ def _lnlike(
# that is calculated from the spectrum and the
# bolometric flux at each pressure

ln_prior += np.sum(
-0.5 * (f_bol - f_bol_spec) ** 2 / sigma_fbol**2
)
ln_prior += np.sum(-0.5 * (f_bol - f_bol_spec) ** 2 / sigma_fbol**2)

ln_prior += (
-0.5 * f_bol.size * np.log(2.0 * np.pi * sigma_fbol**2)
)
ln_prior += -0.5 * f_bol.size * np.log(2.0 * np.pi * sigma_fbol**2)

# for i in range(i_conv):
# for i in range(lowres_radtrans.press.shape[0]):
Expand Down Expand Up @@ -2997,8 +2993,7 @@ def _lnlike(
-0.5
* weight
* np.sum(
flux_diff**2 / data_var
+ np.log(2.0 * np.pi * data_var)
flux_diff**2 / data_var + np.log(2.0 * np.pi * data_var)
)
)

Expand Down
6 changes: 3 additions & 3 deletions species/util/plot_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,13 @@ def update_labels(param: List[str], object_type: str = "planet") -> List[str]:

if "T_bottom" in param:
index = param.index("T_bottom")
param[index] = r"$T_\mathrm{bottom}$ (K)"
param[index] = r"$T_\mathrm{bot}$ (K)"

num_layer = 6 # could make a variable in the future
for i in range(num_layer):
if f"PTslope_{num_layer - i}" in param:
index = param.index(f"PTslope_{num_layer - i}")
param[index] = rf"$(dlnT/dlnP)_\mathrm{{P={i}bar}}$ (K)"
param[index] = rf"dlnT/dlnP$_{i}$ "

if "log_p_quench" in param:
index = param.index("log_p_quench")
Expand Down Expand Up @@ -630,7 +630,7 @@ def update_labels(param: List[str], object_type: str = "planet") -> List[str]:

if f"fsed_{item}(c)" in param:
index = param.index(f"fsed_{item}(c)")
param[index] = rf"$\log\,P_\mathrm{{{cloud_labels[i]}}}$"
param[index] = rf"fsed$_\mathrm{{{cloud_labels[i]}}}$"

for i, item_i in enumerate(cloud_species):
for j, item_j in enumerate(cloud_species):
Expand Down

0 comments on commit 4661348

Please sign in to comment.