Skip to content

Commit

Permalink
adding in SMC Bumps average
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed May 7, 2024
1 parent 7e8e799 commit 329c5ab
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 16 deletions.
6 changes: 4 additions & 2 deletions docs/dust_extinction/choose_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Note the different valid wavelength ranges), the LMC
(:class:`~dust_extinction.averages.G03_LMCAvg`,
:class:`~dust_extinction.averages.G03_LMC2`) and the SMC
(:class:`~dust_extinction.averages.G03_SMCBar`,
:class:`~dust_extinction.averages.G24_SMCAvg`).
:class:`~dust_extinction.averages.G24_SMCAvg`,
:class:`~dust_extinction.averages.G24_SMCBumps`).

One often used alternative to these straight average models is to use one of
the parameter dependent models with the average R(V) value. For the Milky
Expand Down Expand Up @@ -66,7 +67,8 @@ Way, the usual average used is R(V) = 3.1. See the next section.
+--------------+-------------+------------------+--------------+
| G24_SMCAvg | 0.3 - 10.0 | 0.1 - 3.3 | SMC |
+--------------+-------------+------------------+--------------+

| G24_SMCBumps | 0.3 - 10.0 | 0.1 - 3.3 | SMC |
+--------------+-------------+------------------+--------------+

Parameter Dependent Average Curves
----------------------------------
Expand Down
6 changes: 4 additions & 2 deletions docs/dust_extinction/model_flavors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ Average models
G03_SMCBar,
G03_LMCAvg,
G03_LMC2,
G24_SMCAvg)
G24_SMCAvg,
G24_SMCBumps)

fig, ax = plt.subplots()

# generate the curves and plot them
x = np.arange(0.3,11.0,0.1)/u.micron

models = [GCC09_MWAvg, B92_MWAvg, G03_SMCBar, G03_LMCAvg, G03_LMC2, G24_SMCAvg]
models = [GCC09_MWAvg, B92_MWAvg, G03_SMCBar, G03_LMCAvg, G03_LMC2,
G24_SMCAvg, G24_SMCBumps]

for cmodel in models:
ext_model = cmodel()
Expand Down
4 changes: 3 additions & 1 deletion docs/dust_extinction/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ G16: `Gordon et al. 2016, ApJ 826, 104
G21: `Gordon et al. 2021, ApJ, 916, 33
<https://ui.adsabs.harvard.edu/abs/2021ApJ...916...33G>`_

G23: `Gordon et al. 2022, ApJ, 950, 86
G23: `Gordon et al. 2023, ApJ, 950, 86
<https://ui.adsabs.harvard.edu/abs/2023ApJ...950...86G/abstract>`_

G24: Gordon et al. 2024, ApJ, in press

HD23: `Hensley & Draine 2023, ApJ, 948, 55
<https://ui.adsabs.harvard.edu/abs/2023ApJ...948...55H/abstract>`_

Expand Down
129 changes: 127 additions & 2 deletions dust_extinction/averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"G21_MWAvg",
"D22_MWAvg",
"G24_SMCAvg",
# "G24_SMCBumps"
"G24_SMCBumps",
]


Expand Down Expand Up @@ -1581,7 +1581,9 @@ def __init__(self, **kwargs):
self.obsdata_axav_unc = a["unc"].data

# accuracy of the observed data based on published table
self.obsdata_tolerance = 0.1 # large value driven by short wavelength uncertainties
self.obsdata_tolerance = (
0.1 # large value driven by short wavelength uncertainties
)

super().__init__(**kwargs)

Expand Down Expand Up @@ -1632,3 +1634,126 @@ def evaluate(self, in_x):
self.x_range,
self.__class__.__name__,
)


class G24_SMCBumps(BaseExtModel):
r"""
Gordon et al (2024) SMC Bumps Extinction Curve
Parameters
----------
None
Raises
------
None
Notes
-----
From Gordon et al. (2024, ApJ, in press)
Two data points in the FUV from the data file giving the observed average were removed
as they are *very* deviate from the FM90 parametrization. This cause the automated tests
to fail.
Example showing the average curve
.. plot::
:include-source:
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from dust_extinction.averages import G24_SMCBumps
fig, ax = plt.subplots()
# define the extinction model
ext_model = G24_SMCBumps()
# generate the curves and plot them
x = np.arange(ext_model.x_range[0], ext_model.x_range[1],0.1)/u.micron
ax.plot(x,ext_model(x),label='G24 SMC Bumps')
ax.plot(ext_model.obsdata_x, ext_model.obsdata_axav, 'ko',
label='obsdata')
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
ax.legend(loc='best')
plt.show()
"""

x_range = [0.3, 10.0]

Rv = 2.59

def __init__(self, **kwargs):

# get the tabulated information
data_path = pkg_resources.resource_filename("dust_extinction", "data/")

# D22 sigma clipped average of 13 diffuse sightlines
a = Table.read(data_path + "G24_SMCBumps.dat", format="ascii.commented_header")

# data
self.obsdata_x = 1.0 / a["wave"].data
self.obsdata_axav = a["A(l)/A(V)"].data
self.obsdata_axav_unc = a["unc"].data

# accuracy of the observed data based on published table
self.obsdata_tolerance = (
0.1 # large value driven by short wavelength uncertainties
)

super().__init__(**kwargs)

def evaluate(self, in_x):
"""
G24 SMCBumps function
Parameters
----------
in_x: float
expects either x in units of wavelengths or frequency
or assumes wavelengths in wavenumbers [1/micron]
internally wavenumbers are used
Returns
-------
axav: np array (float)
A(x)/A(V) extinction curve [mag]
Raises
------
ValueError
Input x values outside of defined range
"""
C1 = -2.87
C2 = 1.51
C3 = 2.64
C4 = 0.25
xo = 4.73
gamma = 1.16

optnir_axav_x = 1.0 / np.array([2.198, 1.65, 1.25, 0.55, 0.44, 0.37])
optnir_axav_y = [0.068, 0.174, 0.302, 1.017, 1.394, 1.675]

# return A(x)/A(V)
return _curve_F99_method(
in_x,
self.Rv,
C1,
C2,
C3,
C4,
xo,
gamma,
optnir_axav_x,
optnir_axav_y,
self.x_range,
self.__class__.__name__,
)
9 changes: 0 additions & 9 deletions dust_extinction/data/G24_SMCBumps.dat
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# wave A(l)/A(V) unc type
0.112305922546031 4.27938281479861 0.41979972549018957 spec
0.11701444543424377 5.4176459980372185 0.1032219276339054 spec
0.12192037721493712 4.272988148773956 0.8216371204158461 spec
0.12703199442658303 4.752853473898855 0.08375995156522892 spec
0.13235792060868376 4.671941852629287 0.08390085400631052 spec
0.13790714085008998 4.395775332012629 0.0583456651927308 spec
Expand All @@ -21,19 +19,12 @@
0.24507681076473067 2.636005637080303 0.014538738385996147 spec
0.25535186791839903 2.514649982179777 0.007126586158241167 spec
0.26605771572574743 2.299400811815393 0.011083699616338564 spec
0.27094539999961853 2.334321136586501 0.03195466433109193 WFC3_F275W
0.27721241545733843 2.1865630620178007 0.02234139631596784 spec
0.28883478561811626 2.1714747651498394 0.007120837703763066 spec
0.30094443369511337 2.013597970861842 0.0120703720266099 spec
0.33499833941459656 1.8257437897333624 0.008129228237896528 WFC3_F336W
0.3628658354282379 1.6746842300512743 0.00040831423990903573 JohnU
0.43783867359161377 1.3942325108128082 0.006685972865933271 JohnB
0.46907517313957214 1.2932579177380588 0.00267344543998287 ACS_F475W
0.5442439317703247 1.01686775136653 0.0002159286715026245 JohnV
0.5572436451911926 0.9611119466969889 0.04265954068073023 ACS_F550M
0.7932101488113403 0.5757920680725783 0.013510368208852347 ACS_F814W
1.1072901487350464 0.30360021912429525 0.04379160995122052 WFC3_F110W
1.2309569120407104 0.3024797256658269 0.04839927738226376 JohnJ
1.5236843824386597 0.09086306686909129 0.07626826420000873 WFC3_F160W
1.6215280294418335 0.1738600487817531 0.04846869511215765 JohnH
2.1742196083068848 0.06818160198036438 0.0798256207489614 JohnK
2 changes: 2 additions & 0 deletions dust_extinction/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
G21_MWAvg,
D22_MWAvg,
G24_SMCAvg,
G24_SMCBumps,
)
from dust_extinction.grain_models import DBP90, WD01, D03, ZDA04, C11, J13, HD23

Expand All @@ -51,6 +52,7 @@
G21_MWAvg,
D22_MWAvg,
G24_SMCAvg,
G24_SMCBumps,
]
grain_models = [DBP90, WD01, D03, ZDA04, C11, J13, HD23]

Expand Down

0 comments on commit 329c5ab

Please sign in to comment.