next up previous 79
Next: New Figaro features
Up: Figaro 5.1-4 release
Previous: Release notes


Figaro tips

  1. How to process a list of files with a command

    One way to process several files in a UNIX C-shell is using a foreach loop. For example, if you wanted to add a constant to all the files matching the wildcard run1??.sdf you might:

       % foreach f ( run1??.sdf )
       ? icadd $f:r 5.6 $f:r
       ? end
    

    If you wanted the resulting output files to have the same root name but with some string appended, for example image.sdf to become image_db.sdf, then the above would change to:

       % foreach f ( run1??.sdf )
       ? icadd $f:r 5.6 $f:r_db
       ? end
    

    Similarly, you might like to store the commands in a script (lets call it icmadd) instead of having to type them each time:

       % icmadd 5.6 run1??.sdf
    

    The basic icmadd script would look like this:

       #!/bin/csh
       figaro           # Loads Figaro commands.
       set c = $1       # Gets constant to be added from first arg.
       shift            # Throws away constant from list of args.
       foreach f ( $* ) # Processes list of files.
          icadd $f:r $f:r_db
       end
    

  2. How to save disk space when using ISUBSET

    If you use `isubset' to remove unwanted parts of an image the output file produced remains approximately the same size as the input file. This is the case even if you select only a very small part of the input dataset.

    Using NDF sections, this effect can be eliminated, resulting in output files of the expected size. For example, if you wanted to take a 100x100-pixel subset from an image, and would normally use:

       % isubset im=inimage ys=200 ye=299 xs=250 xe=349 out=outimage
    

    (note the use of abbreviated parameter names, see notes for 5.1-3), the same subset can be obtained by:

       % isubset im=inimage'(200:299,250:349)' ys=min ye=max \
                 xs=min xe=max out=outimage
    

    The difference being that the file produced by this command will be smaller. If your dataset does not contain n-dimensional axis centres then the KAPPA command NDFCOPY is more succinct.

       % ndfcopy inimage'(200:299,250:349)' outimage
    

  3. How to use the value of a parameter from one command when using a second command

    Sometimes you may want, for example, to take the median obtained using `istat' and use this value as the FACTOR in an `icsub' command. This can be done as follows:

       % istat im=image median
       % icsub im=image fac=@$ADAM_USER/istat.median out=outimage
    

    This assumes that the environment variable ADAM_USER points to the directory where your parameter files are stored; this is by default the directory adam in your home directory (~/adam).

  4. How to explicitly access a non-NDF file via the new Figaro Data-Access Library (FDA)

    If you wish to access a data file which has the same root name as an NDF you must give the full file name to explicitly select that file. For example, if you have two files image.sdf (an NDF) and image.dst (a DST) in the same directory then

       % figaro
       % convert
       % icsub image 4 output
    

    will select the NDF, assuming you have not altered the default precedence used (see notes for 5.1-3), and

       % figaro
       % convert
       % icsub image.dst 4 output
    

    will select the DST file explicitly.

    The environment variable FIGARO_FORMATS is no longer used.



next up previous 79
Next: New Figaro features
Up: Figaro 5.1-4 release
Previous: Release notes

FIGARO A general data reduction system
Starlink User Note 86
Keith Shortridge, Horst Meyerdierks,
Malcolm Currie, Martin Clayton, Jon Lockley,
Anne Charles, Clive Davenhall,
Mark Taylor, Tim Ash, Tim Wilkins, Dave Axon,
John Palmer, Anthony Holloway and
Vito Graffagnino
2004 February 17
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council