2 Running EXTRACTOR

 2.1 Running EXTRACTOR from scripts

Like any Starlink program EXTRACTOR may be run from the Unix shell or from a user-interface such as ICL (see SG/5). A useful summary of the rich variety of methods of specifying parameter values is given in SUN/95. C-shell users should also consult SC/4, the C-Shell CookBook.

The examples below assume you are running from the Unix shell but the commands and parameters are exactly the same from ICL.

After normal Starlink startup, at the shell prompt, type:

  % extractorsetup

to initialise the package and then:

  % extractor

to run the program. You will now be prompted for the values of parameters CONFIG and IMAGE in turn:

  CONFIG - Configuration file /’$EXTRACTOR_DIR/config/default.sex’/ >
  IMAGE - Input image /’image’/ >

where CONFIG is the name of the ‘preferences’ file and IMAGE is the name of the image file to be processed.

Suggested values are given between // in the prompt. You can accept the suggested values by just typing <RETURN>. If you accept the suggested values shown above, EXTRACTOR will process the NDF "image" using the installed default configuration files to produce a catalogue named test.cat (this name is specified in the preferences file).

CONFIG has a ‘default’ value of $EXTRACTOR_DIR/config/default.sex. This file has some sensible defaults but you will probably want to copy it to your own directories and modify it to your taste (as you would for the native SExtractor program). Similarly with the other configuration files. The environment variable EXTRACTOR_DIR is defined to point to the directory containing the EXTRACTOR program and the config directory.

You can also provide parameter values on the command line. Either positionally,

  % extractor image $EXTRACTOR_DIR/config/default.sex

or by keyword,

  % extractor config=$EXTRACTOR_DIR/config/default.sex

(In this case, you would be prompted for IMAGE but not for CONFIG.)

The additional parameters KEYWORDS, NAME and VALUE allow configuration parameters specified in the preferences file to be overridden without editing the file. For example:

  % extractor keywords=true
  NAME - Parameter name /!/ > catalog_name
  VALUE - Parameter value /!/ > sky.cat
  NAME - Parameter name /!/ > catalog_type
  VALUE - Parameter value /!/ > ascii_skycat
  NAME - Parameter name /!/ >
  CONFIG - Configuration file /’$EXTRACTOR_DIR/config/default.sex’/ >
  IMAGE - Input image /’image’/ >

would change the name and type of the catalogue produced (for this run only). The list of changes is terminated by replying with the NULL response (!) to the prompt. The SExtractor User’s Guide (MUD/165) gives a full list of possible parameter names and values, but it is only sensible to change a few in this way.

2.1 Running EXTRACTOR from scripts

If you’d like to run EXTRACTOR from a script, just say for instance sampling different populations of objects at different thresholds, you can do this using the NAME VALUE parameters (avoiding the need to have multiple configuration files), but you need to adopt a slightly different strategy to normal programs. Here’s one example script:

Example batch script

  #!/bin/csh
  
  #  Initialize EXTRACTOR
  extractorsetup
  
  #  Extract all objects above 1 sigma
  extractor keywords=true image=image config=default.sex <<EOF
  catalog_name
  thresh1.cat
  detect_thresh
  1.0
  !
  EOF
  
  # Extract all objects above 2 sigma and measure on a different image.
  extractor keywords image=’"detect,measure"’ config=default.sex <<EOF
  catalog_name
  thresh2.cat
  detect_thresh
  2.0
  !
  EOF

Using the C-shell <<EOF mechanism allows you to send information to the program as if you’re typing it in.