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
([pixel, unit, medium])Return the coordinate corresponding to pixel.
copy
()Copie WaveCoord object in a new one and returns it.
CRPIX getter (reference pixel on the wavelength axis).
get_crval
([unit])CRVAL getter (value of the reference pixel on the wavelength axis).
Return the type of wavelength coordinates.
get_end
([unit])Return the value of the last pixel.
get_range
([unit])Return the wavelength range [Lambda_min,Lambda_max].
get_start
([unit])Return the value of the first pixel.
get_step
([unit])Return the step in wavelength.
info
([unit])Print information.
isEqual
(other)Return True if other and self have the same attributes.
pixel
(lbda[, nearest, unit])Return the decimal pixel corresponding to the wavelength lbda.
rebin
(factor)Rebin to a new coordinate system (in place).
resample
(step, start[, unit])Resample to a new coordinate system.
set_crpix
(x)CRPIX setter (reference pixel on the wavelength axis).
set_crval
(x[, unit])CRVAL getter (value of the reference pixel on the wavelength axis).
set_step
(x[, unit])Return the step in wavelength.
to_header
([naxis, use_cd])Generate a astropy.fits header object with the WCS information.
Methods Documentation
- coord(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(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(unit=None)[source]¶
Return the value of the last pixel.
- Parameters:
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
- get_range(unit=None)[source]¶
Return the wavelength range [Lambda_min,Lambda_max].
- Parameters:
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
- get_start(unit=None)[source]¶
Return the value of the first pixel.
- Parameters:
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
- get_step(unit=None)[source]¶
Return the step in wavelength.
- Parameters:
- unit
astropy.units.Unit
type of the wavelength coordinates
- unit
- pixel(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(factor)[source]¶
Rebin to a new coordinate system (in place).
- Parameters:
- factor
integer
Factor.
- factor
- Returns:
- out
WaveCoord
- out
- resample(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(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(x, unit=None)[source]¶
Return the step in wavelength.
- Parameters:
- x
float
Step value
- unit
astropy.units.Unit
type of the wavelength coordinates
- x