megaradrp.processing
— Processing functions¶
megaradrp.processing.wavecalibration
—¶
Corrector for wavelength calibration
- class megaradrp.processing.wavecalibration.SimpleWcs1D(crval=0, crpix=0, cdelt=1, ctype='', cunit='', **kwargs)¶
Store parameters of a simple 1D WCS
- class megaradrp.processing.wavecalibration.WavelengthCalibrator(solutionwl, datamodel=None, dtype='float32')¶
A Node that applies wavelength calibration.
- megaradrp.processing.wavecalibration.calibrate_wl_rss(rss, solutionwl, npix, targetwcs, dtype='float32', span=0, inplace=False)¶
Apply wavelength calibration to a RSS
- Parameters:
- rss: astropy.io.fits.HDUList
A Row stacked Spectra MEGARA image, not WL calibrated
- solutionwl: megaradrp.products.wavecalibration.WavelengthCalibration
A wavelength calibration solution
- npix: int
Number of channels of the calibrated RSS
- targetwcs: SimpleWcs1D
Common WCS solution
- dtype: str
Convertible to numpy.dtype
- span: int
Remove span pixels at both sides of the resampled image
- inplace: bool
The input RSS is modified inplace, if False, a copy is made
- Returns:
- rss: astropy.io.fits.HDUList
A Row stacked Spectra MEGARA image, WL calibrated
- megaradrp.processing.wavecalibration.calibrate_wl_rss_megara(rss, solutionwl, dtype='float32', span=0, inplace=False)¶
Apply wavelength calibration to a RSS
- Parameters:
- rss: astropy.io.fits.HDUList
A Row stacked Spectra MEGARA image, not WL calibrated
- solutionwl: megaradrp.products.wavecalibration.WavelengthCalibration
A wavelength calibration solution
- dtype: str
Convertible to numpy.dtype
- span: int
Remove span pixels at both sides of the resampled image
- inplace: bool
The input RSS is modified inplace, if False, a copy is made
- Returns:
- rss: astropy.io.fits.HDUList
A Row stacked Spectra MEGARA image, WL calibrated
- megaradrp.processing.wavecalibration.header_add_barycentric_correction(hdr, key='B', out=None)¶
Add WCS keywords with barycentric correction
- Raises:
- KeyError
If a required keyword is missing
- TypeError
If the header does not contain a spectral axis
- megaradrp.processing.wavecalibration.resample_rss_flux(arr, solutionwl, npix, finalwcs, span=0, fill=0)¶
Resample array according to a wavelength calibration solution
- Parameters:
- arr: numpy.ndarray
A Row stacked Spectra MEGARA image, not WL calibrated
- solutionwl: megaradrp.products.wavecalibration.WavelengthCalibration
A wavelength calibration solution
- npix: int
Number of channels of the calibrated RSS
- finalwcs: astropy.wcs.WCS
WCS solution of the final array
- span: int
Remove span pixels at both sides of the resampled image
- fill: int
Value used to fill the values removed by span
- Returns:
- rss_resampled: numpy.ndarray
A resample array
- limits: a list of tuples
Contains the fiberid and a pair with the first and last valid pixel (0-based)
- megaradrp.processing.wavecalibration.rss_add_wcs(hdr, crval, cdelt, crpix)¶
Add MEGARA 2D wavelength calibration headers