pipeline.spectroscopy package

Submodules

pipeline.spectroscopy.new_wavelength module

pipeline.spectroscopy.redspec module

Pipeline for Goodman High Troughput Spectrograph spectra Extraction.

This program finds reduced images, i.e. trimmed, bias subtracted, flat fielded, etc. that match the <pattern> in the source folder, then classify them in two groups: Science or Lamps. For science images, finds the spectrum or spectra and traces it doing some fit.

Simon Torres 2016-06-28

class pipeline.spectroscopy.redspec.MainApp

Bases: object

Defines and initialize all important variables for processing the data

The MainApp class controls the way the night is organized for further processing. It also sets the appropriate parameters that will allow for a smooth working in all the other modules.

pipeline.spectroscopy.redspec.get_args(arguments=None)

Handles the argparse library and returns the arguments

The list of arguments can be found with running redspec -h or redspec --help.

Notes

The full list of arguments are not listed here as the may evolve in which case is impossible to keep this up to date.

Returns:An object that contains all the variables parsed through the argument system

pipeline.spectroscopy.wavelength module

Contains the tools to produce a wavelength solution

This module gets the extracted data to produce a wavelength solution, linearize the spectrum and write the solution to the image’s header following the FITS standard.

class pipeline.spectroscopy.wavelength.WavelengthCalibration(args)

Bases: object

Wavelength Calibration Class

The WavelengthCalibration class is instantiated for each of the science images, which are treated as a “science object”. In this first release it can find a wavelength solution for a given comparison lamp using an interactive GUI based on Matplotlib. Although it works very good, for the next release there is a plan for creating an independent GUI based on QT in order to work better in different screen sizes and other topic such as showing warnings, messages and help.

This class takes 1D spectrum with no wavelength calibration and returns fits files with wavelength solutions using the FITS standard for linear solutions. Goodman spectra are slightly non-linear therefore they are linearized and smoothed before they are returned for the user.

add_wavelength_solution(ccd, x_axis, evaluation_comment=None)

Add wavelength solution to the new FITS header

Defines FITS header keyword values that will represent the wavelength solution in the header so that the image can be read in any other astronomical tool. (e.g. IRAF)

Notes

This method also saves the data to a new FITS file, This should be in separated methods to have more control on either process.

Parameters:
  • ccd (object) – Instance of CCDData
  • x_axis
  • evaluation_comment (str) – A comment with information regarding the quality of the wavelength solution
Returns:

A CCDData instance with linear wavelength

solution on it.

Return type:

ccd (object)

get_wsolution()

Returns the mathematical model of the wavelength solution

The wavelength solution is a callable mathematical function from astropy.modeling.models. By obtaining this mathematical model the user can use its own method to apply it to a given data.

Returns:A callable mathematical function. None if the wavelength solution doesn’t exist.
class pipeline.spectroscopy.wavelength.WavelengthSolution(solution_type=None, model_name=None, model_order=0, model=None, ref_lamp=None, eval_comment='', header=None)

Bases: object

Contains all relevant information of a given wavelength solution

Stores the mathematical model that allows to convert from pixel to angstrom as well as more detailed information regarding the type of solution and the quality.

check_compatibility(header=None)

Checks compatibility of new data

A wavelength solution is stored as an object (this class). As an attribute of this class there is a dictionary that contains critical parameters of the spectrum that were used to obtain this solution. In order to apply the same solution to another spectrum its header has to be parsed and then the parameters are compared in order of importance.

Parameters:header (object) – FITS header instance from astropy.io.fits.header.Header.
Returns:True if the new data is compatible with the solution or False if its not.
set_solution_name(header)

Defines a name for the solution

Using the header’s information define a string that could be used as a keyword to identify a particular solution in the event that multiple solutions or instances of this class are stored somewhere/somehow.

Parameters:header (object) – FITS header instance from astropy.io.fits.header.Header.
Returns:Wavelength solution name.
set_spectral_features(header)

Creates dictionary that defines the instrument configuration

Both Blue and Red Camera produce slightly different FITS headers being the red camera the one that provides more precise and better information. This method will recognize the camera and create the dictionary accordingly.

Notes

As of August 2017 both headers are FITS compliant and contain the same keywords.

Parameters:header (object) – Instance of astropy.io.fits.header.Header.
Returns:A dictionary that contains key information regarding the kind of spectroscopic data, basically related to the instrument configuration. The keywords it reads are: INSTCONF, GRATING, ROI, FILTER, FILTER2, SLIT, WAVMODE, CAM_ANG, GRT_ANG.

Module contents

Goodman Spectroscopic Tools