Skip to content

Commit

Permalink
Changed the definition for the flux ratio prior to the secondary flux…
Browse files Browse the repository at this point in the history
… divided by the primary flux
  • Loading branch information
tomasstolker committed May 3, 2024
1 parent eee897d commit b211156
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions species/fit/fit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ def __init__(
``ratio_Paranal/ERIS.H``. For a uniform prior, the
ratio parameter should be added to ``bounds`` and
for a normal prior it is added to ``normal_prior``.
The flux ratio is defined as the flux of the
secondary star divided by the flux of the primary
star.
- Instead of fitting the radius and parallax, it is also
possible to fit a scaling parameter directly, either
Expand Down Expand Up @@ -1060,7 +1063,6 @@ def __init__(
for param_item in self.normal_prior:
if param_item[:6] == "ratio_":
self.modelpar.append(param_item)

print(f"Interpolating {param_item[6:]}...", end="", flush=True)
read_model = ReadModel(self.model, filter_name=param_item[6:])
read_model.interpolate_grid(wavel_resample=None, spec_res=None)
Expand Down Expand Up @@ -1602,9 +1604,9 @@ def _lnlike_func(

if f"ratio_{filt_name}" in self.bounds:
ratio_prior = self.bounds[f"ratio_{filt_name}"]
if ratio_prior[0] > phot_flux_0 / phot_flux_1:
if ratio_prior[0] > phot_flux_1 / phot_flux_0:
return -np.inf
elif ratio_prior[1] < phot_flux_0 / phot_flux_1:
elif ratio_prior[1] < phot_flux_1 / phot_flux_0:
return -np.inf

# Normal prior for the flux ratio
Expand All @@ -1614,7 +1616,7 @@ def _lnlike_func(

ln_like += (
-0.5
* (phot_flux_0 / phot_flux_1 - ratio_prior[0]) ** 2
* (phot_flux_1 / phot_flux_0 - ratio_prior[0]) ** 2
/ ratio_prior[1] ** 2
)

Expand Down

0 comments on commit b211156

Please sign in to comment.