From 09e37d0c4517bf179789d80e9a8f31c3eff0f381 Mon Sep 17 00:00:00 2001 From: joshspeagle Date: Fri, 8 Feb 2019 01:05:40 -0500 Subject: [PATCH] corr v2 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. --- brutus/seds.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/brutus/seds.py b/brutus/seds.py index 5ee0dc3..30226f1 100644 --- a/brutus/seds.py +++ b/brutus/seds.py @@ -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): """ @@ -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 @@ -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, @@ -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] @@ -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 @@ -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.