Skip to content

Commit

Permalink
adding in G24 Average
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed May 7, 2024
1 parent d8caa10 commit f3ccd8f
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 0 deletions.
121 changes: 121 additions & 0 deletions dust_extinction/averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"F11_MWGC",
"G21_MWAvg",
"D22_MWAvg",
"G24_SMCAvg",
"G24_SMCBumps"
]


Expand Down Expand Up @@ -1513,3 +1515,122 @@ def evaluate(self, in_x):
# return A(x)/A(V)
# Note that model in D22 was done versus wavelength in microns
return d22_fit(1.0 / x)


class G24_SMCAvg(BaseExtModel):
r"""
Gordon et al (2024) SMC Average Extinction Curve
Parameters
----------
None
Raises
------
None
Notes
-----
From Gordon et al. (2024, ApJ, in press)
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_SMCAvg
fig, ax = plt.subplots()
# define the extinction model
ext_model = G24_SMCAvg()
# 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 Average')
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 = 3.06

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_SMCAvg.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.2 # check

super().__init__(**kwargs)

def evaluate(self, in_x):
"""
G24 SMCAvg 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 = -5.07
C2 = 2.30
C3 = 0.12
C4 = 0.08
xo = 4.59
gamma = 0.95

optnir_axav_x = 1.0 / np.array(
[2.198, 1.65, 1.25, 0.55, 0.44, 0.37]
)
optnir_axav_y = [0.075, 0.137, 0.333, 1.021, 1.345, 1.507]

# 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__,
)
32 changes: 32 additions & 0 deletions dust_extinction/data/G24_SMCAvg.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# wave A(l)/A(V) unc type
0.112305922546031 6.847556692139969 0.19983541525860996 spec
0.11701444543424377 5.831747894518376 0.035430074824899155 spec
0.12192037721493712 5.316808770696611 0.17716955259746545 spec
0.12703199442658303 5.44887838580242 0.030571416996447737 spec
0.13235792060868376 5.115222987458385 0.0352393910549822 spec
0.13790714085008998 4.860161520000865 0.022340167328706497 spec
0.14368901694726988 4.603244229724355 0.02039330322656729 spec
0.14971330319810144 4.380661719107991 0.020349135239799865 spec
0.1559901628578337 4.122941435989293 0.02385957759743568 spec
0.16253018528497776 3.931776192091593 0.018496750438423533 spec
0.16934440380605456 3.7650468775522037 0.022537499097438456 spec
0.17644431432933738 3.5787440290815615 0.0181091093438295 spec
0.18384189473899187 3.401297236472459 0.015784209031576256 spec
0.1915496251023318 3.2406020496958474 0.016101138308272284 spec
0.1995805087242818 3.1326209665059834 0.015209513508729776 spec
0.20794809408456638 2.9984478868820883 0.013831935817581402 spec
0.216666497694635 2.8678603256493833 0.013568088596585422 spec
0.2257504279128828 2.711103246385515 0.011910691317821886 spec
0.23521520975834567 2.5492520177588283 0.014692610807648825 spec
0.24507681076473067 2.389525680616388 0.009620888083712758 spec
0.25535186791839903 2.309726452669956 0.01056190399165983 spec
0.26605771572574743 2.158008535425206 0.00917623415282359 spec
0.27721241545733843 2.0760105449165183 0.00972090087034518 spec
0.28883478561811626 1.9544940452804287 0.008694020114040702 spec
0.30094443369511337 1.8757091989282824 0.010157429495629118 spec
0.3654647767543793 1.5068186876011898 0.03640110255487302 JohnU
0.43901899456977844 1.3446745290035917 0.012104158099805855 JohnB
0.5447309613227844 1.0211056069508497 0.011820762587529243 JohnV
1.2307178974151611 0.3334668386999866 0.06797754856997613 JohnJ
1.621522068977356 0.1366387371471568 0.08028764949929663 JohnH
2.17476487159729 0.07450314415244152 0.10211210104143857 JohnK
39 changes: 39 additions & 0 deletions dust_extinction/data/G24_SMCBumps.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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
0.14368901694726988 4.223283401884845 0.05200361253988084 spec
0.14971330319810144 4.005375779331094 0.05564808449432365 spec
0.1559901628578337 3.7112137122201223 0.07047899506742132 spec
0.16253018528497776 3.6516151965644466 0.047553668856758394 spec
0.16934440380605456 3.619164194092023 0.04245833891780579 spec
0.17644431432933738 3.5273545647901408 0.041188712204053776 spec
0.18384189473899187 3.41718627984076 0.029416325133850823 spec
0.1915496251023318 3.2705098239622634 0.010657716071328573 spec
0.1995805087242818 3.3322401341437735 0.01734756553480046 spec
0.20794809408456638 3.3502336329604927 0.012130192714050338 spec
0.216666497694635 3.385981914764564 0.0397076097575254 spec
0.2257504279128828 3.139181257277802 0.027729626813050585 spec
0.23521520975834567 2.8057305783371564 0.022880213706975107 spec
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

0 comments on commit f3ccd8f

Please sign in to comment.