4 Customising Recipes

 4.1 Search paths
 4.2 Anatomy of an imaging recipe
 4.3 Index files

If you wish to write your own data-reduction recipes, you should consult the Orac-dr Programmer’s Guide (SUN/233). However, for most purposes, observers wishing to modify existing scripts can get by without this document.

A easier-to-use tailoring system to control parameters and primitive arguments from the command line and ‘personal’ style files is under consideration.

4.1 Search paths

Orac-dr allows you to create your own recipes and primitives, or modify those provided as part of the package. In either case you must tell Orac-dr where your recipes and/or primitives are stored. This is achieved through two environment variables. $ORAC_RECIPE_DIR should equate to the directory containing your recipes. $ORAC_PRIMITIVE_DIR specifies the directory containing your primitives. Here’s an example.

        % setenv ORAC_RECIPE_DIR /home/user/drmoan/recipes
        % setenv ORAC_PRIMITIVE_DIR /home/user/drmoan/primitives

Once these environment variables are defined, Orac-dr first looks in $ORAC_RECIPE_DIR or $ORAC_PRIMITIVE_DIR to find a recipe or primitive respectively. If the script is absent, Orac-dr looks in the standard $ORAC_DIR directories.

4.2 Anatomy of an imaging recipe

There are documentation modules—a Starlink style between #+ and #- delimiters at the head, and a Perl POD (Plain Old Documentation) at the foot. Between these is the code. This consists of calls to primitives, sometimes with arguments. Primitives have uppercase names preceded and terminated by underscores, such as _DIVIDE_BY_FLAT_.

4.2.1 Hello primitives

The first of these primitives is _IMAGING_HELLO_. It contains instrument-specific code and initialisation. It is best left alone. See

Section 3.1.2 for a description of what this primitive does for each instrument.

Second there is a recipe-specific primitive such as _JITTER_SELF_FLAT_HELLO_. This sets up Ccdpack, sets directives when to perform certain operations, optionally create variances, removes any bias, and edits the FITS headers.

Two things you might wish to change in the recipe _HELLO script are listed below.

4.2.2 Steering primitive

Within a recipe’s _HELLO primitive, a ‘steering’ primitive is invoked. These are best left well alone. They control when the various operations are performed. See

Appendix F.2 for more details. What you can safely adjust are the configurable steering parameters listed in the recipe documentation. In the main these parameters set the number of frames processed in a cycle through the recipe. The parameters are passed by argument through the recipe’s _HELLO script to the steering primitive.

Suppose that for some reason an observation of a nine-point jitter self flat was aborted after seven positions. If you try the recipe stored in the headers some processing will occur, but it will not include mosaic creation. The final steps inclusing mosaic creation occur once all nine frames are dark subtracted. Now there are no seven-point recipes to substitute on the command line. You could make your own seven-point recipe to reduce those data. First make a new recipe by copying the standard one.

      % cd $ORAC_RECIPE_DIR
      % cp $ORAC_DIR/recipes/imaging/JITTER_SELF_FLAT ./JITTER7_SELF_FLAT

Next edit JITTER7_SELF_FLAT and alter the line

        _JITTER_SELF_FLAT_HELLO_

to become

        _JITTER_SELF_FLAT_HELLO_ NUMBER=7

The recipe will then generate the self flat, flat field and make the mosaic once the seventh frame is dark-subtracted.

Recipes are stored in $ORAC_DIR/recipes/imaging; and for a few instrument-specific recipes in $ORAC_DIR/recipes/ <instrument >, where <instrument > is IRCAM, MICHELLE, UFTI. IRIS2, ISAAC, or INGRID. See

Appendix E for some details.

4.2.3 Recipe primitives

After the steering primitive we come to the recipe-specific scripts that actually perform the recipe. The most likely and easiest things you would change are to add arguments or modify argument values of the primitives in the recipes. For instance, you might wish to change the aperture diameter for the aperture photometry. To alter to a 4-arcsecond aperture, change the APERTURE argument’s value of the _APHOT_MAG_ primitive like below.

        _APHOT_MAG_ APERTURE=4

To obtain details of a primitive’s arguments, use the oracman or perldoc command. Thus

        % oracman _MAKE_MOSAIC_

will display the documentation for primitive _MAKE_MOSAIC_. Space does not permit inclusion of the documentation of the many primitives in this manual. Most of primitives’ source code is stored in $ORAC_DIR/primitives/imaging; the instrument-specific ones are situated within $ORAC_DIR/primitives/ <instrument >, where <instrument > is UFTI, UIST, MICHELLE, IRCAM, IRIS2, ISAAC, or INGRID; and there are a few general scripts in

$ORAC_DIR/primitives/general.

While the simplest primitives just invoke a Starlink task, and updates just that and are amenable to customisation, some are quite complex especially for the registration. They may invoke other primitives, manipulate parameters and small data files so that the various tasks connect to cope with a variety of circumstances. The most likely change you will want to make is to change the parameter values of a Starlink task. Armed with the reference documentation for the application, say with a findme <application >, it is easy to change values or append further parameters.

Here is an example. Let us suppose you wanted to combine frames to make a self flat, not with the median, since you have heard that a mean trimmed of the most-extreme tenth of the values gives better results. First copy _MAKE_FLAT_FROM_GROUP_ to your primitives directory.

        % cp $ORAC_DIR/primitives/imaging/_MAKE_FLAT_FROM_GROUP_ $ORAC_PRIMITIVE_DIR

Using an editor, find the first line in your copy of _MAKE_FLAT_FROM_GROUP_ commencing $hidden. It should be as follows.

        $hidden = "method=median sigmas=2.0 reset accept";

Change this to

        $hidden = "method=trimmed alpha=0.1 sigmas=2.0 reset accept";

to effect the change of statistic. There is in fact a second line assigning variable $hidden depending on argument CLEAN, and you should make the same alteration there too.

If there is demand, additional arguments could be provided for primitives, to simplify control. Please contact the author if you have suggestions for arguments and new recipes, or need help customising your Orac-dr scripts.

4.3 Index files

Once the pipeline has run for a bit you will find text files in $ORAC_DATA_OUT called index.flat, index.dark amongst others. These list the calibration frames. Orac-dr uses these to find the most-recent, appropriate calibration. For example, a flat requires that the filter of the flat matches that of the frame being flat fielded, and a dark must have the same exposure time as the target frame; and both must have been taken in the same instrument mode.

Here is an example of a flat index.

  #FILTER MODE ORACTIME RDOUT_X1 RDOUT_X2 RDOUT_Y1 RDOUT_Y2 WPLANGLE
  flat_Lp98_23 Lp98 STARE 13.3484 1 256 1 256 0
  flat_K98_pol0_62 K98+pol NDSTARE 7.971 1 1024 1 1024 0.000
  flat_K98_pol22_62 K98+pol NDSTARE 7.971 1 1024 1 1024 22.5
  flat_K98_pol45_62 K98+pol NDSTARE 7.971 1 1024 1 1024 45
  flat_K98_pol67_62 K98+pol NDSTARE 7.971 1 1024 1 1024 67.5
  flat_J98_88 J98 flush_read 7.46111E+00 1 1024 1 1024 0
  flat_H98_93 H98 flush_read 7.58330E+00 1 1024 1 1024 0
  flat_K98_98 K98 flush_read 7.70559E+00 1 1024 1 1024 0
  flat_H98_133 H98 flush_read 8.99034E+00 1 1024 1 1024 0
  flat_H98_138 H98 flush_read 9.07139E+00 1 1024 1 1024 0
  flat_H98_138_c1 H98 flush_read 9.12074E+00 1 1024 1 1024 0
  flat_K98_290_row0 K98 flush_read 1.13094E+01 1 1024 1 1024 0
  flat_K98_290_row1 K98 flush_read 1.15080E+01 1 1024 1 1024 0

The first line contains the column headings. ORACTIME is the UT in decimal hours, and WPLANGLE is the polarisation waveplate angle.

In general you should not manipulate these files. Mis-editing can lead to the calibration system breaking down. If you must edit this file, say to exclude a poor dark or an uneven flat, restrict yourself deleting the line corresponding to that calibration file. It’s safer to remove the calibration file and recreate a new one with the calibration frames you want by running the pipeline.

If you want to nominate specific calibration frames, overriding those selected from the calibration indices, there is a -calib option for the oracdr command to do this. See the section on calibration options in SUN/230 for examples.