Spitzer Documentation & Tools
MOPEX User's Guide

Chapter 9. Running MOPEX on the Command Line

9.1            Setting up MOPEX

MOPEX can be downloaded from the website. We assume that you have downloaded the installation file and followed the installation instructions. The following steps must then be followed to set up MOPEX for the command line:

 

  • Edit the file mopex-script-env.csh (found in the MOPEX installation directory) to set the installation path MOPEX_INSTALLATION to the current directory (pwd) e.g. if MOPEX is in /home/joe/mopex, then you should set the following in mopex-script-env.csh:

setenv MOPEX_INSTALLATION /home/joe/mopex.

 

  • Running cshell (not bash), source mopex-script-env.csh:

unix% source mopex-script-env.csh

 

  • MOPEX can now be run from the command line using the syntax described at the bottom of this section.

9.2            Setting up the MOPEX directory structure

Once MOPEX has been set up for the command line, you need to create the expected directory structure. We will call the directory containing your data <data_dir>, the directory containing the MOPEX software <mopex_dir>, and the directory from which you are planning to run MOPEX <working_dir>. Your <working_dir> can be <mopex_dir>, but doesn’t have to be.

 

MOPEX expects 4 basic input types:

 

  1. your input FITS images (e.g. Spitzer BCDs);
  2. ASCII text files listing the input images;
  3. a file listing the parameters you want to use to reduce your data (the "namelist");
  4. any required calibration files (e.g. pmasks, sample PRFs etc).

 

In order to run MOPEX, your FITS images should be in <data_dir>, your lists containing the input images can be stored anywhere (default is in <working_dir> but can be changed by specifying the full path) and your namelist must be in a subdirectory called <working_dir>/cdf/. The calibration files must be in the subdirectory <working_dir>/cal/. Once this directory structure has been set up, you are ready to run MOPEX. Please see Chapter 3 on MOPEX Input  for details on how to set up the input list files.

9.3            Running MOPEX

Once your directory structure is set up and you have created your input files and stored them in the correct place, you are ready to run MOPEX from <working_dir>. MOPEX is run on the command line by calling a set of Perl wrapper scripts (stored in <mopex_dir>/bin/) to perform the basic reduction tasks (e.g. background matching, mosaicking of the input images, point source extraction). Each of these wrapper scripts runs a series of individual "modules" in sequence to read in the data, carry out the reduction and write the output. Depending on how you wish to process your data, some of these individual modules need to be turned on or off within the processing flow. The choice of modules, along with various other options, is controlled from within an ASCII parameter file called the "namelist".

 

MOPEX comes with example template namelists in the directory <mopex_dir>/cdf/ .For a full list of reduction scripts available from the command line, please see Appendix A.

 

As an example of how to run MOPEX, a typical reduction involves background-matching your input images, mosaicking them together, and then carrying out point source extraction on the resultant mosaic. These three steps require three scripts: overlap.pl, mosaic.pl and apex_1frame.pl. The syntax for running MOPEX is as follows:

unix% script.pl <option flag> <specification>

 

where the option flags can be used to specify input and output files, and must be matched with a specification. More than one option flag can be specified, and they can be given in any order. The option flags that can be used vary from script to script, and are all listed in the sections for the different pipelines below (§9.5 - §9.8).

 

Each script expects a list of FITS images and a namelist file as input. The format of the input list is given in §3.2 MOPEX Input List Files, and the format of the namelist is described in §9.4 MOPEX Input Namelist.

 

The default locations for all of the files except for the namelist file can be overridden by providing the full path name, for example:

unix% overlap.pl -n overlap_I1.nl -I /data/IRAC/bcd/ImageList.txt

 

Not all of the input and output options have to be specified on the command line - most can be specified from within the namelist. The only option that cannot is the name of the namelist itself. The simplest possible (and recommended) way to run MOPEX would therefore be to specify all of the options in the namelist. This option would look something like:

unix%  mosaic.pl -n mosaic_namelist.nl

If a parameter is defined in both the namelist and on the command line, the command line takes precedence.

 

The default location for the input files is in <working_dir>. When specifying input files, you should use either the full path name or the path relative to the working directory. Calibration files (e.g. PRF files and PMasks) are assumed by MOPEX to be in the cal/ subdirectory of the current working directory.

 

While running, the Perl scripts will send information to the standard output, usually the screen. Under normal circumstances, this information is not vital, but you can save it to a file with a redirect “> save.txt”. Some modules also save a log file in cdf/log_(module name)