Skip to content

Commit

Permalink
Fix of the model name in update_spectra
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed Feb 3, 2021
1 parent c7da485 commit 8b24e22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion species/analysis/fit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def lnprob(param: np.ndarray,
class FitModel:
"""
Class for fitting atmospheric model spectra to spectroscopic and/or photometric data, and using
Bayesian inference (``UltraNest``, ``MultiNest``, or `emcee`) to estimate posterior
Bayesian inference (``UltraNest``, ``MultiNest``, or ``emcee``) to estimate posterior
distributions and marginalized likelihoods (i.e. "evidence").
"""

Expand Down
12 changes: 6 additions & 6 deletions species/util/read_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,19 @@ def update_spectra(objectbox: box.ObjectBox,
if f'error_{key}' in model_param:
# Calculate the model spectrum
wavel_range = (0.9*spec_tmp[0, 0], 1.1*spec_tmp[-1, 0])
readmodel = read_model.ReadModel('atmo', wavel_range=wavel_range)
readmodel = read_model.ReadModel(model, wavel_range=wavel_range)

model = readmodel.get_model(model_param,
spec_res=value[3],
wavel_resample=spec_tmp[:, 0],
smooth=True)
model_box = readmodel.get_model(model_param,
spec_res=value[3],
wavel_resample=spec_tmp[:, 0],
smooth=True)

# Scale the errors relative to the model spectrum
err_scaling = model_param[f'error_{key}']
log_msg = f'Inflating the error of {key}: {err_scaling:.2e}...'

print(log_msg, end='', flush=True)
spec_tmp[:, 2] = np.sqrt(spec_tmp[:, 2]**2 + (err_scaling*model.flux)**2)
spec_tmp[:, 2] = np.sqrt(spec_tmp[:, 2]**2 + (err_scaling*model_box.flux)**2)
print(' [DONE]')

# Store the spectra with the scaled fluxes and/or errors
Expand Down

0 comments on commit 8b24e22

Please sign in to comment.