Skip to content

Commit

Permalink
minor bug fix for returned optimal scaling factor of best-fit templat…
Browse files Browse the repository at this point in the history
…e spectra
  • Loading branch information
VChristiaens committed Feb 21, 2022
1 parent d536c8c commit 20a3aff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions special/template_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def get_chi(lbda_obs, spec_obs, err_obs, tmp_name, tmp_reader,
best_ext = 0
else:
best_scal, best_ext = res.x
if np.isfinite(best_scal):
best_scal*=scal_fac

# or grid search
elif search_mode == 'grid':
Expand Down Expand Up @@ -508,8 +510,8 @@ def best_fit_tmp(lbda_obs, spec_obs, err_obs, tmp_reader, search_mode='simplex',
print(msg.format(counter, n_tmp))
timing(start_time)

return best_n_tmp(chi, scal, ext, n_dof, tmp_filelist, tmp_reader, n_best=n_best,
verbose=True)
return best_n_tmp(chi, scal, ext, n_dof, tmp_filelist, tmp_reader,
n_best=n_best, verbose=True)


def best_n_tmp(chi, scal, ext, n_dof, tmp_filelist, tmp_reader, n_best=1,
Expand Down

0 comments on commit 20a3aff

Please sign in to comment.