yt.analysis_modules.star_analysis.sfr_spectrum.SpectrumBuilder.calculate_spectrum

SpectrumBuilder.calculate_spectrum(data_source=None, star_mass=None, star_creation_time=None, star_metallicity_fraction=None, star_metallicity_constant=None, min_age=0.0 yr)[source]

For the set of stars, calculate the collective spectrum. Attached to the output are several useful objects: final_spec: The collective spectrum in units of flux binned in

wavelength.

wavelength: The wavelength for the spectrum bins, in Angstroms. total_mass: Total mass of all the stars. avg_mass: Average mass of all the stars. avg_metal: Average metallicity of all the stars.

Parameters:

data_source : AMRRegion object, optional

The region from which stars are extracted for analysis. If this is not specified, the next three parameters must be supplied.

star_mass : Array or list of floats

An array of star masses in Msun units.

star_creation_time : Array or list of floats

An array of star creation times in code units.

star_metallicity_fraction : Array or list of floats

An array of star metallicity fractions, in code units (which is not Z/Zsun, rather just Z).

star_metallicity_constant : Float

If desired, override the star metallicity fraction of all the stars to the given value.

min_age : Float

Removes young stars younger than this number (in years) from the spectrum. Default: 0 (all stars).

Examples

>>> import yt
>>> from yt.analysis_modules.star_analysis.api import SpectrumBuilder
>>> ds = yt.load("Enzo_64/RD0006/RedshiftOutput0006")
>>> spec = SpectrumBuilder(ds, "bc", model="salpeter")
>>> sp = ds.sphere([0.5, 0.5, 0.5], 0.1)
>>> spec.calculate_spectrum(data_source=sp, min_age=1.e6)