Spec Object DocString¶
The Spec object stores information about spectra that can be extracted from JWST data cubes. The spectrum is in the form of two 1D lists containing wavelength values in µm and surface brightness (flux per unit ‘angular area’) or flux values. By default, JWST data are given in MJy/sr, i.e. surface brightness. However, other units can be specified for the y-axis of the spectrum.
The three preceding elements: wavelength axis, value axis and units are attributes of the Spec object. The increment value on the wavelength axis is the object’s fourth argument.
- param wvs:
The x-axis of the spectrum. The axis corresponds to wavelengths in µm. This is the default unit for JWST data.
- type wvs:
array_like
- param values:
The y axis of the spectrum. By default in JWST data, the values in each spaxel are surface brightness, given in MJy/sr. It is possible to give other units, in flux or surface brightness. The number of points on the y axis must be identical to the number of points on the wavelength axis.
- type values:
array_like
- param units:
Unit of the y axis of the spectrum. Default values in JWST data are surface brightness in MJy/sr.
- type units:
str, optional
- JWSToolKit.Spec.wvs¶
The wavelength values of the spectrum.
- Type:
array_like
- JWSToolKit.Spec.values¶
The brightness surface or flux values of the spectrum. The unit must match that of the ‘units’ argument.
- Type:
array_like
- JWSToolKit.Spec.units¶
The unit of the y axis values of the spectrum. Possible units are: ‘MJy/sr’, ‘Jy’, ‘erg s-1 cm-2 Hz-1’, ‘erg s-1 cm-2 um-1’, ‘erg s-1 cm-2 um-1 sr-1’.
- Type:
str
- JWSToolKit.Spec.dwvs¶
Interval between two points on the wavelength axis, in µm.
- Type:
float
- class JWSToolKit.Spec.Spec(wvs: list[float], values: list[float], units: str = 'MJy/sr')[source]¶
Bases:
object- convert(units: str, px_area: float = 1)[source]¶
Convert spectrum values into another unit.
- Parameters:
units (str) – The unit of the spectrum after conversion. Possible units are : MJy/sr, Jy, erg s-1 cm-2 Hz-1, erg s-1 cm-2 um-1, erg s-1 cm-2 um-1 sr-1.
px_area (float, optional) – Spatial area over which the spectrum was extracted. Used to convert surface brightness to flux density. The value must be given in steradian.
- Returns:
The initial spectrum with the y-axis converted to the chosen unit.
- Return type:
- cut(min: float, max: float, units: str = 'wav', wv_ref=None)[source]¶
Extract a part of the spectrum using limits of the requiered interval.
- Parameters:
min (float) – Value of the lower limit of the cut spectrum interval. If no unit is specified or the specified unit is ‘wav’, then the value is a wavelength in µm.
max (float) – Value of the upper limit of the cut spectrum interval. If no unit is specified or the specified unit is ‘wav’, then the value is a wavelength in µm.
units (str, optional) – Unit of the x-axis of the spectrum. If the unit is ‘wav’, then the x-axis values are wavelengths, and the interval limits must be given in wavelengths. If the unit is ‘vel’, then the values of the x-axis are radial velocities, and the limits of the interval must be given in km/s. The reference wavelength must then be specified to convert wavelengths into radial velocities (via the Doppler shift relation).
wv_ref (Optional) – In the case of the ‘vel’ unit, a wavelength reference value must be given for conversion to radial velocity (via the Doppler shift relation), in µm.
- Returns:
A Spec object cut by considering the limits of the interval given as input parameters.
- Return type:
- line_integ(wv_line: float, profile=None, line_width: float = 400.0, control_plot: bool = False)[source]¶
Computes the integrated flux or surface brightness of a line.
- Parameters:
wv_line (float) – Wavelength in vacuum and at rest of the emission line, in µm.
profile (str, optional) – Type of line profile. If no profile is specified, integration is performed using a simpson method. If a profile is specified, it must be one of the following: ‘gaus’, ‘voigt’, ‘lorentz’ and ‘moffat’.
line_width (float, optional) – Full-width of the line. The value should be given in km/s.
control_plot (bool, optional) – If True, show the different steps of the line integration.
- Returns:
The first value corresponds to the flux or integrated surface brightness of the line, the second to the error on the first value.
- Return type:
float, float
- line_velocity(wv_line: float, line_width: float = 400.0, control_plot: bool = False)[source]¶
Calculates the Doppler shift of an emission line using Gaussian profile fitting.
- Parameters:
wv_line (float) – Wavelength in vacuum and at rest of the emission line, in µm.
line_width (float, optional) – Full-width of the line. The value should be given in km/s.
control_plot (bool, optional) – If True, show the line fitting.
- Returns:
The first value corresponds to the Doppler shift of the line, in terms of radial velocity given in km/s, the second the error associated with the first value.
- Return type:
float, float
- sub_baseline(wv_line: float, mask_rv: float = 200.0, deg: int = 1, control_plot: bool = False)[source]¶
Subtracts a baseline by fitting a polynomial around an emission line.
- Parameters:
wv_line (float) – Wavelength in vacuum and at rest of the emission line, in µm.
mask_rv (float, optional) – Half-width of the interval used to exclude spectral pixels in baseline fitting. Can be interpreted as line half-width. The value should be given in km/s.
deg (int, optional) – Degree of the polynomial used to adjust the baseline around the line.
control_plot (bool, optional) – If True, show the different stages of the baseline subtraction.
- Returns:
The initial spectrum, subtracted from its baseline.
- Return type: