Skip to content

Commit

Permalink
last few updates
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed Nov 22, 2023
1 parent f11fc29 commit dfdf1fa
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
33 changes: 30 additions & 3 deletions measure_extinction/modeldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -231,19 +231,46 @@ 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 = {}
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)
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
Expand Down
1 change: 1 addition & 0 deletions measure_extinction/utils/fit_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion measure_extinction/utils/make_all_tlusty_obsdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dfdf1fa

Please sign in to comment.