milespy.line_strength_indices.line_strength_index

milespy.line_strength_indices.line_strength_index(indices, ll, flux, z, plot=False, noise=None, z_err=None, sims=0)

Measure line-strength indices on a spectrum.

Wavelength and flux are converted to a canonical form: wavelength in Ångström (linear step assumed), flux in dimensionless counts. Redshift z must be in velocity units (e.g. km/s); it is used to deredshift the wavelength to rest frame.

Parameters:
  • indices (list[LineStrengthIndex]) – Index definitions to compute.

  • ll (Quantity) – Wavelength vector (e.g. u.AA); assumed linear steps.

  • flux (Quantity) – Flux or counts as a function of wavelength (any flux density unit).

  • z (Quantity) – Redshift (adimensional) or velocity shift (e.g. km/s).

  • plot (bool, optional) – Whether to plot the bands (default False).

  • noise (Quantity, optional) – Noise spectrum (for error simulations; not yet implemented).

  • z_err (Quantity, optional) – Redshift error in velocity (for sims; not yet implemented).

  • sims (int, optional) – Number of Monte Carlo simulations for errors (default 0). If > 0, raises NotImplementedError.

Returns:

Dictionary of index name -> value (array or scalar).

Return type:

LineStrengthDict