Spectrum1D API¶
- class aspired.spectral_reduction.SpectrumOneD(spec_id: numpy.ndarray | list | int = None, verbose: bool = True, logger_name: str = 'SpectrumOneD', log_level: str = 'INFO', log_file_folder: str = 'default', log_file_name: str = None)[source]¶
Base class of a 1D spectral object to hold the information of each extracted spectrum and the raw headers if was provided during the data reduction. The FITS or CSV file output are all done here.
Initialise the object with a logger.
- Parameters:
spec_id (int (Default: None)) – The ID corresponding to the spectrum_oned object. Note that this ID is unique in each reduction only.
verbose (boolean (Default: True)) – Set to False to suppress all verbose warnings, except for critical failure.
logger_name (str (Default: SpectrumOneD)) – This will set the name of the logger, if the name is used already, it will reference to the existing logger. This will be the first part of the default log file name unless log_file_name is provided.
log_level (str (Default: 'INFO')) – Four levels of logging are available, in decreasing order of information and increasing order of severity: (1) DEBUG, (2) INFO, (3) WARNING, (4) ERROR and (5) CRITICAL. WARNING means that there is suboptimal operations in some parts of that step. ERROR means that the requested operation cannot be performed, but the software can handle it by either using the default setting or skipping the operation. CRITICAL means that the requested operation cannot be resolved without human interaction, this is most usually coming from missing data.
log_file_folder (None or str (Default: "default")) – Folder in which the file is save, set to default to save to the current path.
log_file_name (None or str (Default: None)) – File name of the log, set to None to self.logger.warning to screen only.
- add_airmass(airmass: float)[source]¶
Add the airmass when the observation was carried out. This value can be different from the one in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
airmass (float) – The effective airmass during the exposure.
- add_aperture(widthdn: int, widthup: int, sepdn: int, sepup: int, skywidthdn: int, skywidthup: int)[source]¶
The size of the aperture in which the spectrum is extracted. This is merely the limit where extraction is performed, it does not hold the information of the weighting:
................................. ^ Sky ................................. | skywidthup ................................. v ................................. ^ ................................. | sepup ................................. v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ --------------------------------- | widthup Spectrum ================================= v ^ --------------------------------- | widthdn ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ v ................................. ^ ................................. | sepdn ................................. v ................................. ^ Sky ................................. | skywidthdn ................................. v
- Parameters:
widthdn (real positive number) – The aperture size on the bottom side of the spectrum.
widthup (real positive number) – The aperture size on the top side of the spectrum.
sepdn (real positive number) – The gap between the spectrum and the sky region on the bottom side of the spectrum.
sepup (real positive number) – The gap between the spectrum and the sky region on the top side of the spectrum.
skywidthdn (real positive number) – The sky region on the bottom side of the spectrum.
skywidthup (real positive number) – The sky region on the top side of the spectrum.
- add_arc_header(header: astropy.io.fits.Header | list | numpy.ndarray)[source]¶
Add a header for the arc that it is wavelength calibrated against. Typically put the header of the raw 2D spectral image of the arc here. Some automated operations rely on reading from the header.
- Parameters:
header (astropy.io.fits.Header object) –
- add_arc_spec(arc_spec: list | numpy.ndarray)[source]¶
Add the extracted 1D spectrum of the arc.
- Parameters:
arc_spec (1-d array) – The photoelectron count of the spectrum of the arc lamp.
- add_atlas_wavelength_range(min_atlas_wavelength: float, max_atlas_wavelength: float)[source]¶
Add the allowed range of wavelength calibration.
- Parameters:
min_atlas_wavelength (float) – The minimum wavelength of the atlas.
max_atlas_wavelength (float) – The maximum wavelength of the atlas.
- add_atm_ext(atm_ext: list | numpy.ndarray)[source]¶
Add the atmospheric extinction correction factor in the native wavelengths.
- Parameters:
atm_ext (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
- add_atm_ext_resampled(atm_ext_resampled: list | numpy.ndarray)[source]¶
Add the atmospheric extinction correction factor in the resampled wavelengths.
- Parameters:
atm_ext_resampled (list or numpy.ndarray) – The atmospheric absorption corrected flux at the resampled wavelengths.
- add_calibrator(calibrator: rascal.calibrator.Calibrator)[source]¶
Add a RASCAL Calibrator object.
- Parameters:
calibrator (rascal.Calibrator()) – A RASCAL Calibrator object.
- add_calibrator_properties(num_pix: int, effective_pixel: list | numpy.ndarray, plotting_library: str)[source]¶
Add the properties of the RASCAL Calibrator.
- Parameters:
num_pix (int) – The number of pixels in the dispersion direction
effective_pixel (list or numpy array) – The pixel position of the trace in the dispersion direction. This should be provided if you wish to override the default range(num_pix), for example, in the case of accounting for chip gaps (10 pixels) in a 3-CCD setting, you should provide [0,1,2,…90, 100,101,…190, 200,201,…290]
plotting_library (string) – Choose between matplotlib and plotly.
- add_count(count: list | numpy.ndarray, count_err: list | numpy.ndarray = None, count_sky: list | numpy.ndarray = None)[source]¶
Add the photoelectron counts and the associated optional uncertainty and sky counts.
- Parameters:
count (1-d array) – The summed count at each column along the trace.
count_err (1-d array) – the uncertainties of the count values
count_sky (1-d array) – The integrated sky values along each column, suitable for subtracting from the output of ap_extract
- add_count_continuum(count_continuum: list | numpy.ndarray)[source]¶
Add the continuum count value (should be the same size as count).
- Parameters:
count_continuum (list or 1-d array) – The photoelectron count of the continuum.
- add_count_resampled(count_resampled: list | numpy.ndarray, count_err_resampled: list | numpy.ndarray, count_sky_resampled: list | numpy.ndarray)[source]¶
Add the photoelectron counts of the resampled spectrum which has an evenly distributed wavelength spacing.
- Parameters:
count_resampled (list or 1d-array) – The resampled photoelectron count.
count_err_resampled (list or 1d-array) – The uncertainty of the resampled photoelectron count.
count_sky_resampled (list or 1d-array) – The background sky level of the resampled photoelectron count.
- add_count_resampled_continuum(count_resampled_continuum: list | numpy.ndarray)[source]¶
Add the continuum count_resampled value (should be the same size as count_resampled).
- Parameters:
count_resampled_continuum (list or 1-d array) – The photoelectron count of the continuum at the resampled wavelength.
- add_effective_pixel(effective_pixel: list | numpy.ndarray)[source]¶
Add the pixel list, which contain the effective pixel values that has accounted for chip gaps and non-integer pixel value.
- Parameters:
effective_pixel (1-d array) – The effective position of the pixel.
- add_exptime(exptime: float)[source]¶
Add the exposure time of the spectral image. This value can be different from the one in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
exptime (float) – The exposure time of the input image.
- add_fit_coeff(fit_coeff: list | numpy.ndarray)[source]¶
Add the polynomial co-efficients of the pixel-to-wavelength function. Note that this overwrites the wavelength calibrated fit coefficients.
- Parameters:
fit_coeff (list or 1-d array) – The set of coefficients of the pixel-wavelength function.
- add_fit_output_final(fit_coeff: list | numpy.ndarray, matched_peaks: list | numpy.ndarray, matched_atlas: list | numpy.ndarray, rms: float, residual: list | numpy.ndarray, peak_utilisation: float, atlas_utilisation: float)[source]¶
Add the final accepted polynomial solution.
- Parameters:
fit_coeff (list) – Set the baseline of the least square fit. If no fits outform this set of polynomial coefficients, this will be used as the best fit.
matched_peaks (list) – List of matched peaks
matched_atlas (list) – List of matched atlas lines
rms (float) – The root-mean-squared of the fit
residual (list) – The residual of each fitted peak
peak_utilisation (float) – The fraction of the input peaks used in the fit
atlas_utilisation (float) – The fraction of the input atlas used in the fit
- add_fit_output_rascal(fit_coeff: list | numpy.ndarray, matched_peaks: list | numpy.ndarray, matched_atlas: list | numpy.ndarray, rms: float, residual: list | numpy.ndarray, peak_utilisation: float, atlas_utilisation: float)[source]¶
Add the RASCAL polynomial solution.
- Parameters:
fit_coeff (list) – Set the baseline of the least square fit. If no fits outform this set of polynomial coefficients, this will be used as the best fit.
matched_peaks (list) – List of matched peaks
matched_atlas (list) – List of matched atlas lines
rms (float) – The root-mean-squared of the fit
residual (list) – The residual of each fitted peak
peak_utilisation (float) – The fraction of the input peaks used in the fit
atlas_utilisation (float) – The fraction of the input atlas used in the fit
- add_fit_output_refine(fit_coeff: list | numpy.ndarray, matched_peaks: list | numpy.ndarray, matched_atlas: list | numpy.ndarray, rms: float, residual: list | numpy.ndarray, peak_utilisation: float, atlas_utilisation: float)[source]¶
Add the refined RASCAL polynomial solution.
- Parameters:
fit_coeff (list) – Set the baseline of the least square fit. If no fits outform this set of polynomial coefficients, this will be used as the best fit.
matched_peaks (list) – List of matched peaks
matched_atlas (list) – List of matched atlas lines
rms (float) – The root-mean-squared of the fit
residual (list) – The residual of each fitted peak
peak_utilisation (float) – The fraction of the input peaks used in the fit
atlas_utilisation (float) – The fraction of the input atlas used in the fit
- add_fit_type(fit_type: str)[source]¶
Add the kind of polynomial used for fitting the pixel-to-wavelength function.
- Parameters:
fit_type (str) – The type of polynomial for fitting the pixel-wavelength function.
- add_flux(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the flux and the associated uncertainty and sky background in the raw pixel sampling.
- Parameters:
flux (list or numpy.ndarray) – The flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The flux of the background sky at each extracted column of pixels.
- add_flux_atm_ext_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the atmospheric extinction corrected flux and the associated uncertainty and sky background in the raw pixel sampling.
- Parameters:
flux (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The atmospheric absorption corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The atmospheric absorption corrected flux of the background sky at each extracted column of pixels.
- add_flux_atm_ext_telluric_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the atmospheric extinction and telluric corrected flux and the associated uncertainty and sky background in the raw pixel sampling.
- Parameters:
flux (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The atmospheric absorption corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The atmospheric absorption corrected flux of the background sky at each extracted column of pixels.
- add_flux_continuum(flux_continuum: list | numpy.ndarray)[source]¶
Add the continuum flux value (should be the same size as flux).
- Parameters:
flux_continuum (list or 1-d array) – The flux of the continuum.
- add_flux_resampled(flux_resampled: list | numpy.ndarray, flux_err_resampled: list | numpy.ndarray, flux_sky_resampled: list | numpy.ndarray)[source]¶
Add the flux and the associated uncertainty and sky background of the resampled spectrum.
- Parameters:
flux (list or numpy.ndarray) – The flux at the resampled wavelenth.
flux_err (list or numpy.ndarray) – The uncertainty in flux at the resampled wavelenth.
flux_sky (list or numpy.ndarray) – The flux of the background sky at the resampled wavelenth.
- add_flux_resampled_atm_ext_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the flux and the associated uncertainty and sky background of the resampled spectrumg.
- Parameters:
flux (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The atmospheric absorption corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The atmospheric absorption corrected flux of the background sky at each extracted column of pixels.
- add_flux_resampled_atm_ext_telluric_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the flux and the associated uncertainty and sky background of the resampled spectrum.
- Parameters:
flux (list or numpy.ndarray) – The atmospheric absorption and telluric corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The atmospheric absorption and telluric corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The atmospheric absorption and telluric corrected flux of the background sky at each extracted column of pixels.
- add_flux_resampled_telluric_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the flux and the associated uncertainty and sky background of the resampled spectrum.
- Parameters:
flux (list or numpy.ndarray) – The telluric corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The telluric corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The telluric corrected flux of the background sky at each extracted column of pixels.
- add_flux_telluric_corrected(flux: list | numpy.ndarray, flux_err: list | numpy.ndarray, flux_sky: list | numpy.ndarray)[source]¶
Add the telluric flux and the associated uncertainty and sky background in the raw pixel sampling.
- Parameters:
flux (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
flux_err (list or numpy.ndarray) – The atmospheric absorption corrected uncertainty in flux at each extracted column of pixels.
flux_sky (list or numpy.ndarray) – The atmospheric absorption corrected flux of the background sky at each extracted column of pixels.
- add_gain(gain: float)[source]¶
Add the gain value of the spectral image. This value can be different from the one in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
gain (float) – The gain value of the detector.
- add_hough_properties(num_slopes: int, xbins: int, ybins: int, min_wavelength: float, max_wavelength: float, range_tolerance: float, linearity_tolerance: float)[source]¶
Add the hough transform configuration of the RASCAL Calibrator.
- Parameters:
num_slopes (int) – Number of slopes to consider during Hough transform
xbins (int) – Number of bins for Hough accumulation
ybins (int) – Number of bins for Hough accumulation
min_wavelength (float) – Minimum wavelength of the spectrum.
max_wavelength (float) – Maximum wavelength of the spectrum.
range_tolerance (float) – Estimation of the error on the provided spectral range e.g. 3000-5000 with tolerance 500 will search for solutions that may satisfy 2500-5500
linearity_tolerance (float) – A toleranceold (Ansgtroms) which defines some padding around the range tolerance to allow for non-linearity. This should be the maximum expected excursion from linearity.
- add_line_spread_profile(line_spread_profile: astropy.modeling.Fittable1DModel)[source]¶
Add the empirical line spread profile as measured.
- Parameters:
profile_func (a fitted astropy.modeling.Fittable1DModel) – The fitted trace profile.
- add_line_spread_profile_upsampled(line_spread_profile_upsampled: astropy.modeling.Fittable1DModel)[source]¶
Add the empirical line spread profile as measured from the upsampled image.
- Parameters:
profile_func (a fitted astropy.modeling.Fittable1DModel) – The fitted trace profile.
- add_literature_standard(wave_literature: list | numpy.ndarray, flux_literature: list | numpy.ndarray)[source]¶
Add the literature wavelength and flux values of the standard star used for calibration.
- Parameters:
wave_literature (list or 1-d array) – The wavelength values of the literature standard used.
flux_literature (list or 1-d array) – The flux values of the literature standard used.
- add_min_atlas_distance(min_atlas_distance: float)[source]¶
Add the minimum allowed line distance (only consider lines that passed the minimum intensity threshold) that were used for wavelength calibration.
- Parameters:
min_atlas_distance (float) – Minimum wavelength separation between neighbouring lines.
- add_min_atlas_intensity(min_atlas_intensity: float)[source]¶
Add the minimum allowed line intensity (theoretical NIST value) that were used for wavelength calibration.
- Parameters:
min_atlas_intensity (float) – The minimum line strength used to get the atlas.
- add_peaks(peaks: list | numpy.ndarray)[source]¶
Add the pixel values (int) where arc lines are located.
- Parameters:
peaks (1-d array) – The pixel value of the identified peaks.
- add_peaks_refined(peaks_refined: list | numpy.ndarray)[source]¶
Add the refined pixel values (float) where arc lines are located.
- Parameters:
peaks (1-d array) – The pixel value of the refined peak positions.
- add_peaks_wave(peaks_wave: list | numpy.ndarray)[source]¶
Add the wavelength (Angstrom) of the arc lines.
- Parameters:
peaks (1-d array) – The wavelength value of the peaks.
- add_pixel_mapping_itp(pixel_mapping_itp: Callable)[source]¶
Add the interpolated callable function that convert raw pixel values into effective pixel values.
- Parameters:
pixel_mapping_itp (callable function) – The mapping function for raw-effective pixel position.
- add_profile(profile: list | numpy.ndarray)[source]¶
Add the extraction profile (generated from the profile_func).
- Parameters:
profile (1-d array) – The weight function of the extraction profile.
- add_profile_func(profile_func: Callable)[source]¶
Add the fitted trace profile.
- Parameters:
profile_func (a fitted astropy.modeling.Fittable1DModel) – The fitted trace profile.
- add_ransac_properties(sample_size: int, top_n_candidate: int, linear: bool, filter_close: bool, ransac_tolerance: float, candidate_weighted: bool, hough_weight: float, minimum_matches: int, minimum_peak_utilisation: float, minimum_fit_error: float)[source]¶
Add the RANSAC properties of the RASCAL Calibrator.
- Parameters:
sample_size (int) – Number of pixel-wavelength hough pairs to be used for each arc line being picked.
top_n_candidate (int) – Top ranked lines to be fitted.
linear (bool) – True to use the hough transformed gradient, otherwise, use the known polynomial.
filter_close (bool) – Remove the pairs that are out of bounds in the hough space.
ransac_tolerance (float) – The distance criteria (Angstroms) to be considered an inlier to a fit. This should be close to the size of the expected residuals on the final fit (e.g. 1A is typical)
candidate_weighted (bool) – Set to True to down-weight pairs that are far from the fit.
hough_weight (float or None) – Set to use the hough space to weigh the fit. The theoretical optimal weighting is unclear. The larger the value, the heavily it relies on the overdensity in the hough space for a good fit.
minimum_matches (int) – Minimum number of matches to accept the solution.
minimum_peak_utilisation (float) – Minimum percentage of peaks used in the solution.
minimum_fit_error (float) – Minimum fitting error. Probably only useful in simulated noiseless case.
- add_readnoise(readnoise: float)[source]¶
Add the readnoise value of the spectral image. This value can be different from the one in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
readnoise (float) – The read noise value of the detector.
- add_seeing(seeing: float)[source]¶
Add the seeing when the observation was carried out. This value can be different from the one in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
seeing (float) – The effective seeing of the observation.
- add_sensitivity(sensitivity: list | numpy.ndarray)[source]¶
Add the sensitivity values for each pixel (the list from dividing the literature standard by the photoelectron count).
- Parameters:
sensitivity (list or 1-d array) – The sensitivity at the effective pixel.
- add_sensitivity_func(sensitivity_func: Callable)[source]¶
Add the callable function of the sensitivity curve.
- Parameters:
sensitivity_func (callable function) – The sensitivity curve as a function of wavelength.
- add_sensitivity_resampled(sensitivity_resampled: list | numpy.ndarray)[source]¶
Add the sensitivity after the spectrum is resampled.
- Parameters:
sensitivity (list or 1-d array) – The sensitivity in the reasmpled space.
- add_smoothing(smooth: bool, **kwargs: dict)[source]¶
Add the SG smoothing parameters for computing the sensitivity curve.
- Parameters:
smooth (bool) – Indicate if smoothing was applied.
kwargs (dict) – Other keyword arguments passed to the lowess smoothing function
- add_spectrum_header(header: astropy.io.fits.Header | list | numpy.ndarray)[source]¶
Add a header for the spectrum. Typically put the header of the raw 2D spectral image of the science target(s) here. Some automated operations rely on reading from the header.
- Parameters:
header (astropy.io.fits.Header object) –
- add_standard_header(header: astropy.io.fits.Header | list | numpy.ndarray)[source]¶
Add a header for the standard star that it is flux calibrated against. The, if opted for, automatic atmospheric extinction correction is applied based on the airmass found in this header. Typically put the header of the raw 2D spectral image of the standard star here. Some automated operations rely on reading from the header.
- Parameters:
header (astropy.io.fits.Header object) –
- add_standard_star(library: str, target: str)[source]¶
Add the name of the standard star and its source.
- Parameters:
library (str) – The name of the colelction of standard stars.
target (str) – The name of the standard star.
- add_telluric_factor(telluric_factor: float)[source]¶
Add the Telluric factor.
- Parameters:
telluric_factor (float) – The multiplier to the telluric profile that minimises the sum of the deviation of corrected spectrum from the continuum spectrum.
- add_telluric_func(telluric_func: Callable)[source]¶
Add the Telluric interpolated function.
- Parameters:
telluric (Callable function) – A callable function to interpolate the telluric features [0, 1]
- add_telluric_nudge_factor(telluric_nudge_factor: float)[source]¶
Add the Telluric nudge factor.
- Parameters:
telluric_nudge_factor (float) – The multiplier to the telluric profile that minimises the sum of the deviation of corrected spectrum from the continuum spectrum.
- add_telluric_profile(telluric_profile: list | numpy.ndarray)[source]¶
Add the Telluric profile - relative intensity at each pixel.
- Parameters:
telluric_profile (list or numpy.ndarray) – The relative intensity of the telluric absorption strength [0, 1]
- add_telluric_profile_resampled(telluric_profile_resampled: list | numpy.ndarray)[source]¶
Add the telluric absorption profile in the resampled wavelengths.
- Parameters:
telluric_profile_resampled (list or numpy.ndarray) – The atmospheric absorption corrected flux at each extracted column of pixels.
- add_trace(trace: list | numpy.ndarray, trace_sigma: list | numpy.ndarray, effective_pixel: list | numpy.ndarray = None)[source]¶
Add the trace of the spectrum.
- Parameters:
trace (list or numpy.ndarray (N)) – The spatial pixel value (can be sub-pixel) of the trace at each spectral position.
trace_sigma (list or numpy.ndarray (N)) – Standard deviation of the Gaussian profile of a trace
effective_pixel (list or numpy array (Default: None)) – The pixel position of the trace in the dispersion direction. This should be provided if you wish to override the default range (num_pix), for example, in the case of accounting for chip gaps (10 pixels) in a 3-CCD setting, you should provide [0,1,2,…90, 100,101,…190, 200,201,…290]
- add_variances(var: list | numpy.ndarray)[source]¶
Add the weight map of the extraction.
- Parameters:
var (2-d array) – The weigh map of the input image for extraction.
- add_wavelength(wave: list | numpy.ndarray)[source]¶
Add the wavelength of each effective pixel.
- Parameters:
wave (list or 1d-array) – The wavelength values at each effective pixel.
- add_wavelength_resampled(wave_resampled: list | numpy.ndarray)[source]¶
Add the wavelength of the resampled spectrum which has an evenly distributed wavelength spacing.
- Parameters:
wave (list or 1d-array) – The resampled wavelength values.
- add_weather_condition(pressure: float, temperature: float, relative_humidity: float)[source]¶
Add the pressure, temperature and relative humidity when the spectral image was taken. These value can be different from the ones in the header as this can be overwritten by an user input, while the header value is raw.
- Parameters:
pressure (float) – The air pressure during the observation (in pascal).
temperature (float) – The temperature during the observation (in Kelvin).
relative_hhumidity (float) – The relative humidity during the observation (between 0 and 1).
- create_atm_ext_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at the resampled wavelength.
- create_atm_ext_resampled_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at the resampled wavelength.
- create_count_resampled_fits()[source]¶
Create an ImageHDU for the extracted spectrum in photoelectron count at the resampled wavelengths.
- create_fits(output: str = '*', recreate: bool = True, empty_primary_hdu: bool = True, return_hdu_list: bool = False)[source]¶
Create a HDU list, with a choice of any combination of the data, see below the ‘output’ parameters for details.
- Parameters:
output (String) –
Type of data to be saved, the order is fixed (in the order of the following description), but the options are flexible. The input strings are delimited by “+”:
- trace: 2 HDUs
Trace, and trace width (pixel)
- count: 3 HDUs
Count, uncertainty, and sky (pixel)
- weight_map: 1 HDU
Weight (pixel)
- arc_spec: 1 HDU
1D arc spectrum
- arc_lines: 2 HDUs
arc line position (pixel), and arc line effective position (pixel)
- wavecal_coefficients: 1 HDU
Polynomial coefficients for wavelength calibration
- wavelength: 1 HDU
Wavelength of each pixel
- wavelength_resampled: 1 HDU
Wavelength of each resampled position
- count_resampled: 3 HDUs
Resampled Count, uncertainty, and sky (wavelength)
- sensitivity: 1 HDU
Sensitivity (pixel)
- flux: 3 HDUs
Flux, uncertainty, and sky (pixel)
- atm_ext: 1 HDU
Atmospheric extinction correction factor
- flux_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (pixel)
- telluric_profile: 1 HDU
Telluric absorption profile
- flux_telluric_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (pixel)
- flux_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (pixel)
- sensitivity_resampled: 1 HDU
Sensitivity (wavelength)
- flux_resampled: 4 HDUs
Flux, uncertainty, and sky (wavelength)
- atm_ext_resampled: 1 HDU
Atmospheric extinction correction factor
- flux_resampled_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (wavelength)
- telluric_profile_resampled: 1 HDU
Telluric absorption profile
- flux_resampled_telluic_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (wavelength)
- flux_resampled_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (wavelength)
recreate (boolean (Default: False)) – Set to True to overwrite the FITS data and header.
empty_primary_hdu (boolean (Default: True)) – Set to True to leave the Primary HDU blank.
return_hdu_list (boolean (Default: False)) – Set to True to return the HDU List.
- create_flux_atm_ext_corrected_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at each native pixel.
- create_flux_atm_ext_telluric_corrected_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at each native pixel.
- create_flux_fits()[source]¶
Create an ImageHDU for the flux calibrated spectrum at each native pixel.
- create_flux_resampled_atm_ext_corrected_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at the resampled wavelength.
- create_flux_resampled_atm_ext_telluric_corrected_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at the resampled wavelength.
- create_flux_resampled_fits()[source]¶
Create an ImageHDU for the flux calibrated spectrum at the resampled wavelength.
- create_flux_resampled_telluric_corrected_fits()[source]¶
Create an ImageHDU for the atmospheric extinction corrected flux calibrated spectrum at the resampled wavelength.
- create_flux_telluric_corrected_fits()[source]¶
Create an ImageHDU for the telluric corrected flux calibrated spectrum at each native pixel.
- create_sensitivity_fits()[source]¶
Create an ImageHDU for the sensitivity at each of the native pixel.
- create_sensitivity_resampled_fits()[source]¶
Create an ImageHDU for the sensitivity at the resampled wavelength.
- create_telluric_profile_fits()[source]¶
Create an ImageHDU for the Telluric absorption profile at resampled wavelength.
- create_telluric_profile_resampled_fits()[source]¶
Create an ImageHDU for the Telluric absorption profile at resampled wavelength.
- create_wavecal_fits()[source]¶
Create an ImageHDU for the polynomial coeffcients of the pixel-wavelength mapping function.
- create_wavelength_fits()[source]¶
Create an ImageHDU for the wavelength at each of the native pixel.
- create_wavelength_resampled_fits()[source]¶
Create an ImageHDU for the wavelength at each resampled position.
- merge(spectrum_oned, overwrite: bool = False)[source]¶
This function copies all the info from the supplied spectrum_oned to this one, including the spec_id.
- Parameters:
spectrum_oned (SpectrumOneD object) – The source SpectrumOneD to be deep copied over.
overwrite (boolean (Default: False)) – Set to True to overwrite all the data in this SpectrumOneD.
- modify_arc_lines_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1
Peaks (pixel) Peaks (sub-pixel)
- modify_arc_spec_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Arc spectrum
- modify_atm_ext_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Atmospheric Extinction
- modify_atm_ext_resampled_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Atmospheric Extinction
- modify_count_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Photoelectron count Photoelectron count uncertainty Photoelectron count (sky)
- modify_count_resampled_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Photoelectron count Photoelectron count uncertainty Photoelectron count (sky)
- modify_flux_atm_ext_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_atm_ext_telluric_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_resampled_atm_ext_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_resampled_atm_ext_telluric_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_resampled_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux Uncertainty Flux Sky
- modify_flux_resampled_telluric_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_flux_telluric_corrected_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1 2
Flux Flux uncertainty Flux (sky)
- modify_sensitivity_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Sensitivity
- modify_sensitivity_resampled_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Sensitivity_resampled
- modify_telluric_profile_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Telluric Absorption Profile
- modify_telluric_profile_resampled_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Telluric Absorption Profile
- modify_trace_header(idx: int, method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0 1
Trace (pixel) Trace width (pixel)
- modify_wavecal_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None wavelength fits only has one ImageHDU so the idx is always 0
HDU
Data
0
Best fit coefficients
- modify_wavelength_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None wavelength fits only has one ImageHDU so the idx is always 0
HDU
Data
0
Wavelength value at each extracted pixel
- modify_wavelength_resampled_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None wavelength fits only has one ImageHDU so the idx is always 0
HDU
Data
0
Wavelength value at each resampled position
- modify_weight_map_header(method: str, *args: str)[source]¶
for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None
HDU
Data
0
Variance
- remove_atm_ext()[source]¶
Remove the atmospheric extinction correction factor in the native wavelengthss.
- remove_atm_ext_resampled()[source]¶
Remove the atmospheric extinction correction factor in the resampled wavelengths.
- remove_calibrator_properties()[source]¶
Remove the properties of the RASCAL Calibrator as recorded in ASPIRED. This does NOT remove the calibrator properites INSIDE the calibrator.
- remove_fit_coeff()[source]¶
Remove the polynomial co-efficients of the pixel-to-wavelength function.
- remove_flux_atm_ext_corrected()[source]¶
Remove the atmospheric absorption corrected flux, uncertainty of flux, and background sky flux in the raw pixel sampling.
- remove_flux_atm_ext_corrected_fits()[source]¶
Remove the flux_resampled_atm_ext_corrected FITS HDUList.
- remove_flux_atm_ext_telluric_corrected()[source]¶
Remove the atmospheric absorption and telluric corrected flux, uncertainty of flux, and background sky flux in the raw pixel sampling.
- remove_flux_atm_ext_telluric_corrected_fits()[source]¶
Remove the flux_resampled_atm_ext_telluric_corrected FITS HDUList.
- remove_flux_resampled()[source]¶
Remove the flux, uncertainty of flux, and background sky flux of the resampled spectrum.
- remove_flux_resampled_atm_ext_corrected()[source]¶
Remove the atmospheric absorption corrected flux, uncertainty of flux, and background sky flux of the resampled spectrum.
- remove_flux_resampled_atm_ext_corrected_fits()[source]¶
Remove the flux_resampled_atm_ext_corrected FITS HDUList.
- remove_flux_resampled_atm_ext_telluric_corrected()[source]¶
Remove the atmospheric absorption and telluric corrected flux, uncertainty of flux, and background sky flux of the resampled spectrum.
- remove_flux_resampled_atm_ext_telluric_corrected_fits()[source]¶
Remove the flux_resampled_atm_ext_telluric_corrected FITS HDUList.
- remove_flux_resampled_telluric_corrected()[source]¶
Remove the atmospheric absorption corrected flux, uncertainty of flux, and background sky flux of the resampled spectrum.
- remove_flux_resampled_telluric_corrected_fits()[source]¶
Remove the flux_resampled_telluric_corrected FITS HDUList.
- remove_flux_telluric_corrected()[source]¶
Remove the telluric corrected flux, uncertainty of flux, and background sky flux in the raw pixel sampling.
- remove_flux_telluric_corrected_fits()[source]¶
Remove the flux_resampled_telluric_corrected FITS HDUList.
- remove_hough_properties()[source]¶
Remove the hough transform configuration of the RASCAL Calibrator. This does NOT remove the hough transform configuration INSIDE the calibrator.
- remove_literature_standard()[source]¶
Remove the literature wavelength and flux values of the standard star used for calibration
- remove_pixel_mapping_itp()[source]¶
Remove the interpolation function that maps the pixel values to the effective pixel value.
- remove_telluric_profile_resampled()[source]¶
Remove the telluric absorption profile in the resampled wavelengthss.
- remove_telluric_profile_resampled_fits()[source]¶
Remove the telluric_profile_resampled FITS HDUList.
- remove_trace()[source]¶
Remove the trace, trace_sigma and len_trace, also remove the effective_pixel and the interpolation function that maps the pixel values to the effective pixel values.
- save_csv(output: str, filename: str, overwrite: bool = False, recreate: bool = True, create_folder: bool = False)[source]¶
Save the reduced data to disk, with a choice of any combination of the 5 sets of data, see below the ‘output’ parameters for details.
- Parameters:
output (String) –
Type of data to be saved, the order is fixed (in the order of the following description), but the options are flexible. The input strings are delimited by “+”,
- trace: 2 HDUs
Trace, and trace width (pixel)
- count: 3 HDUs
Count, uncertainty, and sky (pixel)
- weight_map: 1 HDU
Weight (pixel)
- arc_spec: 1 HDU
1D arc spectrum
- arc_lines: 2 HDUs
Arc line position (pixel), and arc line effective position (pixel)
- wavecal: 1 HDU
Polynomial coefficients for wavelength calibration
- wavelength: 1 HDU
Wavelength of each pixel
- wavelength_resampled: 1 HDU
Wavelength of each resampled position
- count_resampled: 3 HDUs
Resampled Count, uncertainty, and sky (wavelength)
- sensitivity: 1 HDU
Sensitivity (pixel)
- flux: 3 HDUs
Flux, uncertainty, and sky (pixel)
- atm_ext: 1 HDU
Atmospheric extinction correction factor
- flux_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (pixel)
- telluric_profile: 1 HDU
Telluric absorption profile
- flux_telluric_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (pixel)
- flux_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (pixel)
- sensitivity_resampled: 1 HDU
Sensitivity (wavelength)
- flux_resampled: 4 HDUs
Flux, uncertainty, and sky (wavelength)
- atm_ext_resampled: 1 HDU
Atmospheric extinction correction factor
- flux_resampled_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (wavelength)
- telluric_profile_resampled: 1 HDU
Telluric absorption profile
- flux_resampled_telluic_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (wavelength)
- flux_resampled_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (wavelength)
filename (String) – Disk location to be written to. Default is at where the process/subprocess is execuated.
overwrite (boolean) – Default is False.
recreate (boolean (Default: False)) – Set to True to overwrite the FITS data and header.
create_folder (boolean (Default: False)) – Create folder if not exist. Use with caution.
- save_fits(output: str, filename: str, overwrite: bool = False, recreate: bool = True, empty_primary_hdu: bool = True, create_folder: bool = False)[source]¶
Save the reduced data to disk, with a choice of any combination of the data, see below the ‘output’ parameters for details.
- Parameters:
output (String) –
Type of data to be saved, the order is fixed (in the order of the following description), but the options are flexible. The input strings are delimited by “+”,
- trace: 2 HDUs
Trace, and trace width (pixel)
- count: 3 HDUs
Count, uncertainty, and sky (pixel)
- weight_map: 1 HDU
Weight (pixel)
- arc_spec: 1 HDU
1D arc spectrum
- arc_lines: 2 HDUs
Arc line position (pixel), and arc line effective position (pixel)
- wavecal: 1 HDU
Polynomial coefficients for wavelength calibration
- wavelength: 1 HDU
Wavelength of each pixel
- wavelength_resampled: 1 HDU
Wavelength of each resampled position
- count_resampled: 3 HDUs
Resampled Count, uncertainty, and sky (wavelength)
- sensitivity: 1 HDU
Sensitivity (pixel)
- flux: 3 HDUs
Flux, uncertainty, and sky (pixel)
- atm_ext: 1 HDU
Atmospheric extinction correction factor
- flux_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (pixel)
- telluric_profile: 1 HDU
Telluric absorption profile
- flux_telluric_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (pixel)
- flux_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (pixel)
- sensitivity_resampled: 1 HDU
Sensitivity (wavelength)
- flux_resampled: 4 HDUs
Flux, uncertainty, and sky (wavelength)
- atm_ext_resampled: 1 HDU
Atmospheric extinction correction factor
- flux_resampled_atm_ext_corrected: 3 HDUs
Atmospheric extinction corrected flux, uncertainty, and sky (wavelength)
- telluric_profile_resampled: 1 HDU
Telluric absorption profile
- flux_resampled_telluic_corrected: 3 HDUs
Telluric corrected flux, uncertainty, and sky (wavelength)
- flux_resampled_atm_ext_telluric_corrected: 3 HDUs
Atmospheric extinction and telluric corrected flux, uncertainty, and sky (wavelength)
filename (str) – Filename for the output, all of them will share the same name but will have different extension.
overwrite (boolean) – Default is False.
recreate (boolean (Default: False)) – Set to True to overwrite the FITS data and header.
empty_primary_hdu (boolean (Default: True)) – Set to True to leave the Primary HDU blank (Default: True)
create_folder (boolean (Default: False)) – Create folder if not exist. Use with caution.