eq_width

specviz.analysis.eq_width(cont1_stats, cont2_stats, line, mask=None)[source]

Compute an equivalent width given stats for two continuum regions, and a Data instance with the extracted spectral line region.

This uses for now a very simple continuum subtraction method; i.e., it just subtracts a constant from the line spectrum, where the constant is (continuum1[mean] + continuum2[mean]) / 2.

Parameters:
  • cont2_stats (cont1_stats,) – This is returned by the stats() function.
  • line (Spectrum1DRefLayer) – This is returned by the extract() function.
  • mask (ndarray) – Boolean mask.
Returns:

ew, flux, avg_cont – Flux and equivalent width values.

Return type:

float

Examples

>>> d = Spectrum1DRefLayer(...)
>>> cont1 = extract(d, (100, 5000))
>>> cont2 = extract(d, (18000, 20000))
>>> cont1_stats = stats(cont1)
>>> cont2_stats = stats(cont2)
>>> line = extract(d, (15000, 18000))
>>> flux, ew = eq_width(cont1_stats, cont2_stats, line)