Writing the output file

Output handlers govern how the final solution is handled. The typical thing to do is to write to a FITS file, which is handled by the class OutputFile. This is the default, so if you are using that, you can omit the :type: specification.

class piff.Output[source]

The base class for handling the output for writing a Piff model.

This is essentially an abstract base class intended to define the methods that should be implemented by any derived class.

classmethod parseKwargs(config_output, logger=None)[source]

Parse the output field of a configuration dict and return the kwargs to use for initializing an instance of the class.

The base class implementation just returns the kwargs as they are, but derived classes might want to override this if they need to do something more sophisticated with them.

Parameters
  • config_output – The output field of the configuration dict, config[‘output’]

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

Returns

a kwargs dict to pass to the initializer

classmethod process(config_output, logger=None)[source]

Parse the output field of the config dict.

Parameters
  • config_output – The configuration dict for the output field.

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

Returns

an Output handler

read(logger=None)[source]

Read a PSF object that was written to an output file back in.

Parameters

logger – A logger object for logging debug info. [default: None]

Returns

a piff.PSF instance

write(psf, logger=None)[source]

Write a PSF object to the output file.

Parameters
  • psf – A piff.PSF instance

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

class piff.OutputFile(file_name, dir=None, stats_list=None, logger=None)[source]

An Output handler that just writes to a FITS file.

This is the only Output handler we have, so it doesn’t need to be specified by name with a type field.

It includes specification of both the output file name as well as potentially some statistics to output as well.

Parameters
  • file_name – The file name to write the data to.

  • dir – Optionally specify a directory for this file. [default: None]

  • stats_list – Optionally a list of Stats instances to also output. [default: None]

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

classmethod parseKwargs(config_output, logger=None)[source]

Parse the output field of a configuration dict and return the kwargs to use for initializing an instance of the class.

Parameters
  • config_output – The output field of the configuration dict, config[‘output’]

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

Returns

a kwargs dict to pass to the initializer

write(psf, logger=None)[source]

Write a PSF object to the output file.

Parameters
  • psf – A piff.PSF instance

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