Table Of Contents

Previous topic

Calibration Database

Next topic


This Page

Utility Functions

The pipeline provides and makes use of a wide variety of utility functions for common tasks. These can be found in the utils directory. See the individual source code files for detailed notes and usage instructions.

The following list is far from complete; these are just some of the most useful functions that new developers should be aware of.

Pipeline Configuration Settings

Load values from config files by calling::
setting = gpi_get_setting(‘name_of_desired_setting’, default=’value if setting not in config file’)

Add a keyword to /integer, /float, /bool etc if you want to cast to some non-string type.

Data Paths and Filenames

Utility function for expanding pathnames, ~ and ~username, environment variables, etc.
Inverse of the above: compress any strings to environment variables if possible.
Look up a named directory’s actual file path
Get the directory ‘date string’ e.g. 131031 for 2013 October 31st

FITS Files and Header Keywords

Read in image extension data and primary and extension headers in one convenient function call.
Deprecated; this is a utility function for reading in early development GPI files with not-yet-standards-compliant FITS headers and updating them on the fly to match the later conventions and file formats.
Validate that a file is actually suitable to process: it’s from GPI and not some other Gemini instrument, etc.
Get a keyword, automatically retrieving it from either Primary or Extension headers as appropriate based on the Gemini/GPI keyword specification.
Set a keyword, automatically writing it to either Primary or Extension headers as appropriate based on the Gemini/GPI keyword specification.
Per Gemini requirements, many GPI keywords for mechanisms have cruft on either side of the value: “DISP_PRISM_G6162” instead of just “PRISM” and so on. This function trims that off and returns just the central portion.