xdust.graindist.composition¶
The composition library is built on the superclass Composition, which holds the optical constants and material density [g cm^-3] of a grain composition type.
Premade composition types
CmDrude – Drude approximation, treating the grain as a mass of free electrons
CmSilicate – astronomical silicates (Draine 2003)
CmGraphite – graphite (Draine 2003)
Composition¶
- class xdust.graindist.composition.Composition[source]¶
Bases:
objectComposition class for storing information about grain material
- cmtype¶
Label for the compound.
- Type:
str
- rho¶
Density of the material [g cm^-3].
- Type:
float
- citation¶
Citation for the optical constants loaded.
- Type:
str
- wavel¶
Wavelength grid for optical constants.
- Type:
astropy.units.Quantity
- revals¶
Real part of the complex index of refraction.
- Type:
numpy.ndarray
- imvals¶
Imaginary part of the complex index of refraction.
- Type:
numpy.ndarray
- cm(x)[source]¶
Returns the complex index of refraction using Python complex numbers
- Parameters:
x (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; if an
astropy.units.Quantity, converted to the same units asself.wavel; if a plain array, keV units are assumed.- Returns:
Complex index of refraction \(n = n_r + i n_i\).
- Return type:
complex or numpy.ndarray of complex
- ip(x)[source]¶
Interpolate over the input wavelength grid to get the imaginary part of the complex index of refraction.
- Parameters:
x (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; if an
astropy.units.Quantity, converted to the same units asself.wavel; if a plain array, keV units are assumed.- Returns:
np.interp(x, self.wavel, self.imvals, left=0.0, right=0.0)- Return type:
numpy.ndarray
- plot(ax, lam=None, rppart=True, impart=True, xunit=None, label='')[source]¶
Plots the different parts of the complex index of refraction on a matplotlib axis
- Parameters:
ax (matplotlib.pyplot.Axes) – The axes on which to plot.
lam (astropy.units.Quantity or numpy.ndarray, optional) – If
None, plots using the defaultself.wavelgrid; otherwise interpolates onto the provided grid. Plain arrays are assumed to be in keV.rppart (bool) – If
True(default), plot the real part \(|Re(m)-1|\).impart (bool) – If
True(default), plot the imaginary part \(Im(m)\).xunit (str, optional) – Unit string for the x-axis. Defaults to
self.wavel.unit.label (str) – Prefix string appended to legend labels.
- rp(x)[source]¶
Interpolate over the input wavelength grid to get the real part of the complex index of refraction.
- Parameters:
x (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; if an
astropy.units.Quantity, converted to the same units asself.wavel; if a plain array, keV units are assumed.- Returns:
np.interp(x, self.wavel, self.revals, left=1.0, right=1.0)- Return type:
numpy.ndarray
CmDrude¶
- class xdust.graindist.composition.CmDrude(rho=3.0)[source]¶
Bases:
CompositionOptical constants under the Drude approximation.
- ip(x)[source]¶
Gives the imaginary part of the complex index of refraction under the Drude approximation.
- Parameters:
x (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.
- Returns:
0.0for scalar input; array of zeros matching the length ofxfor array input.- Return type:
float or numpy.ndarray
- rp(x)[source]¶
Calculate the real part of the complex index of refraction under the Drude approximation.
- Parameters:
x (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.
- Returns:
\(1 + (\rho / 2 m_p)(r_e / 2\pi)\lambda^2\)
- Return type:
numpy.ndarray
CmSilicate¶
- class xdust.graindist.composition.CmSilicate(rho=3.8)[source]¶
Bases:
CompositionOptical constants for Silicate from Draine (2003), ApJ 598, 1026
CmGraphite¶
- class xdust.graindist.composition.CmGraphite(rho=2.2, size='big', orient='perp')[source]¶
Bases:
CompositionOptical constants for Graphite from Draine (2003), ApJ 598, 1026
- size¶
'big'gives results for 0.1 um sized graphite grains at 20 K;'small'gives results for 0.01 um sized grains at 20 K.- Type:
str
- orient¶
'perp'gives results for E-field perpendicular to the c-axis;'para'gives results for E-field parallel to the c-axis.- Type:
str