From 95d10916111452eea0c31c7643941055d91b9ba3 Mon Sep 17 00:00:00 2001 From: "Karl D. Gordon" Date: Wed, 22 Nov 2023 13:00:05 -0500 Subject: [PATCH] last few updates --- measure_extinction/modeldata.py | 33 +++++++++++++++++-- measure_extinction/utils/fit_model.py | 1 + .../utils/make_all_tlusty_obsdata.py | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/measure_extinction/modeldata.py b/measure_extinction/modeldata.py index f50a75a..fc10252 100644 --- a/measure_extinction/modeldata.py +++ b/measure_extinction/modeldata.py @@ -209,7 +209,7 @@ def stellar_sed(self, params, velocity=None): return sed - def dust_extinguished_sed(self, params, sed, velocity=0.0): + def dust_extinguished_sed_FM90_G23(self, params, sed, velocity=0.0): """ Dust extinguished sed given the extinction parameters @@ -231,6 +231,11 @@ def dust_extinguished_sed(self, params, sed, velocity=0.0): """ Rv = params[1] g23mod = G23(Rv=Rv) + optnir_axav_x = np.flip(1.0 / (np.arange(0.35, 30.0, 0.1) * u.micron)) + optnir_axav_y = g23mod(optnir_axav_x) + + # updated F04 C1-C2 correlation + C1 = 2.18 - 2.91 * params[2] # create the extinguished sed ext_sed = {} @@ -238,12 +243,34 @@ def dust_extinguished_sed(self, params, sed, velocity=0.0): # get the dust extinguished SED (account for the # systemic velocity of the galaxy [opposite regular sense]) shifted_waves = (1.0 - velocity / 2.998e5) * self.waves[cspec] - axav = g23mod(shifted_waves) + axav = _curve_F99_method( + shifted_waves, + Rv, + C1, + params[2], + params[3], + params[4], + params[5], + params[6], + optnir_axav_x.value, + optnir_axav_y, + [0.2, 11.0], + "FM90_G23_measure_extinction", + ) ext_sed[cspec] = sed[cspec] * (10 ** (-0.4 * axav * params[0])) + # # create the extinguished sed + # ext_sed = {} + # for cspec in self.fluxes.keys(): + # # get the dust extinguished SED (account for the + # # systemic velocity of the galaxy [opposite regular sense]) + # shifted_waves = (1.0 - velocity / 2.998e5) * self.waves[cspec] + # axav = g23mod(shifted_waves) + # ext_sed[cspec] = sed[cspec] * (10 ** (-0.4 * axav * params[0])) + return ext_sed - def dust_extinguished_sed_pre2022(self, params, sed, velocity=0.0): + def dust_extinguished_sed(self, params, sed, velocity=0.0): """ Dust extinguished sed given the extinction parameters diff --git a/measure_extinction/utils/fit_model.py b/measure_extinction/utils/fit_model.py index 6967d77..8157bf1 100755 --- a/measure_extinction/utils/fit_model.py +++ b/measure_extinction/utils/fit_model.py @@ -97,6 +97,7 @@ def lnlike(self, params, obsdata, modeldata): lnl = 0.0 for cspec in hi_ext_modsed.keys(): gvals = (self.weights[cspec] > 0) & (np.isfinite(hi_ext_modsed[cspec])) + #gvals = self.weights[cspec] > 0 chiarr = np.square( ( obsdata.data[cspec].fluxes[gvals].value diff --git a/measure_extinction/utils/make_all_tlusty_obsdata.py b/measure_extinction/utils/make_all_tlusty_obsdata.py index 063c4dd..be25b04 100644 --- a/measure_extinction/utils/make_all_tlusty_obsdata.py +++ b/measure_extinction/utils/make_all_tlusty_obsdata.py @@ -62,7 +62,7 @@ def decode_params(filename): if __name__ == "__main__": - tlusty_models = glob.glob("/home/kgordon/Python/extstar_data/Models/Tlusty_2023/*v5.spec.gz") + tlusty_models = glob.glob("/home/kgordon/Python/extstar_data/Models/Tlusty_2023/*v10.spec.gz") for cfname in tlusty_models: # parse the filename to get the model parameters