API reference

calc_rest_sed_sfh_table_lognormal_mdf(gal_t_table, gal_sfr_table, gal_lgmet, gal_lgmet_scatter, ssp_lgmet, ssp_lg_age_gyr, ssp_flux, t_obs, sfr_min=1e-14)[source]

Calculate the SED of a galaxy defined by input tables of SFH and a lognormal metallicity distribution function

Parameters:
  • gal_t_table (ndarray of shape (n_t, )) – Age of the universe in Gyr at which the input galaxy SFH and metallicity have been tabulated

  • gal_sfr_table (ndarray of shape (n_t, )) – Star formation history in Msun/yr evaluated at the input gal_t_table

  • gal_lgmet (ndarray of shape (n_t, )) – log10(Z) of the galaxy at the time of observation

  • gal_lgmet_scatter (float) – Lognormal scatter in metallicity

  • ssp_lgmet (ndarray of shape (n_met, )) – Array of log10(Z) of the SSP templates

  • ssp_lg_age_gyr (ndarray of shape (n_ages, )) – Array of log10(age/Gyr) of the SSP templates

  • ssp_flux (ndarray of shape (n_met, n_ages, n_wave)) – SED of the SSP in units of Lsun/Hz/Msun

  • t_obs (float) – Age of the universe in Gyr at the time the galaxy is observed

Returns:

RestSED

rest_sedndarray of shape (n_wave, )

Restframe SED of the galaxy in units of Lsun/Hz

weightsndarray of shape (n_met, n_ages, 1)

SSP weights of the joint distribution of stellar age and metallicity

lgmet_weightsndarray of shape (n_met, )

SSP weights of the distribution of stellar metallicity

age_weightsndarray of shape (n_ages, )

SSP weights of the distribution of stellar age

Return type:

namedtuple with the following entries:

calc_rest_sed_sfh_table_met_table(gal_t_table, gal_sfr_table, gal_lgmet_table, gal_lgmet_scatter, ssp_lgmet, ssp_lg_age_gyr, ssp_flux, t_obs, sfr_min=1e-14)[source]

Calculate the SED of a galaxy defined by input tables of SFH and metallicity

Parameters:
  • gal_t_table (ndarray of shape (n_t, )) – Age of the universe in Gyr at which the input galaxy SFH and metallicity have been tabulated

  • gal_sfr_table (ndarray of shape (n_t, )) – Star formation history in Msun/yr evaluated at the input gal_t_table

  • gal_lgmet_table (ndarray of shape (n_t, )) – Metallicity history evaluated at the input gal_t_table

  • gal_lgmet_scatter (float) – Lognormal scatter in metallicity

  • ssp_lgmet (ndarray of shape (n_met, )) – Metallicity of stellar populations of the input SSP table ssp_flux

  • ssp_lg_age_gyr (ndarray of shape (n_ages, )) – Age of stellar populations of the input SSP table ssp_flux

  • ssp_flux (ndarray of shape (n_met, n_ages, n_wave)) – SED of the SSP in units of Lsun/Hz/Msun

  • t_obs (float) – Age of the universe in Gyr at the time the galaxy is observed

Returns:

RestSED

rest_sedndarray of shape (n_wave, )

Restframe SED of the galaxy in units of Lsun/Hz

weightsndarray of shape (n_met, n_ages)

SSP weights of the joint distribution of stellar age and metallicity

lgmet_weightsndarray of shape (n_met, )

SSP weights of the distribution of stellar metallicity

age_weightsndarray of shape (n_ages, )

SSP weights of the distribution of stellar age

Return type:

namedtuple with the following entries:

calc_obs_mag(wave_spec_rest, lum_spec, wave_filter, trans_filter, redshift, Om0, w0, wa, h)[source]

Calculate the apparent magnitude of an SED observed through a filter

Parameters:
  • wave_spec_rest (ndarray of shape (n_wave, ))

  • lum_spec (ndarray of shape (n_wave, ))

  • wave_filter (ndarray of shape (n_filter_wave, ))

  • trans_filter (ndarray of shape (n_filter_wave, ))

  • redshift (float)

  • Om0 (float)

  • w0 (float)

  • wa (float)

  • h (float)

Returns:

obs_mag

Return type:

float

calc_rest_mag(wave_spec_rest, lum_spec, wave_filter, trans_filter)[source]

Calculate the restframe magnitude of an SED observed through a filter

Parameters:
  • wave_spec_rest (ndarray of shape (n_wave, ))

  • lum_spec (ndarray of shape (n_wave, ))

  • wave_filter (ndarray of shape (n_filter_wave, ))

  • trans_filter (ndarray of shape (n_filter_wave, ))

Returns:

rest_mag

Return type:

float

load_ssp_templates(fn=None, drn=None, bn='ssp_data_fsps_v3.2_lgmet_age.h5', ssp_keys=('ssp_lgmet', 'ssp_lg_age_gyr', 'ssp_wave', 'ssp_flux'), dummy=False)[source]

Load SSP templates from disk, defaulting to DSPS package data location

Parameters:
  • fn (string, optional) – Absolute path to hdf5 file storing the SSP data. This argument supersedes drn and bn. Default is None, in which case DSPS will look in the directory stored in the DSPS_DRN environment variable

  • drn (string, optional) – Directory to hdf5 file storing the SSP data This argument is only used if fn is not supplied Default behavior is the DSPS_DRN environment variable

  • bn (string, optional) – Basename of hdf5 file storing the SSP data This argument is only used if fn is not supplied

Returns:

ssp_lgmetndarray of shape (n_met, )

Array of log10(Z) of the SSP templates where dimensionless Z is the mass fraction of elements heavier than He

ssp_lg_age_gyrndarray of shape (n_ages, )

Array of log10(age/Gyr) of the SSP templates

ssp_wave : ndarray of shape (n_wave, )

ssp_fluxndarray of shape (n_met, n_ages, n_wave)

SED of the SSP in units of Lsun/Hz/Msun

Return type:

NamedTuple with 4 entries storing info about SSP templates

load_transmission_curve(fn=None, bn_pat=None, drn=None)[source]

Load filter transmission curves from disk, defaulting to DSPS package data location

Parameters:
  • fn (string, optional) – Absolute path to file storing the transmission curve. This argument supersedes drn and bn_pat. Default is None, in which case DSPS will look in the filters subdirectory of the drn stored in the DSPS_DRN environment variable

  • bn_pat (string, optional) – Basename pattern of file storing the transmission curve. For example, “lsst_r*” or “suprimecam_b*” There must exist a uniquely matching file in the input drn.

  • drn (string, optional) – Directory to files storing filter transmission curves This argument is only used if fn is not supplied Default behavior is the filters subdirectory of the drn stored in the DSPS_DRN environment variable

  • bn (string, optional) – Basename of file storing the filter transmission curve. This argument is only used if fn is not supplied

Returns:

wavendarray of shape (n, )

Array of λ/AA

transmissionndarray of shape (n, )

Fraction of the flux transmitted through the filter

Return type:

NamedTuple with 2 entries storing the transmission curve