API

Submodules

Inheritance diagram of pypahdb.decomposer_base, pypahdb.decomposer
Inheritance diagram of pypahdb.observation

pypahdb.decomposer_base module

decomposer_base.py

Using a precomputed matrix of theoretically calculated PAH emission spectra, an input spectrum is fitted and decomposed into contributing PAH subclasses using a non-negative least-squares (NNLS) approach.

This file is part of pypahdb - see the module docs for more information.

class pypahdb.decomposer_base.DecomposerBase(spectrum)[source]

Bases: object

Fit and decompose spectrum.

Attributes:

spectrum: A spectrum to fit and decompose.

property charge

Return the spectral charge breakdown from fit.

Returns:

self._charge (dictionary): Dictionary with keys ‘anion’, ‘neutral’ and ‘cation’.

property charge_fractions

Return the charge fraction.

Returns:

self._charge_fraction (dict): Fraction of neutral, cation and anion PAHs from fit.

property error

Return the error as ∫|residual|dν / ∫observation dν.

Returns:

self._yerror (quantity.Quantity): The fit error.

property fit

Return the fit.

Returns:

self._yfit (quantity.Quantity): The fit.

property nc

Return the average number of carbon atoms.

Returns:

self._nc (quantity.Quantity): Average number of carbon atoms

property size

Return the spectral size breakdown from fit.

Returns:

self._size (dictionary): Dictionary with keys ‘large’, ‘medium’, ‘small’.

property size_fractions

Return the size fraction.

Returns:

self._size_fractions (dict): Size fractions from fit.

pypahdb.decomposer module

decomposer.py

Subclass of DecomposerBase for writting results to disk.

This file is part of pypahdb - see the module docs for more information.

class pypahdb.decomposer.Decomposer(spectrum)[source]

Bases: DecomposerBase

Extends DecomposerBase to write results to disk (PDF, FITS).

property cation_neutral_ratio

Calculate the cation neutral ratio if it is not already calculated and return it.

plot_fit(i=0, j=0)[source]

Plots a fit and saves it to a PDF.

Notes:

None.

Args:

i (int): Pixel coordinate (abscissa). j (int): Pixel coordinate (ordinate).

Returns:

fig (matplotlib.figure.Figure): Instance of figure.

static plot_map(data, title, wcs=None)[source]

Plots a map.

Notes:

None.

Args:

im (numpy): Image. title (string): Image title.

Keywords:

wcs (wcs.wcs): WCS (defaults to None).

Returns:

fig (matplotlib.figure.Figure): Instance of figure.

save_fits(filename, header='')[source]

Save FITS file summary of the fit results.

Args:

filename (str): Path to save to. header (str): Optional, header for the FITS file.

save_pdf(filename, header='', domaps=True, doplots=True)[source]

Save a PDF summary of the fit results.

Notes:

None.

Args:

filename (str): Path to save to. header (str): Optional, header data.

Keywords:

domaps (bool): Save maps to PDF (defaults to True). doplots (bool): Save plots to PDF (defaults to True).

Returns:

None.

pypahdb.observation module

observation.py

Manages reading an astronomical observation from file.

This file is part of pypahdb - see the module docs for more information.

class pypahdb.observation.Observation(file_path)[source]

Bases: object

Creates an Observation object.

Reads IPAC tables, Spitzer-IRS data cubes, and JWST spectra.

Attributes:

spectrum (specutils.Spectrum1D): contains loaded spectrum.

Module contents

The pypahdb Python package is being developed as part of the awarded James Webb Space Telescope (JWST) Early Release Science (ERS) program “Radiative Feedback from Massive Stars as Traced by Multiband Imaging and Spectroscopic Mosaics” (ID: 1288). The entire program is coordinated by an international “Core team” of 19 scientists and supported by 119 “science collaborators”. pypahdb is developed by the NASA Ames PAH IR Spectroscopic Database team, asscociated with the Astrophysics & Astrochemistry Laboratory at NASA Ames Research Center.

The NASA Ames PAH IR Spectroscopic Database and pypahdb are being supported through a directed Work Package at NASA Ames titled: “Laboratory Astrophysics - The NASA Ames PAH IR Spectroscopic Database”.

pypahdb uses a precomputed matrix of theoretically calculated PAH emission spectra from version 3.00 of the library of computed spectra and is downloaded when installing the package. This matrix has been constructed from a collection of “astronomical” PAHs, which meet the following critera and include the fullerenes C₆₀ and C₇₀:

‘magnesium=0 oxygen=0 iron=0 silicium=0 chx=0 ch2=0 c>20 hydrogen>0’

The PAH emission spectra have been calculated employing a PAH emission model with the following parameters:

  • A calculated vibrational temperature upon the absorption of a 7 eV photon.

  • A calculated integrated band intensity after following the entire emission cascade.

  • A redshift of 15 cm⁻¹ to mimic some anharmonic effect.

  • A Gaussian emission profile with a FWHM of 15 cm⁻¹.

Additional information can be found at the NASA Ames PAH IR Spectroscopic Database website, which is located at https://www.astrochemistry.org/pahdb/

You are kindly asked to consider the following references for citation when using pypahdb:

  • M.J. Shannon, and C. Boersma, “ORGANIC MOLECULES IN SPACE: INSIGHTS FROM THE NASA AMES MOLECULAR DATABASE IN THE ERA OF THE JAMES WEBB SPACE TELESCOPE” in Proceedings of the 17th Python in Science Conference, eds. F. Akici, D. Lippa, D. Niederhut, and M. Pacer, 99, 2018, https://doi.org/10.25080/Majora-4af1f417-00f

  • C.W. Bauschlicher, Jr., A. Ricca, C. Boersma, and L.J. Allamandola, “THE NASA AMES PAH IR SPECTROSCOPIC DATABASE: COMPUTATIONAL VERSION 3.00 WITH UPDATED CONTENT AND THE INTRODUCTION OF MULTIPLE SCALING FACTORS”, The Astrophysical Journal Supplement Series, 234, 32, 2018 https://doi.org/10.3847/1538-4365/aaa019

  • C. Boersma, C.W. Bauschlicher, Jr., A. Ricca, A.L. Mattioda, J. Cami, E. Peeters, F. Sanchez de Armas, G. Puerta Saborido, D.M. Hudgins, and L.J. Allamandola, “THE NASA AMES PAH IR SPECTROSCOPIC DATABASE VERSION 2.00: UPDATED CONTENT, WEBSITE AND ON/OFFLINE TOOLS”, The Astrophysical Journal Supplement Series, 211, 8, 2014 https://doi.org/10.1088/0067-0049/211/1/8

  • Mattioda, A. L., Hudgins, D. M., Boersma, C., Ricca, A., Peeters, E., Cami, J., Sanchez de Armas, F., Puerta Saborido, G., Bauschlicher, C. W., J., and Allamandola, L. J. “THE NASA AMES PAH IR SPECTROSCOPIC DATABASE: THE LABORATORY SPECTRA”, The Astrophysical Journal Supplement Series, 251, 22, 2020, https://doi.org/10.3847/1538-4365/abc2c8