EchelleSpectrum#
- class aesop.EchelleSpectrum(spectrum_list, header=None, name=None, fits_path=None, time=None)[source]#
Bases:
objectEchelle spectrum of one or more spectral orders.
The spectral orders will be indexed in order of increasing wavelength.
- Parameters:
- spectrum_listlist of
Spectrum1Dobjects List of
Spectrum1Dobjects for the spectra in each echelle order.- header
astropy.io.fits.header.Header(optional) FITS header object associated with the echelle spectrum.
- namestr (optional)
Name of the target or a name for the spectrum
- fits_pathstr (optional)
Path where FITS file was opened from.
- time
Time(optional) Time at which the spectrum was taken
- spectrum_listlist of
Methods Summary
barycentric_correction([time, skycoord, ...])Barycentric velocity correction, code from StuartLittlefair (https://gist.github.com/StuartLittlefair/5aaf476c5d7b52d20aa9544cfaa936a1)
continuum_normalize_from_standard(...[, ...])Normalize the spectrum by a polynomial fit to the standard's spectrum.
continuum_normalize_lstsq(polynomial_order)Normalize the spectrum with a robust least-squares polynomial fit to the spectrum of each order.
fit_order(spectral_order, polynomial_order)Fit a spectral order with a polynomial.
from_fits(path[, format])Load an echelle spectrum from a FITS file.
get_order(order)Get the spectrum from a specific spectral order
offset_wavelength_solution(wavelength_offset)Offset the wavelengths by a constant amount in each order.
predict_continuum(spectral_order, fit_params)Predict continuum spectrum given results from a polynomial fit from
EchelleSpectrum.fit_order.rv_wavelength_shift(spectral_order[, T_eff, ...])Solve for the radial velocity wavelength shift.
rv_wavelength_shift_ransac([min_order, ...])Solve for the radial velocity wavelength shift of every order in the echelle spectrum, then do a RANSAC (outlier rejecting) linear fit to the wavelength correction between orders
min_orderandmax_order.Convert this echelle spectrum into a simple 1D spectrum.
Methods Documentation
- barycentric_correction(time=None, skycoord=None, location=None)[source]#
Barycentric velocity correction, code from StuartLittlefair (https://gist.github.com/StuartLittlefair/5aaf476c5d7b52d20aa9544cfaa936a1)
Uses the ephemeris set with
astropy.coordinates.solar_system_ephemeris.setfor corrections.For more information see
solar_system_ephemeris.Will attempt to get the necessary info from the header if possible, otherwise requires time, skycoord, and location parameters to be set.
- Parameters:
- time
Time The time of observation, optional
- skycoord: `~astropy.coordinates.SkyCoord`
The sky location to calculate the correction for, optional.
- location: `~astropy.coordinates.EarthLocation`, optional
The location of the observatory to calculate the correction for.
- time
- Returns:
- barycentric_velocity
Quantity The velocity correction that was added to the wavelength arrays of each order.
- barycentric_velocity
- continuum_normalize_from_standard(standard_spectrum, polynomial_order, only_orders=None, plot_masking=False, plot_fit=False)[source]#
Normalize the spectrum by a polynomial fit to the standard’s spectrum.
- Parameters:
- standard_spectrum
EchelleSpectrum Spectrum of the standard object
- polynomial_orderint
Fit the standard’s spectrum with a polynomial of this order
- only_orders
ndarray Only do the continuum normalization for these echelle orders.
- plot_maskingbool
Plot the masked-out low S/N regions
- plot_fitbool
Plot the polynomial fit to the standard star spectrum
- standard_spectrum
- continuum_normalize_lstsq(polynomial_order, only_orders=None, plot=False, fscale_mad_factor=0.2)[source]#
Normalize the spectrum with a robust least-squares polynomial fit to the spectrum of each order.
- Parameters:
- polynomial_orderint
Fit the standard’s spectrum with a polynomial of this order
- only_orders
ndarray(optional) Only do the continuum normalization for these echelle orders.
- plot_maskingbool (optional)
Plot the masked-out low S/N regions
- plot_fitbool (optional)
Plot the polynomial fit to the standard star spectrum
- fscale_mad_factorfloat (optional)
The robust least-squares fitter will reject outliers by keeping the standard deviation of inliers close to
fscale_mad_factortimes the median absolute deviation (MAD) of the fluxes.
- fit_order(spectral_order, polynomial_order, plots=False)[source]#
Fit a spectral order with a polynomial.
Ignore fluxes near the CaII H & K wavelengths.
- Parameters:
- spectral_orderint
Spectral order index
- polynomial_orderint
Polynomial order
- Returns:
- fit_params
ndarray Best-fit polynomial coefficients
- fit_params
- classmethod from_fits(path, format=None)[source]#
Load an echelle spectrum from a FITS file.
- Parameters:
- pathstr
Path to the FITS file
- get_order(order)[source]#
Get the spectrum from a specific spectral order
- Parameters:
- orderint
Echelle order to return
- Returns:
- spectrum
Spectrum1D One order from the echelle spectrum
- spectrum
- offset_wavelength_solution(wavelength_offset)[source]#
Offset the wavelengths by a constant amount in each order.
- Parameters:
- wavelength_offset
Quantityor list Offset the wavelengths by this amount. If
wavelength_offsetis a list, each value will be treated as an offset for on echelle order, otherwise a singlewavelength_offsetwill be applied to every order.
- wavelength_offset
- predict_continuum(spectral_order, fit_params)[source]#
Predict continuum spectrum given results from a polynomial fit from
EchelleSpectrum.fit_order.
- rv_wavelength_shift(spectral_order, T_eff=None, plot=False)[source]#
Solve for the radial velocity wavelength shift.
- Parameters:
- spectral_orderint
Echelle spectrum order to shift
- rv_wavelength_shift_ransac(min_order=10, max_order=45, T_eff=4700)[source]#
Solve for the radial velocity wavelength shift of every order in the echelle spectrum, then do a RANSAC (outlier rejecting) linear fit to the wavelength correction between orders
min_orderandmax_order.- Parameters:
- min_orderint
Index of the bluest order to fit in the wavelength correction
- max_orderint
Index of the reddest order to fit in the wavelength correction
- T_effint
Effective temperature of the PHOENIX model atmosphere to use in the cross-correlation.
- Returns:
- wl
Quantity Wavelength corrections for each order.
- wl
- to_Spectrum1D()[source]#
Convert this echelle spectrum into a simple 1D spectrum.
In wavelength regions where two spectral orders overlap, take the mean of the overlapping region.
- Parameters:
- mad_outlier_factorfloat
Mask positive outliers
max_outlier_factortimes the median absolute deviation plus the median of the fluxes.
- Returns:
- spectrum
Spectrum1D Simple 1D spectrum.
- spectrum