API Reference

The classes and functions of StarKit, by module, generated from their docstrings.

Synthetic photometry

starkit.filters Module

Filter curves and zero points for synthetic photometry.

A Filter holds a response curve and its detector type. The mean flux density of a spectrum through a filter is

<f_lambda> = int f_lambda S(lambda) lambda dlambda / int S(lambda) lambda dlambda

for a photon-counting curve S, and

<f_lambda> = int f_lambda S’(lambda) dlambda / int S’(lambda) dlambda

for an energy response curve S’, as published for photomultiplier photometry (Bessell & Murphy 2012, PASP 124, 140, Appendix A). Both forms are computed here with the energy-weighted response, S lambda or S’.

Functions

as_filters(filter_set)

Make a list of Filter objects.

vega_spectrum()

Spectrum of Vega used for the Vega zero points, read from VEGA_FILE.

Classes

Filter(wavelength, transmission[, detector, ...])

Response curve of a photometric filter.

starkit.base.operations.imager Module

Classes

Photometry(filter_set[, mag_type, ...])

Magnitudes of a spectrum in a set of filters.

Models

starkit.base.assemble_model Module

Functions

assemble_model([spectral_grid, spectrum, ...])

starkit.base.operations.stellar Module

Classes

RotationalBroadening([velocity_per_pix, vrot])

The rotational broadening kernel was taken from Observation and Analysis of Stellar Photospheres by David Gray

DopplerShift(vrad)

Module to model the velocity of the star with the relativistic redshift correction.

RadialVelocity(vrad)

Module to model the classical definition of radial velocity

CCM89Extinction([a_v, r_v])

Distance(distance[, lum_density2cgs])

starkit.base.operations.spectrograph Module

Classes

InstrumentRConstant([R, grid_R, grid_sampling])

Convolve with a gaussian with given resolution to mimick an instrument assuming lambda / delta_lambda being constant

InstrumentDeltaLambdaConstant(delta_lambda, ...)

Convolve with a gaussian with given resolution to mimick an instrument assuming delta_lambda being constant

Interpolate(observed)

This class can be called to do a interpolation on a given spectrum.

Normalize(observed, npol)

Normalize a model spectrum to an observed one using a polynomial

NormalizeParts(observed, parts, npol)

Normalize a model spectrum to an observed one in multiple parts

Fitting

starkit.fitkit.likelihoods Module

Classes

Addition()

PhotometryColorLikelihood(magnitudes[, ...])

Gaussian likelihood of the colors between consecutive filters.

RelativePhotometryLikelihood(magnitudes[, ...])

Gaussian likelihood of the magnitudes.

SpectralChi2Likelihood(observed, *args, **kwargs)

SpectralChi2LikelihoodAddErr(observed[, add_err])

SpectralL1Likelihood(observed, *args, **kwargs)

SpectralScaledChi2Likelihood(observed[, lnf])

starkit.fitkit.priors Module

Classes

FixedPrior(val)

A fixed value

GaussianPrior(m, sigma)

A gaussian prior

PoissonPrior(m)

A Poisson prior

PriorCollection(priors_list)

A collection of prior objects that will be evaluated

UniformPrior(lbound, ubound)

A Uniform distribution prior

starkit.fitkit.multinest Package

Classes

MultiNest(likelihood, priors[, run_dir, prefix])

Use multinest to fit a spectrum using a grid of models generated by specgrid.

MultiNestResult(posterior_data)

Grids

starkit.gridkit Package

Functions

load_grid(hdf_fname[, wavelength_type, ...])

Load the grid from an HDF file

load_telluric_grid(hdf_fname[, ...])

Load the grid from an HDF file

Classes

BaseProcessGrid(index, input_wavelength, meta)

starkit.gridkit.flux_check Module

Compare the flux scale of a grid with the surface flux of a blackbody.

The flux_unit label of a grid does not always describe its fluxes: grids written by StarKit before January 2025 are labeled erg/s/angstrom whether they hold luminosity density or surface flux. check_flux_scale integrates a few model spectra of a grid over its wavelength range and divides by the integral of the surface flux of a blackbody at the same effective temperature, pi * B_lambda(teff). The ratio identifies what the fluxes are:

  • about 1 for surface flux, F_lambda (erg / (s cm2 Angstrom));

  • about 1/pi for surface flux divided by pi;

  • about 1/(4 pi) for the Eddington flux, F_lambda / (4 pi);

  • 4 pi R**2, with R the stellar radius in cm (about 6e22 for the Sun), for luminosity density, L_lambda (erg / (s Angstrom));

  • continuum-normalized spectra have values near 1 and carry no flux scale.

Model spectra differ from a blackbody by tens of percent, more so over a narrow wavelength range, so the ratios of surface fluxes found in practice lie between about 0.5 and 2.

Functions

blackbody_surface_flux(wavelength, teff)

Surface flux pi * B_lambda of a blackbody, in erg / (s cm2 Angstrom).

check_flux_scale(path[, n_models, teff_column])

Compare the fluxes of a grid with the surface flux of a blackbody.

format_flux_scale_check(check)

Text report of a FluxScaleCheck.

Classes

ModelFluxCheck(parameters, ratio, ...[, ...])

Flux scale of one model spectrum of a grid.

FluxScaleCheck(path, flux_unit, label_kind, ...)

starkit.gridkit.inspector Module

Functions

format_inspection_summary(inspection)

inspect_grid(path)

inspection_to_dict(inspection)

inspection_to_json(inspection)

Classes

GridInspection(path, parameter_names, ...)

ParameterInspection(name, minimum, maximum, ...)