The piffify executable

The normal way to construct a Piff PSF model is using the piffify executable program with a YAML configuration file:

piffify config_file

The configuration file should have three fields which define the different aspects of the process:

input

Where to read the input images and catalogs.

psf

What kind of model and interpolation to use to describe the PSF. Typically, this would have two subfields: model and interp.

  • model defines the shape of the PSF at a single location

  • interp defines how the model parameters are interpolated across the FOV.

output

Where to write the output file.

Each field is governed by a :type: parameter (although there are useful defaults for all three primary top-level fields. This corresponds to different classes in the Python code. The other parameters in each field correspond to the initialization kwargs for the class.

For instance the following cofiguration file uses the PixelGrid class for the model and the Polynomial class for interpolation. It uses the default InputFiles and OutputFile for I/O. and SimplePSF for the PSF.:

input:
    image_file_name: some_exposure/image*.fits.fz
    cat_file_name: some_exposure/cat*.fits
    x_col: X_IMAGE
    y_col: Y_IMAGE
    weight_hdu: 3
psf:
    model:
        type: PixelGrid
        pixel_scale: 0.2
        size: 64
    interp:
        type: Polynomial
        order: 3
output:
    file_name: some_exposure/piff_solution.fits

The functionality of the piffify executable is also available from python via piffify() and related functions.

piff.piffify(config, logger=None)[source]

Build a Piff model according to the specifications in a config dict.

This includes writing the model to disk according to the output field. If you would rather get the psf object in return, see the process function.

Parameters
  • config – The configuration file that defines how to build the model

  • logger – A logger object for logging progress. [default: None]

piff.read_config(file_name)[source]

Read a configuration dict from a file.

Parameters

file_name – The file name from which the configuration dict should be read.

piff.setup_logger(verbose=1, log_file=None)[source]

Build a logger object to use for logging progress

Note: This will update the verbosity if a previous call to setup_logger used a different value for verbose. However, it will not update the handler to use a different log_file or switch between using a log_file and stdout.

Parameters
  • verbose – A number from 0-3 giving the level of verbosity to use. [default: 1]

  • log_file – A file name to which to output the logging information. [default: None]

Returns

a logging.Logger instance

piff.parse_variables(config, variables, logger)[source]

Parse configuration variables and add them to the config dict

The command line variables should be specified as key=value. The key string can include dots, such as interp.order=2, which means to set:

config['interp']['order'] = 2
Parameters
  • config – The configuration dict to which to write the key,value pairs.

  • varaibles – A list of (typically command line) variables to parse.

  • logger – A logger object for logging debug info.