CompositeStarFormationHistory#
- class cogsworth.sfh.CompositeStarFormationHistory(components, component_ratios, **kwargs)[source]#
Bases:
objectA star formation history that is a combination of multiple other star formation histories.
This class allows you to combine multiple star formation histories together, for example to create a composite star formation history for the Milky Way with a disc and a bulge. You can also use this to combine multiple instances of the same star formation history, for example to create a composite star formation history for the Milky Way with a thin and thick disc.
- Parameters:
- componentslist of
StarFormationHistory The star formation histories to combine. These will be sampled in proportion to their size.
- componentslist of
Attributes Summary
The galactocentric positions of the sampled points
The galactocentric velocities of the sampled points
Methods Summary
from_file(file_name[, key])Load a composite star formation history from file
get_citations([filename])Print the citations for the packages/papers used in the star formation history
plot(**kwargs)Plot the star formation history using the default plotting function
sample(size)Sample from the distributions for each component, combine and save in class attributes
save(file_name[, key])Save the entire class to storage.
Attributes Documentation
- positions[source]#
The galactocentric positions of the sampled points
- Returns:
- positions
Quantity[length], shape=(3,size) The galactocentric positions of the sampled points
- positions
- velocities[source]#
The galactocentric velocities of the sampled points
- Returns:
- velocities
Quantity[velocity], shape=(3,size) The galactocentric velocities of the sampled points
- velocities
Methods Documentation
- classmethod from_file(file_name, key='sfh')[source]#
Load a composite star formation history from file
- Parameters:
- file_namestr
The name of the hdf5 file from which to load the star formation history. If this doesn’t end in “.h5” then “.h5” will be appended.
- keystr, optional
The key under which the data is stored in the hdf5 file, by default “sfh”
- Returns:
- sfh
CompositeStarFormationHistory The loaded composite star formation history
- sfh
- get_citations(filename=None)[source]#
Print the citations for the packages/papers used in the star formation history
- plot(**kwargs)[source]#
Plot the star formation history using the default plotting function
See
plot_sfh()for more details and options.