StarFormationHistory#

class cogsworth.sfh.StarFormationHistory(**kwargs)[source]#

Bases: object

Class for a generic galactic star formation history model from which to sample

This class sets out an outline for sampling from a star formation history model but a subclass will be needed for things to function properly.

All attributes listed below are a given value for the sampled points in the galaxy. If one hasn’t been sampled/calculated when accessed then it will be automatically sampled/calculated. If sampling, ALL values will be sampled.

Attributes Summary

Z

The metallicities of the sampled points

phi

The galactocentric azimuthal angle of the sampled points

positions

The galactocentric positions of the sampled points

rho

The galactocentric cylindrical radius of the sampled points

tau

The lookback times of the sampled points

v_R

The galactocentric radial velocity of the sampled points

v_T

The galactocentric tangential velocity of the sampled points

v_phi

The galactocentric azimuthal velocity of the sampled points

v_x

The galactocentric x velocity of the sampled points

v_y

The galactocentric y velocity of the sampled points

v_z

The galactocentric vertical velocity of the sampled points

velocities

x

The galactocentric x positions of the sampled points

y

The galactocentric y positions of the sampled points

z

The galactocentric z positions of the sampled points

Methods Summary

copy()

Return a copy of this star formation history

draw_heights(size)

draw_lookback_times(size)

draw_phi(size)

draw_radii(size)

get_citations([filename])

Print the citations for the packages/papers used in the star formation history

get_metallicity()

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.

sfh_citation_statement(citations[, filename])

Print the citations for the packages/papers used in the star formation history

Attributes Documentation

Z[source]#

The metallicities of the sampled points

Returns:
ZQuantity [dimensionless]

The metallicities of the sampled points (absolute metallicity not solar metallicity)

phi[source]#

The galactocentric azimuthal angle of the sampled points

A shortcut for \(\arctan(y / x)\)

Returns:
phiQuantity [angle]

The galactocentric azimuthal angle of the sampled points

positions[source]#

The galactocentric positions of the sampled points

Returns:
positionsQuantity [length], shape=(3, size)

The galactocentric positions of the sampled points

rho[source]#

The galactocentric cylindrical radius of the sampled points

A shortcut for the radius in the x-y plane, \(\sqrt{x^2 + y^2}\)

Returns:
rhoQuantity [length]

The galactocentric cylindrical radius of the sampled points

tau[source]#

The lookback times of the sampled points

Returns:
tauQuantity [time]

The lookback times of the sampled points

v_R[source]#

The galactocentric radial velocity of the sampled points

v_T[source]#

The galactocentric tangential velocity of the sampled points

v_phi[source]#

The galactocentric azimuthal velocity of the sampled points

A shortcut for \((v_T / \rho)\)

v_x[source]#

The galactocentric x velocity of the sampled points

A shortcut for \(v_R \cos(\phi) - v_T \sin(\phi)\)

v_y[source]#

The galactocentric y velocity of the sampled points

A shortcut for \(v_R \sin(\phi) + v_T \cos(\phi)\)

v_z[source]#

The galactocentric vertical velocity of the sampled points

velocities[source]#
x[source]#

The galactocentric x positions of the sampled points

Returns:
xQuantity [length]

The galactocentric x positions of the sampled points

y[source]#

The galactocentric y positions of the sampled points

Returns:
yQuantity [length]

The galactocentric y positions of the sampled points

z[source]#

The galactocentric z positions of the sampled points

Returns:
zQuantity [length]

The galactocentric z positions of the sampled points

Methods Documentation

copy()[source]#

Return a copy of this star formation history

draw_heights(size)[source]#
draw_lookback_times(size)[source]#
draw_phi(size)[source]#
draw_radii(size)[source]#
get_citations(filename=None)[source]#

Print the citations for the packages/papers used in the star formation history

get_metallicity()[source]#
plot(**kwargs)[source]#

Plot the star formation history using the default plotting function

See plot_sfh() for more details and options.

sample(size)[source]#

Sample from the distributions for each component, combine and save in class attributes

save(file_name, key='sfh')[source]#

Save the entire class to storage.

Data will be stored in an hdf5 file using file_name.

Parameters:
file_namestr

A name to use for the hdf5 file in which samples will be stored. If this doesn’t end in “.h5” then “.h5” will be appended.

keystr, optional

Key to use for the hdf5 file, by default “sfh”

static sfh_citation_statement(citations, filename=None)[source]#

Print the citations for the packages/papers used in the star formation history

Parameters:
citationslist of str

The list of citations to include in the statement, these should be keys in the CITATIONS dict

filenamestr, optional

Filename for generating a bibtex file (leave blank to just print to terminal), by default None