Stellar Kurucz Model¶
A complete example of using a stellar Kurucz model to generate an emission spectrum is shown below. It is an adaption of ‘stellar_kurucz_model’ found in the examples-directory of the software tools, and is followed by a detailed, line-by-line, explanation of the code.
1pahdb = OBJ_NEW('AmesPAHdbIDLSuite')
2
3uid = 18
4
5transitions = pahdb->getTransitionsByUID(uid)
6
7FTAB_EXT,'ckp00_17000.fits',[1,10],angstroms,flem,EXT=1
8
9e = !EXCEPT
10
11!EXCEPT = 0
12
13transitions->Cascade, $
14 AMESPAHDBIDLSUITE_CREATE_KURUCZ_STELLARMODEL_S(angstroms, flem), $
15 /Star, $
16 /StellarModel, $
17 /Convolved
18
19transitions->Shift,-15D
20
21spectrum = transitions->Convolve(FWHM=15D)
22
23spectrum->Plot
24
25OBJ_DESTROY,[spectrum, transitions, pahdb]
26
27!EXCEPT = e
1import importlib_resources
2import numpy as np
3
4from amespahdbpythonsuite.amespahdb import AmesPAHdb
5
6from astropy.io import fits
7
8
9file_path = importlib_resources.files("amespahdbpythonsuite")
10xml_file = file_path / "resources/pahdb-theoretical_cutdown.xml"
11pahdb = AmesPAHdb(
12 filename=xml_file,
13 check=False,
14 cache=False,
15)
16
17uid = 18
18
19transitions = pahdb.gettransitionsbyuid(uid)
20
21fits_file = file_path / "resources/ckp00_17000.fits"
22with fits.open(fits_file) as hdulist:
23 angstrom = hdulist[1].data["WAVELENGTH"]
24 kurucz = {
25 "frequency": 1e8 / np.flip(angstrom),
26 "intensity": 1e-8
27 * np.flip(hdulist[1].data["g40"] * angstrom**2)
28 / (4 * np.pi),
29 }
30
31transitions.cascade(
32 kurucz,
33 star=True,
34 stellar_model=True,
35 convolved=True,
36 multiprocessing=False,
37)
38
39transitions.shift(-15.0)
40
41spectrum = transitions.convolve(fwhm=15.0, lorentzian=True, multiprocessing=False)
42
43spectrum.plot(show=True, legend=True)
A line-by-line explanation of the code follows.
line 1: The default NASA Ames PAH IR Spectroscopic Database XML-file is loaded.
line 3: Selecting UID 18 for coronene.
line 5: Retrieving the fundamental vibrational transitions for coronene.
line 7: Use astrolib’s FTAB_EXT to load in the Kurucz model from FITS file.
lines 9-11: Surpress under/overflow reporting.
lines 13-17: A Cascade emission model is applied that takes the Kurucz model as input using the AMESPAHDBIDLSUITE_CREATE_KURUCZ_STELLARMODEL_S convenience function to convert to expected units and convolves it with the entire spectrum.
line 19: The fundamental vibrational transitions are redshifted 15 cm-1.
line 21: The fundamental vibrational transitions are convolved with Lorentzian profiles having a full-width-at-half-maximum of 15 cm-1.
line 23: Display the resulting spectrum.
line 25: Cleanup.
line 27: Restore suppressing under/overflow reporting.
lines 1-6: Importing the necessary modules.
lines 9-15: The cutdown version of the database XML-file included with the suite is loaded.
line 17: Selecting UID 18 for coronene.
line 19: Retrieving the fundamental vibrational transitions for coronene.
line 21-29: Use astropy to load the Kurucz model from FITS file and convert to expected units.
lines 31-37: A Cascade emission model is applied that takes the Kurucz model as input and convolves it with the entire spectrum.
line 39: The fundamental vibrational transitions are redshifted 15 cm-1.
line 41: The fundamental vibrational transitions are convolved with Lorentzian profiles having a full-width-at-half-maximum of 15 cm-1.
line 43: Display the resulting spectrum.
Below the generated output.