Skip to content

Commit

Permalink
more 2nd x-axes and a typo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed Aug 16, 2024
1 parent 45f6885 commit fade962
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Interstellar Dust Extinction
extinction curves.

Extinction describes the effects of dust on observations of single star due to
the dust along the line-of-sight to a star removiong flux by absorbing photons
the dust along the line-of-sight to a star removing flux by absorbing photons
and scattering photons out of the line-of-sight. The wavelength dependence of
dust extinction (also know as extinction curves) provides fundamental
information about the size, composition, and shape of interstellar dust grain.
Expand Down
80 changes: 74 additions & 6 deletions dust_extinction/averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class B92_MWAvg(BaseExtModel):
# generate the curves and plot them
x = np.arange(1.0/ext_model.x_range[1], 1.0/ext_model.x_range[0], 0.1) * u.micron
ax.plot(x,ext_model(x),label='B1992')
ax.plot(x,ext_model(x),label='B92')
ax.plot(1.0/ext_model.obsdata_x, ext_model.obsdata_axav, 'ko',
label='obsdata')
Expand Down Expand Up @@ -295,7 +295,7 @@ class B92_MWAvg(BaseExtModel):

def evaluate(self, in_x):
"""
B1992 function
B92 function
Parameters
----------
Expand Down Expand Up @@ -373,6 +373,16 @@ class G03_SMCBar(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -494,6 +504,16 @@ class G03_LMCAvg(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -616,6 +636,16 @@ class G03_LMC2(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -1048,6 +1078,16 @@ class GCC09_MWAvg(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.09, 0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand All @@ -1062,9 +1102,13 @@ def __init__(self, **kwargs):
ref = importlib_resources.files("dust_extinction") / "data"
with importlib_resources.as_file(ref) as data_path:
# GCC09 sigma clipped average of 75 sightlines
a = Table.read(data_path / "GCC09_FUSE.dat", format="ascii.commented_header")
a = Table.read(
data_path / "GCC09_FUSE.dat", format="ascii.commented_header"
)
b = Table.read(data_path / "GCC09_IUE.dat", format="ascii.commented_header")
c = Table.read(data_path / "GCC09_PHOT.dat", format="ascii.commented_header")
c = Table.read(
data_path / "GCC09_PHOT.dat", format="ascii.commented_header"
)

# FUSE range
self.obsdata_x_fuse = a["x"].data
Expand Down Expand Up @@ -1559,6 +1603,16 @@ class G24_SMCAvg(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand All @@ -1573,7 +1627,9 @@ def __init__(self, **kwargs):
ref = importlib_resources.files("dust_extinction") / "data"
with importlib_resources.as_file(ref) as data_path:
# D22 sigma clipped average of 13 diffuse sightlines
a = Table.read(data_path / "G24_SMCAvg.dat", format="ascii.commented_header")
a = Table.read(
data_path / "G24_SMCAvg.dat", format="ascii.commented_header"
)

# data
self.obsdata_x = 1.0 / a["wave"].data
Expand Down Expand Up @@ -1682,6 +1738,16 @@ class G24_SMCBumps(BaseExtModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand All @@ -1696,7 +1762,9 @@ def __init__(self, **kwargs):
ref = importlib_resources.files("dust_extinction") / "data"
with importlib_resources.as_file(ref) as data_path:
# D22 sigma clipped average of 13 diffuse sightlines
a = Table.read(data_path / "G24_SMCBumps.dat", format="ascii.commented_header")
a = Table.read(
data_path / "G24_SMCBumps.dat", format="ascii.commented_header"
)

# data
self.obsdata_x = 1.0 / a["wave"].data
Expand Down
100 changes: 100 additions & 0 deletions dust_extinction/parameter_averages.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ class CCM89(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -196,6 +206,16 @@ class O94(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -325,6 +345,16 @@ class F99(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -464,6 +494,16 @@ class F04(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -599,6 +639,16 @@ class VCG04(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.12, 0.15, 0.2, 0.3])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -709,6 +759,16 @@ class GCC09(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.09, 0.1, 0.12, 0.15, 0.2, 0.3])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down Expand Up @@ -834,6 +894,16 @@ class M14(BaseExtRvModel):
ext_model = M14(Rv=cur_Rv)
ax.plot(x,ext_model(x),label='R(V) = ' + str(cur_Rv))
# for 2nd x-axis with lambda values
axis_xs = np.array([0.3, 0.5, 1.0, 2.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
Expand Down Expand Up @@ -1029,6 +1099,16 @@ class G16(BaseExtRvAfAModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best', title=r'$f_A = 1.0$')
plt.show()
Expand Down Expand Up @@ -1058,6 +1138,16 @@ class G16(BaseExtRvAfAModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best', title=r'$R_A(V) = 3.1$')
plt.show()
"""
Expand Down Expand Up @@ -1165,6 +1255,16 @@ class F19(BaseExtRvModel):
ax.set_xlabel(r'$x$ [$\mu m^{-1}$]')
ax.set_ylabel(r'$A(x)/A(V)$')
# for 2nd x-axis with lambda values
axis_xs = np.array([0.1, 0.12, 0.15, 0.2, 0.3, 0.5, 1.0])
new_ticks = 1 / axis_xs
new_ticks_labels = ["%.2f" % z for z in axis_xs]
tax = ax.twiny()
tax.set_xlim(ax.get_xlim())
tax.set_xticks(new_ticks)
tax.set_xticklabels(new_ticks_labels)
tax.set_xlabel(r"$\lambda$ [$\mu$m]")
ax.legend(loc='best')
plt.show()
"""
Expand Down
Loading

0 comments on commit fade962

Please sign in to comment.