WaveCoord¶
-
class
mpdaf.obj.
WaveCoord
(hdr=None, crpix=1.0, cdelt=1.0, crval=1.0, cunit=Unit("Angstrom"), ctype='LINEAR', shape=None)[source]¶ Bases:
object
WaveCoord class manages world coordinates in spectral direction.
- Parameters
- hdr
astropy.fits.CardList
A FITS header. If hdr is not None, WaveCoord object is created from this header and other parameters are not used.
- crpix
float
Reference pixel coordinates. 1.0 by default. Note that for crpix definition, the first pixel in the spectrum has pixel coordinates.
- cdelt
float
Step in wavelength (1.0 by default).
- crval
float
Coordinates of the reference pixel (0.0 by default).
- cunit
u.unit
Wavelength unit (Angstrom by default).
- ctype
string
Type of the coordinates.
- shape
integer
orNone
Size of spectrum (no mandatory).
- hdr
- Attributes
- shape
integer
Size of spectrum.
- wcs
astropy.wcs.WCS
Wavelength coordinates.
- shape
Methods Summary
coord
(self[, pixel, unit, medium])Return the coordinate corresponding to pixel.
copy
(self)Copie WaveCoord object in a new one and returns it.
get_crpix
(self)CRPIX getter (reference pixel on the wavelength axis).
get_crval
(self[, unit])CRVAL getter (value of the reference pixel on the wavelength axis).
get_ctype
(self)Return the type of wavelength coordinates.
get_end
(self[, unit])Return the value of the last pixel.
get_range
(self[, unit])Return the wavelength range [Lambda_min,Lambda_max].
get_start
(self[, unit])Return the value of the first pixel.
get_step
(self[, unit])Return the step in wavelength.
info
(self[, unit])Print information.
isEqual
(self, other)Return True if other and self have the same attributes.
pixel
(self, lbda[, nearest, unit])Return the decimal pixel corresponding to the wavelength lbda.
rebin
(self, factor)Rebin to a new coordinate system (in place).
resample
(self, step, start[, unit])Resample to a new coordinate system.
set_crpix
(self, x)CRPIX setter (reference pixel on the wavelength axis).
set_crval
(self, x[, unit])CRVAL getter (value of the reference pixel on the wavelength axis).
set_step
(self, x[, unit])Return the step in wavelength.
to_header
(self[, naxis, use_cd])Generate a astropy.fits header object with the WCS information.
Methods Documentation
-
coord
(self, pixel=None, unit=None, medium=None)[source]¶ Return the coordinate corresponding to pixel.
If pixel is None (default value), the full coordinate array is returned.
- Parameters
- pixel
int
,array
or None. Pixel value.
- unit
astropy.units.Unit
Unit of the wavelength coordinates
- medium
str
orNone
Medium in which the wavelengths are returned: ‘air’ or ‘vacuum’. If None (default), the wavelength corresponding to the spectrum CTYPE are returned.
- pixel
- Returns
-
get_crval
(self, unit=None)[source]¶ CRVAL getter (value of the reference pixel on the wavelength axis).
- Parameters
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
-
get_end
(self, unit=None)[source]¶ Return the value of the last pixel.
- Parameters
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
-
get_range
(self, unit=None)[source]¶ Return the wavelength range [Lambda_min,Lambda_max].
- Parameters
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
-
get_start
(self, unit=None)[source]¶ Return the value of the first pixel.
- Parameters
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
-
get_step
(self, unit=None)[source]¶ Return the step in wavelength.
- Parameters
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
-
pixel
(self, lbda, nearest=False, unit=None)[source]¶ Return the decimal pixel corresponding to the wavelength lbda.
If nearest=True; returns the nearest integer pixel.
- Parameters
- lbda
float
orarray
wavelength value.
- nearestbool
If nearest is True returns the nearest integer pixel in place of the decimal pixel.
- unit
astropy.units.Unit
type of the wavelength coordinates
- lbda
- Returns
- out
float
orinteger
- out
-
rebin
(self, factor)[source]¶ Rebin to a new coordinate system (in place).
- Parameters
- factor
integer
Factor.
- factor
- Returns
- out
WaveCoord
- out
-
resample
(self, step, start, unit=None)[source]¶ Resample to a new coordinate system.
- Parameters
- start
float
New wavelength for the pixel 0.
- step
float
New step.
- unit
astropy.units.Unit
type of the wavelength coordinates
- start
- Returns
- out
WaveCoord
- out
-
set_crval
(self, x, unit=None)[source]¶ CRVAL getter (value of the reference pixel on the wavelength axis).
- Parameters
- x
float
value of the reference pixel on the wavelength axis
- unit
astropy.units.Unit
type of the wavelength coordinates
- x
-
set_step
(self, x, unit=None)[source]¶ Return the step in wavelength.
- Parameters
- x
float
Step value
- unit
astropy.units.Unit
type of the wavelength coordinates
- x