jwspecfit.lines

Emission-line database and line-list helpers.

Functions

get_line_list([grating])

Return default line names for a given grating.

observable_lines(line_names, z, wave_min_um, ...)

Filter lines to those observable in the wavelength range.

observed_wave_A(name, z)

Return observed wavelength in Angstroms for a line at redshift z.

observed_wave_um(name, z)

Return observed wavelength in microns for a line at redshift z.

rest_wave_A(name)

Return rest wavelength in Angstroms for a line name.

show_lines(*[, rest_min_A, rest_max_A, search])

Print the available emission/absorption lines in REST_LINES_A.

jwspecfit.lines.get_line_list(grating='prism')[source]

Return default line names for a given grating.

For prism (R ~ 30–300), merged doublet entries are used for pairs that cannot be resolved. For medium and high-resolution gratings (R ≥ 1000), individual doublet components are returned.

The user can always override by passing an explicit lines= argument to fit_lines().

Parameters:

grating (str) – One of "prism", "medium" / "g140m" / "g235m" / "g395m", "high" / "g140h" / "g235h" / "g395h", or "grating" (generic resolved mode).

Returns:

Line names present in REST_LINES_A.

Return type:

list of str

jwspecfit.lines.observable_lines(line_names, z, wave_min_um, wave_max_um, *, margin_sigma=3.0, sigma_um=0.005)[source]

Filter lines to those observable in the wavelength range.

Parameters:
  • line_names (list of str) – Candidate line names (keys of REST_LINES_A).

  • z (float) – Source redshift.

  • wave_min_um (float) – Observed wavelength range in microns.

  • wave_max_um (float) – Observed wavelength range in microns.

  • margin_sigma (float) – Number of sigma margin from the edges.

  • sigma_um (float) – Approximate line width in microns (for margin calculation).

Returns:

Lines whose observed wavelength falls within the range.

Return type:

list of str

jwspecfit.lines.observed_wave_A(name, z)[source]

Return observed wavelength in Angstroms for a line at redshift z.

Return type:

float

Parameters:
jwspecfit.lines.observed_wave_um(name, z)[source]

Return observed wavelength in microns for a line at redshift z.

Return type:

float

Parameters:
jwspecfit.lines.rest_wave_A(name)[source]

Return rest wavelength in Angstroms for a line name.

Parameters:

name (str) – Line name (key of REST_LINES_A).

Returns:

Rest wavelength in Angstroms.

Return type:

float

Raises:

KeyError – If the line name is not found.

jwspecfit.lines.show_lines(*, rest_min_A=None, rest_max_A=None, search=None)[source]

Print the available emission/absorption lines in REST_LINES_A.

The printed names are the keys you can pass to the lines= or add_lines= arguments of plot_spectrum_interactive() (and to the fitter), grouped by wavelength region.

Parameters:
  • rest_min_A (float, optional) – Restrict to lines with rest wavelengths in this range (Angstroms).

  • rest_max_A (float, optional) – Restrict to lines with rest wavelengths in this range (Angstroms).

  • search (str, optional) – Case-insensitive substring filter on the line name.

Return type:

None

Examples

>>> import jwspecfit
>>> jwspecfit.show_lines(rest_min_A=4000, rest_max_A=5100)
>>> jwspecfit.show_lines(search="Fe")