Personal tools
You are here: Home / COSMOS / process-2spec


Back to Programs


process-2spec constructs a script for processing a set of 2-dimensional spectra. The script is in the form of a standard UNIX makefile, which is executed with the UNIX command make.

USAGEprocess-2spec [spectrum-set]
INPUToptional spectrum-set


process-2spec allows one to pipeline most of the processes needed to construct a 2-d spectrum file from a set of observations. One must start with:

  • a set of object, comparison arc, and spectral flat-field exposures
  • optionally, a bias frame
  • optionally, a bad pixel file
  • an observation definition file appropriate for the set of exposures
On being invoked without a pset file, process-2spec prompts for the needed information:

Spectrum set:           Mymask_night1
Associated obsdef file: Mymask
Bad pixel file:         mybadfile
File prefix:            "ccd" or "ift"
Science frame(CR=>done) 005
    Bias frame:         bias
    Comparison arcs:    003 007
    Flat frames:        004 006
Science frame(CR=>done) 007
    Bias frame:         bias
    Compairson arcs:    009
    Flat frames:        006 008
Science frame(CR=>done)

process-2spec has the following restrictions on input:

  • with the exception of the bias frame, all frame names must be numbers, which are converted into frame names by adding the prefix "ccd", thus frame 005 becomes ccd005.
  • the bias frame can be a single number, a single name such as "bias", or "none" if no bias frame is to be used.
  • the bad pixel file can either be a filename (without the ".badpix" extension) or "none".
  • multiple frames can be specified for the flats
  • one or two frames can be specified for the comparison arc
in addition, process-2spec requires the following
  • the bias_file must be set to "none" in the biasflat and Sflats parameter files
  • the clean parameter in the sumspec parameter file must be set to "yes
  • because process-2spec examines the data files to determine certain processing steps, COSMOS_IMAGE_DIR must point to the directory containing the image files
process-2spec constructs a script to run the following programs on the data set:
  • map-spectra
  • adjust-map
  • Sflats
  • biasflat
  • subsky
  • extract-2dspec
  • sumspec, if more than one science frame is specified
The output of the above invocation of process-2spec is a makefile called Mymask_night1.make. It is run with the standard UNIX make command:
make -f Mymask_night1.make
The outcome of this operation will be a combined 2-d spectrum file named Mymask_night1_2spec.fits

process-2spec also creates a file named, in this example, Mymask_night1.pset which contains all of the information input when the program was run. Invoking process-2spec with the name of this file creates a makefile without the need to reenter the information. The pset file is a text file which can be edited to correct mistakes or add additional data.

make is a program which is handy when some files need to be made out of other files. It's usual application is in program development: object files need to be made out of source files, executables out of object files and libraries, etc. In COSMOS, map files need to be made out of obsdef and arc image files, _s files out of map files and object image files, etc.

The handy thing about make is that it never wastes effort: it understands which files are the products of which other files, and only remakes the former if the latter have changed. Thus, if one runs make on Mymask_night1.make for the first time. all of the programs are executed. However, if one immediately reruns make, it will respond:

make 'Mymask_night1_2spec.fits' is up to date
If, now, one changed one or more of the input files, most likely one of the parameter files for the programs, but possibly some image file as well, make will rerun only those parts of the script which depend on the changed file.

If all goes well, the screen output of make will be identical to what would be seen if all of the programs were run manually. If there is an error in one of the programs, make will quit at that point. If make cannot find one of the files that is required to process the data, it will also quit, with the following strange-sounding complaint:

make: *** No rule to make target `somefile', needed by `anotherfile'.  Stop.
where somefile is the missing file, and anotherfile is the output file of one of the programs. In this case, check to see why somefile is missing.

Back to Programs