pipeline.images package

Submodules

pipeline.images.data_classifier module

class pipeline.images.data_classifier.DataClassifier

Bases: object

Classifies the data being presented to the pipeline.

Data classifier is intended to define the camera that is being used and the technique in use. This will be used later to make important decisions regarding the process to be used.

pipeline.images.goodman_ccd module

class pipeline.images.goodman_ccd.MainApp

Bases: object

pipeline.images.goodman_ccd.get_args(arguments=None)

Get command line arguments.

The list of arguments can be obtained by using the argument --help. All the arguments start with two dashes and single-character arguments where avoided in order to eliminate confusion.

Parameters:arguments (list) – A list containing the arguments as elements.
Returns:
argparse instance. Contains all the arguments as
attributes
Return type:args (object)

pipeline.images.image_processor module

class pipeline.images.image_processor.ImageProcessor(args, data_container)

Bases: object

Image processing class

This class contains methods for performing CCD image reduction for spectroscopy and imaging.

create_master_bias(bias_group)

Create Master Bias

Given a DataFrame object that contains a list of compatible bias. This function creates the master flat using ccdproc.combine using median and 3-sigma clipping.

Parameters:bias_group (object) – DataFrame instance that contains a list of bias images compatible with each other.
create_master_flats(flat_group, target_name='')

Creates master flats

Using a list of compatible flat images it combines them using median and 1-sigma clipping. Also it apply all previous standard calibrations to each image.

Parameters:
  • flat_group (object) – DataFrame instance. Contains a list of compatible flat images
  • target_name (str) – Science target name. This is used in some science case uses only.
Returns:

The master flat CCDData instance and the name of under which the master flat was stored.

define_trim_section(technique=None)

Get the initial trim section

The initial trim section is usually defined in the header with the keyword TRIMSEC but in the case of Goodman HTS this does not work well. In particular for spectroscopy where is more likely to have combined binning and so on.

Parameters:technique (str) – The name of the technique, the options are: Imaging or Spectroscopy.
Returns:x2, y1:y2]``
Return type:The trim section in the format ``[x1
get_overscan_region()

Get the right overscan region for spectroscopy

It works for the following ROI:
Spectroscopic 1x1 Spectroscopic 2x2 Spectroscopic 3x3

The limits where measured on a Spectroscopic 1x1 image and then divided by the binning size. This was checked that it actually works as expected.

Notes

The regions are 1-based i.e. different to Python convention. For Imaging there is no overscan region.

Returns:
overscan_region (str) Region for overscan in the format
’[min:max,:]’ where min is the starting point and max is the end
point of the overscan region.
name_master_flats(header, group, target_name='', get=False)

Defines the name of a master flat or what master flat is compatible with a given data

Given the header of a flat image this method will look for certain keywords that are unique to a given instrument configuration therefore they are used to discriminate compatibility.

It can be used to define a master flat when creating it or find a base name to match existing master flat files thus finding a compatible one for a given non-flat image.

Parameters:
  • header (object) – Fits header. Instance of astropy.io.fits.header.Header
  • group (object) – DataFrame instance. Contains filenames as well as other important keywords that are defined in ccd.night_organizer.NightOrganizer.keywords
  • target_name (str) – Optional science target name to be added to the master flat name.
  • get (bool) – This option is used when trying to find a suitable master flat for a given data.
Returns:

A master flat name, or basename to find a match among existing files.

process_imaging_science(imaging_group)

Does image reduction for science imaging data.

Parameters:imaging_group (object) – DataFrame instance that contains a list of science data that are compatible with a given instrument configuration and can be reduced together.
process_spectroscopy_science(science_group, save_all=False)

Process Spectroscopy science images.

This function handles the full image reduction process for science files. if save_all is set to True, all intermediate steps are saved.

Parameters:
  • science_group (object) – DataFrame instance that contains a list of science images that where observed at the same pointing and time. It also contains a set of selected keywords from the image’s header.
  • save_all (bool) – If True the pipeline will save all the intermadiate files such as after overscan correction or bias corrected and etc.

pipeline.images.night_organizer module

class pipeline.images.night_organizer.NightOrganizer(full_path, instrument, technique, ignore_bias=False, ignore_flats=False)

Bases: object

check_header_cards()

Check if the header contains all the keywords (cards) expected.

This is critical for old goodman data.

Raises:ValueError – If any of the cards does not exists in the image’s header
imaging_night()

Organizes data for imaging

For imaging there is no discrimination regarding night data since the process is simpler. It is a three stage process classifying BIAS, FLAT and OBJECT data type. The data is packed in groups that are pandas.DataFrame objects.

spectroscopy_night(file_collection, data_container)

Organizes data for spectroscopy

This method identifies all combinations of nine key keywords that can set apart different objects with their respective calibration data or not. The keywords used are:

  • GAIN
  • RDNOISE
  • GRATING
  • FILTER2
  • CAM_TARG
  • GRT_TARG
  • SLIT
  • OBSRA
  • OBSDEC

This method populates the data_container class attribute which is an instance of the pipeline.core.core.NightDataContainer. A data group is an instance of a pandas.DataFrame.

Module contents

Goodman CCD Reduction Tool