milespy.line_strength_indices.LineStrengthIndex

class milespy.line_strength_indices.LineStrengthIndex(name, index_type, band_blue1, band_blue2, band_centre1, band_centre2, band_red1, band_red2)

Bases: object

Line-strength index definition (Lick/IDS-style bandpasses).

name

Name of the index.

Type:

str

type

Index type: “A” (atomic) or “M” (molecular). Atomic indices are in Ångström; molecular indices are in magnitudes.

Type:

str

bands

Internal array of six band edges in Ångström: [band_blue_left, band_blue_right, band_centre_left, band_centre_right, band_red_left, band_red_right]. Blue and red bands define the pseudo-continuum; the centre band is the feature.

Type:

np.ndarray

Methods

from_database(name)

Create an index from the name in the database.

__init__(name, index_type, band_blue1, band_blue2, band_centre1, band_centre2, band_red1, band_red2)

Define a line-strength index by its bandpass edges.

Parameters:
  • name (str) – Index name (e.g. “Mg2”, “Fe5015”).

  • index_type ("A" or "M") – “A” for atomic (equivalent width in Ångström); “M” for molecular (magnitude).

  • band_blue1 (quantity) – Left and right edges of the blue pseudo-continuum band (wavelength, e.g. u.AA).

  • band_blue2 (quantity) – Left and right edges of the blue pseudo-continuum band (wavelength, e.g. u.AA).

  • band_centre1 (quantity) – Left and right edges of the central feature band.

  • band_centre2 (quantity) – Left and right edges of the central feature band.

  • band_red1 (quantity) – Left and right edges of the red pseudo-continuum band.

  • band_red2 (quantity) – Left and right edges of the red pseudo-continuum band.

static from_database(name)

Create an index from the name in the database.

Reads from the configuration index file. Use search_indices_in_database() to find index names. Validates database row with LineStrengthIndexConfig before building the instance.

Parameters:

name (str) – Name of the index to load.

Return type:

LineStrengthIndex

Raises:
  • ValueError – If the index is not in the database or band data is invalid.

  • RuntimeError – If multiple indices match the name.