xdust.scatteringmodel

The scattering model library is built on the superclass ScatteringModel, which defines the scattering physics model and holds the computational results once the scattering model is calculated.

Premade scattering models

ScatteringModel

class xdust.scatteringmodel.ScatteringModel(from_file=None)[source]

Bases: object

Parent class for scattering models

qsca

Scattering efficiency Q (cross-section / geometric cross-section).

Type:

numpy.ndarray

qext

Extinction efficiency Q (cross-section / geometric cross-section).

Type:

numpy.ndarray

qabs

Absorption efficiency Q (cross-section / geometric cross-section).

Type:

numpy.ndarray

diff

Differential scattering efficiency [ster^-1].

Type:

numpy.ndarray

pars

Parameters from the most recent calculation.

Type:

dict

stype

A label for the model.

Type:

str

citation

Description of how to cite this model.

Type:

str

calculate(lam, a, cm, theta, **kwargs)[source]

Calculate the extinction efficiences with the Rayleigh-Gans approximation.

Parameters:
  • lam (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.

  • a (astropy.units.Quantity or numpy.ndarray) – Grain radius; plain arrays are assumed to be in microns.

  • cm (xdust.graindist.composition object) – Holds the optical constants and density for the compound.

  • theta (astropy.units.Quantity or numpy.ndarray or float) – Scattering angles; plain values are assumed to be in radians.

Return type:

None

read_from_table(infile)[source]

Reads in a previous scattering model calculation from a FITS file

Parameters:

infile (str) – Name of the input FITS file.

write_table(outfile, overwrite=True)[source]

Write the current scattering model calculation to a FITS file

Parameters:
  • outfile (str) – Name of the output file.

  • overwrite (bool) – If True (default), overwrite an existing file of the same name.

RGscattering

class xdust.scatteringmodel.RGscattering(**kwargs)[source]

Bases: ScatteringModel

Rayleigh-Gans scattering model. See Mauche & Gorenstein (1986), ApJ 302, 371 and Smith & Dwek (1998), ApJ, 503, 831

calculate(lam, a, cm, theta=0.0)[source]

Calculate the extinction efficiences with the Rayleigh-Gans approximation.

Parameters:
  • lam (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.

  • a (astropy.units.Quantity or numpy.ndarray) – Grain radius; plain arrays are assumed to be in microns.

  • cm (xdust.graindist.composition object) – Holds the optical constants and density for the compound.

  • theta (astropy.units.Quantity or numpy.ndarray or float) – Scattering angles; plain values are assumed to be in radians.

Returns:

  • None

  • Updates the qsca, qext, qabs, and diff attributes.

characteristic_angle(lam, a)[source]

Calculates the characteristic scattering angle under the Rayleigh-Gans approximation, with the Gaussian approximation to the bessel functions.

Parameters:
  • lam (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.

  • a (astropy.units.Quantity or numpy.ndarray) – Grain radius; plain arrays are assumed to be in microns.

Returns:

Characteristic scattering angle using \(\sigma = 1.04~\mathrm{arcmin}~(E/\mathrm{keV})^{-1}(a/\mu\mathrm{m})^{-1}\)

Return type:

astropy.units.Quantity

Mie

class xdust.scatteringmodel.Mie(**kwargs)[source]

Bases: ScatteringModel

Mie scattering algorithms of Bohren & Hoffman. See their book: Absorption and Scattering of Light by Small Particles

gsca

Average cosine of the scattering angle.

Type:

numpy.ndarray

qback

Back-scattering efficiency.

Type:

numpy.ndarray

calculate(lam, a, cm, theta=0.0, memlim=8.0)[source]

Calculate the extinction efficiences using the Mie formula for spherical particles.

Parameters:
  • lam (astropy.units.Quantity or numpy.ndarray) – Wavelength or energy; plain arrays are assumed to be in keV.

  • a (astropy.units.Quantity or numpy.ndarray) – Grain radius; plain arrays are assumed to be in microns.

  • cm (xdust.graindist.composition object) – Holds the optical constants and density for the compound.

  • theta (astropy.units.Quantity or numpy.ndarray or float) – Scattering angles; plain values are assumed to be in radians.

  • memlim (float) – Memory limit for the calculation [GB]. Default 8.0.

Returns:

  • None

  • Updates the qsca, qext, qabs, diff, gsca, and qback attributes.

GGADT

class xdust.scatteringmodel.GGADT(from_file)[source]

Bases: ScatteringModel

This scattering model loads data from pre-computed GGADT output files.

See Hoffman & Draine (2016).

PAH

class xdust.scatteringmodel.PAH(pahtype, **kwargs)[source]

Bases: ScatteringModel

PAH properties loaded from Draine tables (public on B. Draine’s website).

See Li & Draine (2001)

Parameters:

pahtype (string) – Type of PAH to load; options are ‘ion’ (ionized) or ‘neu’ (neutral)

pahtype

‘ion’ (ionized) or ‘neu’ (neutral)

Type:

string

stype

‘PAHion’ or ‘PAHneu’ depending on the type of PAH loaded

Type:

string

calculate(lam, a=0.01, unit='keV')[source]

Get the extinction efficiences by interpolating the tables from Li & Draine (2001).

lamastropy.units.Quantity -or- numpy.ndarray

Wavelength or energy values for calculating the cross-sections; if no units specified, defaults to keV

aastropy.units.Quantity -or- numpy.ndarray

Grain radius value(s) to use in the calculation; if no units specified, defaults to micron

cmxdust.graindist.composition object

Holds the optical constants and density for the compound.

thetaastropy.units.Quantity -or- numpy.ndarray -or- float

Scattering angles for computing the differential scattering cross-section; if no units specified, defaults to radian

Returns:

  • None

  • Updates the qsca, qext, qabs, diff, gsca, and qback attributes using the lookup tables from Li & Draine (2001).