HOW-TO Configure process parameters

Overview

In the figure below an overview is presented of how one can configure process parameters. The preferred way to configure process parameters is through the overall user interfaces found in the Target Processor webservice, and/or in the Pars class, which can be used in scripts and from the awe-prompt.

There are many ways to configure process parameters

There are many ways to configure process parameters

Via awe-prompt: overall user interface to configure parameters

via awe-prompt: pars, pars.show(), pars.get()

Process parameters can be configured from the awe-prompt, both on the task, and on the DPU level. The first question that you may have is: Which process parameters can I control, and what are their names and default values? From the awe-prompt:

awe> pars = Pars(BiasFrame, instrument='OMEGACAM', chip='ESO_CCD_#77')
awe> # or pars=Pars(BiasTask) or pars=Pars('Bias') !!
awe> pars.show()
BiasFrame
 |
 +--process_params
 |   |
 |   +--MAXIMUM_ABS_MEAN: 10.0
 |   +--MAXIMUM_STDEV: 10.0
 |   +--MAXIMUM_STDEV_DIFFERENCE: 10.0
 |   +--MAXIMUM_SUBWIN_FLATNESS: 100000.0
 |   +--MAXIMUM_SUBWIN_STDEV: 100000.0
 |   +--OVERSCAN_CORRECTION: 6
 |   +--SIGMA_CLIP: 3.0

In other words, the Pars class can be instantiated with as argument a ProcessTarget class (BiasFrame, SourceList etc.) or a Task (ReduceTask, ReadNoiseTask etc.) or a sequence identifier as specified in the dpu.run method (“Bias”, “Reduce>Astrometry”). Note that in the last case a string is specified, while in the others a class is specified. Additionally an instrument, filter, or chip identifier can be specified in order to generate instrument specific defaults. The show() method of Pars displays the configurable parameters.

The parameters can now be changed (tip to reduce typing: press the Tab key get automatic command completion):

awe> pars.BiasFrame.process_params.SIGMA_CLIP=5.0

In order to use the parameters, you must place them in a dictionary, which is produced by the get() method of the Pars class:

awe> pars.get()
{'BiasFrame.process_params.SIGMA_CLIP': 5.0}

The output can be used as follows:

awe> dpu.run('Bias', instrument='OMEGACAM', template='2014-07-04T10:39:28',
             chip='ESO_CCD_#77', p=pars.get())

or

awe> task = BiasTask(instrument='OMEGACAM', template='2014-07-04T10:39:28',
                     chip='ESO_CCD_#77', pars=pars.get())

In other words, a dictionary called “pars”, is sent to the Task (or the DPU). You can enter the dictionary directly like this:

awe> task = BiasTask(instrument='OMEGACAM', template='2014-07-04T10:39:28',
                     chip='ESO_CCD_#77',
                     pars={'BiasFrame.process_params.SIGMA_CLIP': 5.0})
awe> task.execute()

Equivalently using the DPU interface:

awe> dpu.run('Bias', i='OMEGACAM', tpl='2014-07-04T10:39:28',
             c='ESO_CCD_#77', p={'BiasFrame.process_params.SIGMA_CLIP' : 5.0})

Using the interface inside a script

It is possible to use the Pars class and the DPU interface inside scripts as follows:

# Example script
from astro.recipes.mods.dpu import Processor
from common.config.Environment import Env
from astro.util.Pars import Pars

dpu = Processor(Env['dpu_name'])
pars = Pars(BiasFrame, instrument='OMEGACAM', chip='ESO_CCD_#77')
pars.BiasFrame.process_params.OVERSCAN_CORRECTION=8
dpu.run('Bias', i='OMEGACAM' tpl='2014-07-04T10:39:28', c='ESO_CCD_#77', p=pars.get())

Via Target Processor: overall user interface to configure parameters

See the Target Processor web page http://process.astro-wise.org/. In particular note the “Process Parameters” link under “Options” at the bottom left.