Spectrum1D API

class aspired.spectral_reduction.SpectrumOneD(spec_id=None, verbose=True, logger_name='SpectrumOneD', log_level='INFO', log_file_folder='default', log_file_name=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)[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, widthup, sepdn, sepup, skywidthdn, skywidthup)[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)[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)[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, max_atlas_wavelength)[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)[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)[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)[source]

Add a RASCAL Calibrator object.

Parameters:calibrator (rascal.Calibrator()) – A RASCAL Calibrator object.
add_calibrator_properties(num_pix, pixel_list, plotting_library, log_level)[source]

Add the properties of the RASCAL Calibrator.

Parameters:
  • num_pix (int) – The number of pixels in the dispersion direction
  • pixel_list (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.
  • log_level (string) – Choose from {CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET}.
add_count(count, count_err=None, count_sky=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)[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, count_err_resampled, count_sky_resampled)[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)[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_exptime(exptime)[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)[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, matched_peaks, matched_atlas, rms, residual, peak_utilisation, atlas_utilisation)[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, matched_peaks, matched_atlas, rms, residual, peak_utilisation, atlas_utilisation)[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, matched_peaks, matched_atlas, rms, residual, peak_utilisation, atlas_utilisation)[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)[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, flux_err, flux_sky)[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, flux_err, flux_sky)[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, flux_err, flux_sky)[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)[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, flux_err_resampled, flux_sky_resampled)[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, flux_err, flux_sky)[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, flux_err, flux_sky)[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, flux_err, flux_sky)[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, flux_err, flux_sky)[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)[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, xbins, ybins, min_wavelength, max_wavelength, range_tolerance, linearity_tolerance)[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_literature_standard(wave_literature, flux_literature)[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)[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)[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)[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)[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)[source]

Add the wavelength (Angstrom) of the arc lines.

Parameters:peaks (1-d array) – The wavelength value of the peaks.
add_pixel_list(pixel_list)[source]

Add the pixel list, which contain the effective pixel values that has accounted for chip gaps and non-integer pixel value.

Parameters:pixel_list (1-d array) – The effective position of the pixel.
add_pixel_mapping_itp(pixel_mapping_itp)[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)[source]

Add the extraction profile.

Parameters:profile (1-d array) – The weight function of the extraction profile.
add_ransac_properties(sample_size, top_n_candidate, linear, filter_close, ransac_tolerance, candidate_weighted, hough_weight, minimum_matches, minimum_peak_utilisation, minimum_fit_error)[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.
add_readnoise(readnoise)[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)[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)[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)[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)[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, slength, sorder)[source]

Add the SG smoothing parameters for computing the sensitivity curve.

Parameters:
  • smooth (bool) – Indicate if smoothing was applied.
  • slength (int) – The size of the smoothing window.
  • sorder (int) – The order of polynomial used for SG smoothing.
add_spectrum_header(header)[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)[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, target)[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)[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)[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)[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)[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)[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, trace_sigma, pixel_list=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
  • pixel_list (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)[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)[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)[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, temperature, relative_humidity)[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_arc_spec_fits()[source]

Create an ImageHDU for the spectrum of the arc lamp.

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_fits()[source]

Create an ImageHDU for the extracted spectrum in photoelectron counts.

create_count_resampled_fits()[source]

Create an ImageHDU for the extracted spectrum in photoelectron count at the resampled wavelengths.

create_fits(output, recreate=True, empty_primary_hdu=True, return_hdu_list=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: 3 HDUs
    1D arc spectrum, 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)
  • 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_trace_fits()[source]

Create an ImageHDU for the trace.

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.

create_weight_map_fits()[source]

Create an ImageHDU for the extraction profile weight function.

merge(spectrum_oned, overwrite=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_spec_header(idx, method, *args)[source]

for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None

HDU Data
0 1 2 Arc spectrum Peaks (pixel) Peaks (sub-pixel)
modify_atm_ext_header(method, *args)[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, *args)[source]

for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None

HDU Data
0 Atmospheric Extinction
modify_count_header(idx, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, method, *args)[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, *args)[source]

for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None

HDU Data
0 Sensitivity
modify_sensitivity_resampled_header(method, *args)[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, *args)[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, *args)[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, method, *args)[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, *args)[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, *args)[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, *args)[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, *args)[source]

for method ‘set’, it takes keyword, value=None, comment=None, before=None, after=None

HDU Data
0 Line spread function
remove_airmass()[source]

Remove the airmass value.

remove_arc_header()[source]

Remove the arc_header.

remove_arc_spec()[source]

Remove the 1D spectrum of the arc.

remove_arc_spec_fits()[source]

Remove the arc_spec FITS HDUList.

remove_atlas_wavelength_range()[source]

Remove the atlas wavelength range.

remove_atm_ext()[source]

Remove the atmospheric extinction correction factor in the native wavelengthss.

remove_atm_ext_fits()[source]

Remove the atm_ext FITS HDUList.

remove_atm_ext_resampled()[source]

Remove the atmospheric extinction correction factor in the resampled wavelengths.

remove_atm_ext_resampled_fits()[source]

Remove the atm_ext_resampled FITS HDUList.

remove_calibrator()[source]

Remove the Calibrator.

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_count()[source]

Remove the count, count_err and count_sky.

remove_count_continuum()[source]

Remove the continuum count values.

remove_count_fits()[source]

Remove the count FITS HDUList.

remove_count_resampled()[source]

Remove the photoelectron counts of the resampled spectrum.

remove_count_resampled_continuum()[source]

Remove the continuum count_resampled values.

remove_count_resampled_fits()[source]

Remove the count_resampled FITS HDUList.

remove_exptime()[source]

Remove the exptime value.

remove_fit_coeff()[source]

Remove the polynomial co-efficients of the pixel-to-wavelength function.

remove_fit_output_final()[source]

Remove the accepted polynomial solultion.

remove_fit_output_rascal()[source]

Remove the RASCAL polynomial solution.

remove_fit_output_refine()[source]

Remove the refined RASCAL polynomial solution.

remove_fit_type()[source]

Remove the chosen type of polynomial.

remove_flux()[source]

Remove the flux, uncertainty of flux, and background sky flux.

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_continuum()[source]

Remove the continuum flux values.

remove_flux_fits()[source]

Remove the flux 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_fits()[source]

Remove the flux_resampled 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_gain()[source]

Remove the gain value.

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_min_atlas_distance()[source]

Remove the minimum distance between lines to be accepted.

remove_min_atlas_intensity()[source]

Remove the minimum atlas intensity.

remove_peaks()[source]

Remove the list of peaks.

remove_peaks_refined()[source]

Remove the list of refined peaks.

remove_peaks_wave()[source]

Remove the list of wavelengths of the arc lines.

remove_pixel_list()[source]

Remove the pixel list.

remove_pixel_mapping_itp()[source]

Remove the interpolation function that maps the pixel values to the effective pixel value.

remove_profile()[source]

Remove the extraction profile.

remove_ransac_properties()[source]

Remove the RANSAC properties of the RASCAL Calibrator.

remove_readnoise()[source]

Remove the readnoise value.

remove_seeing()[source]

Remove the seeing value.

remove_sensitivity()[source]

Remove the sensitivity values.

remove_sensitivity_func()[source]

Remove the sensitivity curve function.

remove_sensitivity_resampled()[source]

Remove the sensitivity after the spectrum is resampled.

remove_sensitivity_resampled_fits()[source]

Remove the sensitivity_resampled FITS HDUList.

remove_smoothing()[source]

Remove the smoothing parameters for computing the sensitivity curve.

remove_spectrum_header()[source]

Remove the FITS header of the target.

remove_standard_header()[source]

Remove the FITS header of the standard.

remove_standard_star()[source]

Remove the name of the standard star and its source.

remove_telluric_factor()[source]

Remove the Telluric factor.

remove_telluric_func()[source]

Remove the Telluric interpolated function.

remove_telluric_nudge_factor()[source]

Remove the Telluric nudge factor.

remove_telluric_profile()[source]

Remove the Telluric profile.

remove_telluric_profile_fits()[source]

Remove the telluric_profile FITS HDUList.

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 pixel_list and the interpolation function that maps the pixel values to the effective pixel values.

remove_trace_fits()[source]

Remove the trace FITS HDUList.

remove_variances()[source]

Remove the variances.

remove_wavecal_fits()[source]

Remove the wavecal FITS HDUList.

remove_wavelength()[source]

Remove the wavelength of each effective pixel.

remove_wavelength_fits()[source]

Remove the wavelength FITS HDUList.

remove_wavelength_resampled()[source]

Add the resampled wavelength.

remove_wavelength_resampled_fits()[source]

Remove the resampled wavelength FITS HDUList.

remove_weather_condition()[source]

Remove the Pressure, Temperature and Humidity.

remove_weight_map_fits()[source]

Remove the weight_map FITS HDUList.

save_csv(output, filename, overwrite, recreate)[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: 3 HDUs
    1D arc spectrum, 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.
save_fits(output, filename, overwrite=False, recreate=True, empty_primary_hdu=True)[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: 3 HDUs
    1D arc spectrum, 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)