trident.spectrum_generator.SpectrumGenerator.make_spectrum

SpectrumGenerator.make_spectrum(ray, lines='all', output_file=None, output_absorbers_file=None, use_peculiar_velocity=True, observing_redshift=0.0, ly_continuum=True, store_observables=False, min_tau=0.001, njobs='auto')[source]

Make a spectrum from ray data depositing the desired lines. Make sure to pass this function a LightRay object and potentially also a list of strings representing what lines you’d like to actually have be deposited in your final spectrum.

Parameters

Ray

string, dataset, or data container

If a string, the path to the ray dataset. As a dataset, this is the ray dataset loaded by yt. As a data container, this is a data object created from a ray dataset, such as a cut region.

Lines

list of strings

List of strings that determine which lines will be added to the spectrum. List can include things like “C”, “O VI”, or “Mg II ####”, where #### would be the integer wavelength value of the desired line. If set to ‘all’, includes all lines in LineDatabase set in SpectrumGenerator. Default: ‘all’

Output_file

optional, string

Filename of output if you wish to save the spectrum immediately without any further processing. File formats are chosen based on the filename extension. “.h5” for HDF5, “.fits” for FITS, and everything else is ASCII. Equivalent of calling save_spectrum. Default: None

Output_absorbers_file

optional, string

Option to save a text file containing all of the absorbers and corresponding wavelength and redshift information. For parallel jobs, combining the lines lists can be slow so it is recommended to set to None in such circumstances. Default: None

Use_peculiar_velocity

optional, bool

If True, include the effects of doppler redshift of the gas in shifting lines in the final spectrum. Default: True

Observing_redshift

optional, float

This is the value of the redshift at which the observer of this spectrum exists. In most cases, this will be a redshift of 0. Default: 0.

Ly_continuum

optional, boolean

If any H I lines are used in the line list, this assures a Lyman continuum will be included in the spectral generation. Lyman continuum begins at final Lyman line deposited (Ly 39 = 912.32 A) not at formal Lyman Limit (911.76 A) so as to not have a gap between final Lyman lines and continuum. Uses power law of index 3 and normalization to match opacity of final Lyman lines. Default: True

Store_observables

optional, boolean

If set to true, observable properties for each cell in the light ray will be saved for each line in the line list. Properties include the column density, tau, thermal b, and the wavelength where tau was deposited. Best applied for a reasonable number of lines. These quantities will be saved to the SpectrumGenerator attribute: ‘line_observables_dict’. Default: False

Min_tau

optional, float This value determines size of the wavelength window used to deposit lines or continua. The wavelength window is expanded until the optical depth at the edge is below this value. If too high, this will result in features appearing cut off at the edges. Decreasing this will make features smoother but will also increase run time. An increase by a factor of ten will result in roughly a 2x slow down. Default: 1e-3.

Njobs

optional, int or “auto”

The number of process groups into which the loop over absorption lines will be divided. If set to -1, each absorption line will be deposited by exactly one processor. If njobs is set to a value less than the total number of available processors (N), then the deposition of an individual line will be parallelized over (N / njobs) processors. If set to “auto”, it will first try to parallelize over the list of lines and only parallelize the line deposition if there are more processors than lines. This is the optimal strategy for parallelizing spectrum generation. Default: “auto”

Example

Make a one zone ray and generate a COS spectrum for it including only Oxygen VI, Mg II, and all Carbon lines, and plot to disk.

>>> import trident
>>> ray = trident.make_onezone_ray()
>>> sg = trident.SpectrumGenerator('COS')
>>> sg.make_spectrum(ray, lines=['O VI', 'Mg II', 'C'])
>>> sg.plot_spectrum('spec_raw.png')