The Operation class

The Operation class is used to define, set up, and run a operation’s CWL workflow. A subclass of the Operation class is defined for each operation. See Subclasses of the Operation class for details of each Operation subclass.

class rapthor.lib.operation.Operation(field, index=None, name: str = '')

Generic operation class

An operation is simply a CWL workflow that performs a part of the processing. It holds the workflow settings, populates the workflow input and parset templates, and runs the workflow. The field object is passed between operations, each of which updates it with variables needed by other, subsequent, operations.

Parameters:
fieldField object

Field for this operation

indexint, optional

Index of the operation

namestr, optional

Name of the operation

clean_outputs(exclude=None)

Clean temporary output files, if needed.

Parameters:
excludelist or None

List of files to exclude from the cleanup

copy_outputs_to(dest_dir, index=None, include=None, move=False)

Copy output files to a specified directory, with optional filters.

Parameters:
dest_dir: str

Path of directory to which outputs will be copied

indexint

If an output is a list and index is specified, only the item with the specified index is copied (other items in the list are ignored)

includelist or None

List of files to include in the copy

movebool, optional

If True, move files instead of copying them

finalize()

Finalize this operation.

Create a “done” file to indicate that this operations is done. Specializations should be defined in the subclasses as needed.

is_done()

Check if this operation is done, by checking if a “done” file exists.

load_outputs()

Load outputs from a JSON file.

run()

Runs the operation

set_input_parameters()

Define parameters needed for the CWL workflow inputs

The dictionary keys must match the workflow inputs defined in the corresponding workflow parset.

The entries are defined in the subclasses as needed

set_parset_parameters()

Define parameters needed for the CWL workflow template

The dictionary keys must match the jinja template variables used in the corresponding workflow parset.

The entries are defined in the subclasses as needed

setup()

Set up this operation

This involves filling the workflow template and writing the inputs file

store_outputs()

Store outputs to a JSON file.

Subclasses of the Operation class

A subclass of the Operation class is defined for each of Rapthor’s operations (see Operations): calibrate, predict, image, and mosaic. These subclasses are described in detail below.

The CalibrateDD class

The CalibrateDI class

The PredictDD class

The PredictDI class

The Image class

class rapthor.operations.image.Image(field, index, name='image')

Operation to image a field sector

finalize()

Finalize this operation

set_input_parameters()

Define the CWL workflow inputs

set_parset_parameters()

Define parameters needed for the CWL workflow template

The ImageInitial class

class rapthor.operations.image.ImageInitial(field)

Operation to image the field to generate an initial sky model

finalize()

Finalize this operation

set_input_parameters()

Define the CWL workflow inputs

set_parset_parameters()

Define parameters needed for the CWL workflow template

The Mosaic class

class rapthor.operations.mosaic.Mosaic(field, index)

Operation to mosaic sector images

finalize()

Finalize this operation

set_input_parameters()

Define the CWL workflow inputs

set_parset_parameters()

Define parameters needed for the CWL workflow template