Skip to content

Commit

Permalink
corr v2
Browse files Browse the repository at this point in the history
Updated the correction file slightly to account for some likely
metallicity dependence and modified behavior slightly near the turnoff.
Also fixed a weird bug where passing an integer value for `eep` to
`Isochrone` could cause the interpolation to fail.
  • Loading branch information
joshspeagle committed Feb 8, 2019
1 parent 35d715e commit 09e37d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion brutus/seds.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def build_interpolator_corr(self):
# Set label references.
self.logt_idx = np.where(np.array(self.predictions) == 'logt')[0][0]
self.logl_idx = np.where(np.array(self.predictions) == 'logl')[0][0]
self.logg_idx = np.where(np.array(self.predictions) == 'logg')[0][0]

def get_predictions(self, labels, apply_corr=True):
"""
Expand Down Expand Up @@ -308,6 +309,7 @@ def get_predictions(self, labels, apply_corr=True):
dlogt, dlogr = corrs.T
preds[:, self.logt_idx] += dlogt
preds[:, self.logl_idx] += 2. * dlogr
preds[:, self.logg_idx] -= 2. * dlogr

return preds

Expand Down Expand Up @@ -1107,7 +1109,7 @@ def build_interpolator(self):
# Fill in "holes".
for i in range(len(self.feh_u)):
for j in range(len(self.loga_u)):
# Select values where one or more predictions "failed".
# Select values where predictions exist.
sel = np.all(np.isfinite(self.pred_grid[i, j]), axis=1)
# Linearly interpolate over built-in EEP grid.
pnew = np.array([np.interp(self.eep_u, self.eep_u[sel], par,
Expand Down Expand Up @@ -1199,6 +1201,7 @@ def get_predictions(self, feh=0., loga=8.5, eep=None, apply_corr=True):
# Fill out input labels.
if eep is None:
eep = self.eep_u
eep = np.array(eep, dtype='float')
feh = np.full_like(eep, feh)
loga = np.full_like(eep, loga)
labels = np.c_[feh, loga, eep]
Expand All @@ -1213,6 +1216,7 @@ def get_predictions(self, feh=0., loga=8.5, eep=None, apply_corr=True):
dlogt, dlogr = corrs.T
preds[:, self.logt_idx] += dlogt
preds[:, self.logl_idx] += 2. * dlogr
preds[:, self.logg_idx] -= 2. * dlogr

return preds

Expand Down Expand Up @@ -1318,6 +1322,7 @@ def get_seds(self, feh=0., loga=8.5, eep=None, av=0., rv=3.3, smf=0.,
# Initialize EEPs.
if eep is None:
eep = self.eep_u
eep = np.array(eep, dtype='float')
Neep = len(eep)

# Generate predictions.
Expand Down

0 comments on commit 09e37d0

Please sign in to comment.