jwspecfit.resolution

Spectral resolution models for JWST NIRSpec gratings.

Provides resolving power R(λ) and instrumental line broadening σ(λ) for prism, medium-resolution, and high-resolution gratings, as well as user-supplied numeric or callable R values.

Functions

R_from_pixels(lam_um)

Estimate resolving power from the pixel spacing.

R_grating(name)

Constant resolving power for a named grating.

R_prism(lam_um[, post_launch])

Resolving power R(λ) for NIRSpec PRISM/CLEAR (Jakobsen+22 Fig.

resolve_R(lam_um[, grating, R])

Return R(λ) array from either a grating name or user-supplied R.

sigma_inst_A(lam_um[, grating, R])

Instrumental Gaussian σ in Angstroms.

sigma_inst_kms(lam_um[, grating, R])

Instrumental Gaussian σ in km/s.

jwspecfit.resolution.R_from_pixels(lam_um)[source]

Estimate resolving power from the pixel spacing.

Assumes the spectrum is Nyquist-sampled, so that the FWHM of the line-spread function spans ~2 pixels: R ≈ λ / (2 Δλ).

Returns a callable R(lam_um) that can be passed directly to resolve_R(), sigma_inst_A(), or fit_lines().

This is a rough estimate and should only be used as a fallback when neither a grating name nor an explicit R is available.

Parameters:

lam_um (array_like) – Wavelength in microns (must be sorted).

Returns:

Function R(lam_um) -> np.ndarray that interpolates the estimated resolving power.

Return type:

callable

jwspecfit.resolution.R_grating(name)[source]

Constant resolving power for a named grating.

Parameters:

name (str) – Grating name, e.g. "G395M", "G140H".

Returns:

Approximate resolving power.

Return type:

float

jwspecfit.resolution.R_prism(lam_um, post_launch=True)[source]

Resolving power R(λ) for NIRSpec PRISM/CLEAR (Jakobsen+22 Fig. 6).

Tabulated values from Jakobsen et al. 2022 (A&A 661, A80, Fig. 6 — pre-launch instrument-model curve), interpolated linearly in λ. When post_launch=True (default), the curve is multiplied by 1.3, the correction factor adopted by Pollock+26 / de Graaff+25 to reflect the post-launch on-orbit performance.

Parameters:
  • lam_um (array_like) – Wavelength in microns.

  • post_launch (bool) – If True (default), apply the 1.3× post-launch correction.

Returns:

Resolving power R at each wavelength.

Return type:

np.ndarray

jwspecfit.resolution.resolve_R(lam_um, grating=None, R=None)[source]

Return R(λ) array from either a grating name or user-supplied R.

Parameters:
  • lam_um (array_like) – Wavelength in microns.

  • grating (str, optional) – Grating name ("PRISM", "G395M", etc.).

  • R (float or callable, optional) – Numeric resolving power (constant) or callable R(lam_um). Takes precedence over grating.

Returns:

Resolving power at each wavelength.

Return type:

np.ndarray

Raises:

ValueError – If neither grating nor R is specified.

jwspecfit.resolution.sigma_inst_A(lam_um, grating=None, R=None)[source]

Instrumental Gaussian σ in Angstroms.

σ_inst = λ / (R × 2.3548)

Parameters:
  • lam_um (array_like) – Wavelength in microns.

  • grating (str, optional) – Grating name.

  • R (float or callable, optional) – Resolving power (overrides grating).

Returns:

Instrumental σ in Angstroms at each wavelength.

Return type:

np.ndarray

jwspecfit.resolution.sigma_inst_kms(lam_um, grating=None, R=None)[source]

Instrumental Gaussian σ in km/s.

σ_v = c / (R × 2.3548)

Parameters:
  • lam_um (array_like) – Wavelength in microns.

  • grating (str, optional) – Grating name.

  • R (float or callable, optional) – Resolving power (overrides grating).

Returns:

Instrumental σ in km/s at each wavelength.

Return type:

np.ndarray