Skip to content

Commit

Permalink
Merge pull request #118 from karllark/update_calc_av
Browse files Browse the repository at this point in the history
update A(V) calc to use latest - Decleir et al. (2022)
  • Loading branch information
karllark authored May 7, 2024
2 parents de1f372 + c310a85 commit 819b545
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
27 changes: 19 additions & 8 deletions measure_extinction/extdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,17 +502,18 @@ def calc_EBV(self):
else:
self.columns["EBV"] = (self.exts["BAND"][bindx], self.uncs["BAND"][bindx])

def calc_AV(self, akav=0.112):
def calc_AV(self, akav=0.105):
"""
Calculate A(V) from the observed extinction curve:
- fit a powerlaw to the SpeX extinction curve, if available
- otherwise: extrapolate the K-band extinction
Parameters
----------
akav : float [default = 0.112]
akav : float
Value of A(K)/A(V)
default is from Rieke & Lebofsky (1985)
default is from Decleir et al. (2022)
for Rieke & Lebofsky (1985) use akav=0.112
van de Hulst No. 15 curve has A(K)/A(V) = 0.0885
Returns
Expand All @@ -539,23 +540,33 @@ def calc_AV(self, akav=0.112):
avunc = np.absolute(av * (self.uncs["BAND"][kindx] / ekv))
self.columns["AV"] = (av, avunc)

def calc_AV_JHK(self):
def calc_AV_JHK(
self,
ref_waves=np.array([1.25, 1.6, 2.2]) * u.micron,
ref_alav=[0.269, 0.163, 0.105],
):
"""
Calculate A(V) from the observed extinction curve:
- extrapolate from J, H, & K photometry
- assumes functional form from Rieke, Rieke, & Paul (1989)
Parameters
----------
ref_waves : floats
wavelengths for reference values (default = JHK)
ref_alav : floats
A(lambda)/A(V) values for reference
default is for JHK from Decleir et al. (2022)
for Rieke, Rieke, & Paul (1989) use ref_alav=[0.2815534, 0.17475728, 0.11197411],
Returns
-------
Updates self.columns["AV"]
"""
# J, H, K
rrp89_waves = np.array([1.25, 1.6, 2.2]) * u.micron
rrp89_alav = [0.2815534, 0.17475728, 0.11197411]

avs = []
avs_unc = []
for cwave, calav in zip(rrp89_waves, rrp89_alav):
for cwave, calav in zip(ref_waves, ref_alav):
dwaves = np.absolute(self.waves["BAND"] - cwave)
kindx = dwaves.argmin()
if dwaves[kindx] < 0.1 * u.micron:
Expand Down
8 changes: 4 additions & 4 deletions measure_extinction/tests/test_EbvAvRv.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def test_calc_av():
text.calc_AV()
av = text.columns["AV"]
assert isinstance(av, tuple)
assert np.isclose(av[0], 0.56306, atol=1e-3)
assert np.isclose(av[1], 0.02252, atol=1e-3)
assert np.isclose(av[0], 0.55866, atol=1e-3)
assert np.isclose(av[1], 0.02235, atol=1e-3)


def test_calc_rv_fromelv():
Expand All @@ -38,8 +38,8 @@ def test_calc_rv_fromelv():
text.calc_RV()
rv = text.columns["RV"]
assert isinstance(rv, tuple)
assert np.isclose(rv[0], 3.37837, atol=1e-3)
assert np.isclose(rv[1], 0.207647, atol=1e-3)
assert np.isclose(rv[0], 3.351955, atol=1e-3)
assert np.isclose(rv[1], 0.206023, atol=1e-3)


def test_calc_rv_fromebvav():
Expand Down

0 comments on commit 819b545

Please sign in to comment.