ACID Functions — ACID_code documentation

# ACID Functions

ACID.ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sns, vgrid, all_frames='default', poly_or=3, pix_chunk=20, dev_perc=25, n_sig=1, telluric_lines=[3820.33, 3933.66, 3968.47, 4327.74, 4307.9, 4383.55, 4861.34, 5183.62, 5270.39, 5889.95, 5895.92, 6562.81, 7593.7, 8226.96], order=0)

  Accurate Continuum fItting and Deconvolution

  Fits the continuum of the given spectra and performs LSD on the continuum corrected spectra, returning an LSD profile for each spectrum given. Spectra must cover a similiar wavelength range.

  Parameters:

    - input_wavelengths (list) – Wavelengths for each frame (in Angstroms).

    - input_spectra (list) – Spectral frames (in flux).

    - input_spectral_errors (list) – Errors for each frame (in flux).

    - line (str) – Path to linelist. Takes VALD linelist in long or short format as input. Minimum line depth input into VALD must be less than 1/(3*SN) where SN is the highest signal-to-noise ratio of the spectra.

    - frame_sns (list) – Average signal-to-noise ratio for each frame (used to calculate minimum line depth to consider from line list.

    - vgrid (array) – Velocity grid for LSD profiles (in km/s).

    - all_frames (str or array, optional) – Output array for resulting profiles. Only neccessary if looping ACID function over many wavelength regions or order (in the case of echelle spectra). General shape needs to be (no. of frames, 1, 2, no. of velocity pixels).

    - poly_or (int, optional) – Order of polynomial to fit as the continuum.

    - pix_chunk (int, optional) – Size of ‘bad’ regions in pixels. ‘bad’ areas are identified by the residuals between an inital model and the data. If a residual deviates by a specified percentage (dev_perv) for a specified number of pixels (pix_chunk) it is masked. The smaller the region the less aggresive the masking applied will be.

    - dev_perc (int, optional) – Allowed deviation percentage. ‘bad’ areas are identified by the residuals between an inital model and the data. If a residual deviates by a specified percentage (dev_perv) for a specified number of pixels (pix_chunk) it is masked. The smaller the deviation percentage the less aggresive the masking applied will be.

    - n_sig (int, optional) – Number of sigma to clip in sigma clipping. Ill fitting lines are identified by sigma-clipping the residuals between an inital model and the data. The regions that are clipped from the residuals will be masked in the spectra. This masking is only applied to find the continuum fit and is removed when LSD is applied to obtain the final profiles.

    - telluric_lines (list, optional) – List of wavelengths (in Angstroms) of telluric lines to be masked. This can also include problematic lines/features that should be masked also. For each wavelengths in the list ~3Å eith side of the line is masked.

    - order (int, optional) – Only applicable if an all_frames output array has been provided as this is the order position in that array where the result should be input. i.e. if order = 5 the output profile and errors would be inserted in all_frames[:, 5].

  Returns:

    Resulting profiles and errors for spectra.

  Return type:

    array

ACID.ACID_HARPS(filelist, line, vgrid, poly_or=3, order_range=array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69]), save_path='./', file_type='e2ds', pix_chunk=20, dev_perc=25, n_sig=1, telluric_lines=[3820.33, 3933.66, 3968.47, 4327.74, 4307.9, 4383.55, 4861.34, 5183.62, 5270.39, 5889.95, 5895.92, 6562.81, 7593.7, 8226.96])

  Accurate Continuum fItting and Deconvolution for HARPS e2ds and s1d spectra (DRS pipeline 3.5)

  Fits the continuum of the given spectra and performs LSD on the continuum corrected spectra, returning an LSD profile for each file given. Files must all be kept in the same folder as well as thier corresponding blaze files. If ‘s1d’ are being used their e2ds equivalents must also be in this folder. Result files containing profiles and associated errors for each order (or corresponding wavelength range in the case of ‘s1d’ files) will be created and saved to a specified folder. It is recommended that this folder is seperate to the input files.

  Parameters:

    - filelist (list) – List of files. Files must come from the same observation night as continuum is fit for a combined spectrum of all frames. A profile and associated errors will be produced for each file specified.

    - line (str) – Path to linelist. Takes VALD linelist in long or short format as input. Minimum line depth input into VALD must be less than 1/(3*SN) where SN is the highest signal-to-noise ratio of the spectra.

    - vgrid (array) – Velocity grid for LSD profiles (in km/s).

    - poly_or (int, optional) – Order of polynomial to fit as the continuum.

    - order_range (array, optional) – Orders to be included in the final profiles. If s1d files are input, the corresponding wavelengths will be considered.

    - save_path (array, optional) – Path to folder that result files will be saved to.

    - file_type (str, optional) – ‘e2ds’ or ‘s1d’.

    - pix_chunk (int, optional) – Size of ‘bad’ regions in pixels. ‘bad’ areas are identified by the residuals between an inital model and the data. If a residual deviates by a specified percentage (dev_perv) for a specified number of pixels (pix_chunk) it is masked. The smaller the region the less aggresive the masking applied will be.

    - dev_perc (int, optional) – Allowed deviation percentage. ‘bad’ areas are identified by the residuals between an inital model and the data. If a residual deviates by a specified percentage (dev_perv) for a specified number of pixels (pix_chunk) it is masked. The smaller the deviation percentage the less aggresive the masking applied will be.

    - n_sig (int, optional) – Number of sigma to clip in sigma clipping. Ill fitting lines are identified by sigma-clipping the residuals between an inital model and the data. The regions that are clipped from the residuals will be masked in the spectra. This masking is only applied to find the continuum fit and is removed when LSD is applied to obtain the final profiles.

    - telluric_lines (list, optional) – List of wavelengths of telluric lines to be masked in Angstroms. This can also include problematic lines/features that should be masked also. For each wavelengths in the list ~3Å eith side of the line is masked.

  Returns:

    Barycentric Julian Date for files list: Profiles (in normalised flux) list: Profile Errors (in normalised flux)

  Return type:

    list

ACID.calc_deltav(wavelengths)

  Calculates velocity pixel size

  Calculates the velocity pixel size for the LSD velocity grid based off the spectral wavelengths.

  Parameters:

    wavelengths (array) – Wavelengths for ACID input spectrum (in Angstroms).

  Returns:

    Velocity pixel size in km/s

  Return type:

    float