Skip to content

Commit

Permalink
add term2 err
Browse files Browse the repository at this point in the history
  • Loading branch information
yymao committed Jan 18, 2024
1 parent fdec938 commit 786270e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion SAGA/objects/build3.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def add_sfr(base):
base["Halpha_sfr_err"] = np.float32(np.nan)

mask = Query(C.valid_Halpha, "dist_estimate > 0").mask(base)
t = base[["EW_Halpha", "EW_Halpha_err", "SPEC_Z", "Mr", "r_err"]][mask]
t = base[["EW_Halpha", "EW_Halpha_err", "SPEC_Z", "SPEC_Z_ERR", "Mr", "r_err"]][mask]
with np.errstate(all="ignore"):
log_sfr, log_sfr_err = calc_sfr.calc_SFR_Halpha(*(c.astype(np.float64) for c in t.itercols()))

Expand Down
7 changes: 4 additions & 3 deletions SAGA/objects/calc_sfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def calc_SFR_NUV(NUV_mag, NUV_mag_err, dist_mpc, internal_ext=0.9, internal_ext_
return log_SFR_NUV, log_SFR_NUV_err


def calc_SFR_Halpha(EW_Halpha, EW_Halpha_err, spec_z, Mr, r_err, EWc=2.5, BD=3.25, BD_err=0.1):
def calc_SFR_Halpha(EW_Halpha, EW_Halpha_err, spec_z, spec_z_err, Mr, r_err, EWc=2.5, BD=3.25, BD_err=0.1):
"""
Calculate Halpha-based EW SFR
Bauer+ (2013) https://ui.adsabs.harvard.edu/abs/2013MNRAS.434..209B/abstract
Expand All @@ -69,8 +69,9 @@ def calc_SFR_Halpha(EW_Halpha, EW_Halpha_err, spec_z, Mr, r_err, EWc=2.5, BD=3.2
term1_EW_frac_err = EW_Halpha_err / (EW_Halpha + EWc)
term1_Mr_frac_err = 0.4 * np.log(10) * r_err
term1_frac_err = np.hypot(term1_EW_frac_err, term1_Mr_frac_err)
term2_frac_err = 2.0 * spec_z_err / (1.0 + spec_z)
term3_frac_err = 2.36 * (BD_err / BD)
L_Halpha_frac_err = np.hypot(term1_frac_err, term3_frac_err)
L_Halpha_frac_err = np.sqrt(term1_frac_err ** 2 + term2_frac_err ** 2 + term3_frac_err ** 2)
log_Ha_SFR_err = L_Halpha_frac_err / np.log(10)

return log_Ha_SFR, log_Ha_SFR_err
return log_Ha_SFR, log_Ha_SFR_err

0 comments on commit 786270e

Please sign in to comment.