trident.utilities.make_onezone_ray

trident.utilities.make_onezone_ray(density=1e-26, temperature=1000, metallicity=0.3, length=10, redshift=0, filename='ray.h5', column_densities=None)[source]

Create a one-zone ray object for use as test data. The ray consists of a single absorber of hydrodynamic characteristics specified in the function kwargs. It makes an excellent test dataset to test Trident’s capabilities for making absorption spectra.

You can specify the column densities of different ions explicitly using the column_densities keyword, or you can let Trident calculate the different ion columns internally from the density, temperature, and metallicity fields.

Using the defaults will produce a ray that should result in a spectrum with a good number of absorption features.

Parameters

Density

float, optional

The gas density value of the ray in g/cm**3 Default: 1e-26

Temperature

float, optional

The gas temperature value of the ray in K Default: 10**3

Metallicity

float, optional

The gas metallicity value of the ray in Zsun Default: 0.3

Length

float, optional

The length of the ray in kpc Default: 10.

Redshift

float, optional

The redshift of the ray Default: 0

Filename

string, optional

The filename to which to save the ray to disk. Due to the mechanism for passing rays, the ray data must be saved to disk. Default: ‘ray.h5’

Column_densities

dict, optional

The user can create a dictionary which adds more number density ion fields to the ray. Each key in the dictionary should be the desired ion field name according to the field name format: i.e. “<ELEMENT>_p<IONSTATE>_number_density” e.g. neutral hydrogen = “H_p0_number_density”. The corresponding value for each key should be the desired column density of that ion in cm**-2. See example below. Default: None

Returns

A YT LightRay object

Example

Create a one-zone ray, and generate a COS spectrum from that ray.

>>> import trident
>>> ray = trident.make_onezone_ray()
>>> sg = trident.SpectrumGenerator('COS')
>>> sg.make_spectrum(ray)
>>> sg.plot_spectrum('spec_raw.png')

Create a one-zone ray with an HI column density of 1e21 (DLA) and generate a COS spectrum from that ray for just the Lyman alpha line.

>>> import trident
>>> ds = trident.make_onezone_ray(column_densities={'H_p0_number_density': 1e21})
>>> sg = trident.SpectrumGenerator('COS')
>>> sg.make_spectrum(ray, lines=['Ly a'])
>>> sg.plot_spectrum('spec_raw.png')