V. Home Grown Software

This section describes the various software projects that the myriad programmers have created. The software will be grouped by programming language. Once again, I will describe the files and the steps one needs to take in order to get each software program working and a brief description on how to use them. This software should all be moved to a general directory that is accessible to all programmers.

You can also check out our Local Programs page.


C/C++ - scandir, scanfits

scandir: Scan FITS headers and output tablulated information.

scandir (which should probably be renamed to fitsscan, scanfits, or fitsheader), is a program that scans through a directory or directories of FITS files, extracts their FITS headers and then tabulates the desired information. The format for using {\bf scandir} can be obtained by executing {\bf scandir} without any options. Here is a brief synopsis:

Usage: scandir [-i init_file] [-d directory] {objects} This is the new version of scandir, completely rewritten in C++. The main new feature is the ability to use a template file (init_file) to describe which headers you want and where they should be placed in the scandir output. The default template file is hardcoded into the program in the format we use as of the Fall of 94. The main bug fix deals with the correct allocation of memory for storing the data. The files that are needed to compile scandir are located in "~kevin/Programming/CC/Scandir".

Scandir Files
scandir.cc Class objects defined for Scandir.
scandir.hh Class objects declared for Scandir.
sd_main.cc Main loop of program.
util.c Generic C functions.
util.h Header file for generic C functions.

scanfits: Scan CRSP FITS headers and output tablulated information. This program was written for SL a long time ago before I rewrote scandir, so it is very much like the first version of scandir. CRSP stands for CRyogenic SPectrometer. Its use is very simple. Just enter the directory which contains the CRSP FITS files and execute ``scanfits n'', where n is the number of the first image. The images need to be in consecutive, sequential order, but they do not need to start with number 1. The output is similar to that for scandir. The C++ version of scandir should be able to duplicate this program if it is ever needed again.

The files that are needed to compile scanfits used to be located in "~kevin/Programming/C/Dsp/Scanfits". Should retrieve these from a backup tape someday.


FORTH - dspsys

The program that allows us to interface with our observing hardware. The following tables are a list of Forth files which may be used when you type "dspsys" on either PC.

Scandir Init Files
dspfsys.fth Init file for the fake system.
dspsys.fth Init file for DSP version 1.20. Uses CFORTH 1.6.

Source Files
console.fth Console (screen \& keyboard) manipulation.
debug.fth The old DRO debugger. Still needs some more work to get it to work with CFORTH.
det.fth Detector array specifications.
dsp.fth Call primitive DSP routines with error checking.
dt2823.fth Interface for the Data Translation 2823 board.
extra.fth User custom stuff.
fakedsp.fth} Disable DSP functions for use without DSP boards. Not working with 1.20.
fakedt.fth Fake routines for Data Translation 2823 board. Not working with 1.20.
fp.fth Words for calibrating a Fabry-Perot interferometer.
fits.fth Write FITS format data files (images).
genwords.fth Generally useful words independent of DSP.
imagproc.fth General image procedure words.
lpgrey.fth 16 level greyscale graphics on Epson LP. Not used anymore, may not work at all.
misc.fth Misc math/text/data-struct/file IO words.
nod.fth Move telescope.
partial.fth Partial image words.
platform.fth Creates the <dsp> vocabulary.
proton.fth Words used while at the Harvard Cyclotron.
red.fth Data analysis (statistics & display).
rpc.fth RPC interface for CFORTH.
run.fth Data fields except for detector/paths/partials.
runrun.fth Run words for NIR lab's DSP 56001 programs.
template.fth Template for FORTH language files.
tmptr.fth TS temperatures for fanout & worksurface boards.
tools.fth Dictionary & vocabulary searches.
urfp.fth Words specific to the UR Fabry-Perot interferometer.
vf.fth Allows manipulation of VF from inside Forth.
wheel.fth Filter wheel movement routines & parameters.
xdir.fth Directory management for data system.
xshowall.fth Update graphical display of detector/run parameters.

Filter Wheels
filterI.fth Style I - Old MLOF filter wheel.
filterII.fth Style II - BIB filter wheel.
filterIII.fth Style III - Lab filter wheel, stamped ``2''.
filterIV.fth Style IV - Wiro filter wheel.
filterV.fth Style V - Three CVF filters.

Additional Files
last.run Contains system parameters that get restored upon start up. Located in the det directory, this file is saved when you execute one of the ``run'' commands.
*.det These files contain the parameters of different detectors. Also located in the det directory.
clk*.lod Compiled assembly language code that gets loaded into the Spectrum clocking card memory. Located in the dsp56k/clocks directory.
urdat*.lod Compiled assembly language code that gets loaded into the Spectrum data card memory. Located in the dsp56k/dataacq directory.

In order to start the DSP FORTH system, we use a couple of different alias commands. The first alias command defines which version of CFORTH to use:

alias dspfth1.6 '/applic/dsp/csource/cforth1.6/unix/dspforth /applic/dsp/csource/cforth1.6/unix/dspforth.dic' Here, dspfth1.6 describes where the CFORTH executable and dictionary reside. The second alias that is needed to define which DSP software you wish to use:

alias dspsys2 'dspfth1.6 /applic/dsp/runtime/fthsys2/bin/fthsys.fth -' The last alias you need is the generic alias for the current version of the system:

alias dspsys dspsys2 Currently, you are able to access older versions of the software by using the appropriate version number at the end of dspsys (e.g. dspsys1.20). These older versions do not necessarily work with the current system.


PERL - whatdoc.pl, dsphelp.pl, time2ltime.pl

whatdoc.pl Generate FORTH user document. from home-grown forth software.

This program was written in PERL, instead of C or FORTH, because PERL was designed to make searching simple. It has been installed on both the Sun workstations and the 486 PCs. The only file that you need, {\bf whatdoc.pl}, will generate a document that consists of all the words that we have defined for use in the DSP system, sorted alphabetically. The following two lines describe the output from whatdoc.pl:

wordname    stack   vocabulary  file 
    description
wordname is the name of the defined word. stack is the stack notation, information which need to be on the stack before the word is executed and what is left on the stack when it finishes. vocabulary is the vocabulary in which the word is defined. If the word is not in the <dsp> vocabulary, then you will have to enter the appropriate vocabulary in order for that word to be found. file, obviously, is the file in which the word is defined. description defines what the word does and gives various extraneous details.

The current method of using {\bf whatdoc.pl} is:

whatdoc.pl -[a|p|u] files > whatsup.doc where a corresponds to advanced user words, p corresponds to programmer words (all words), u corresponds to user words (words that belong in the <dsp> vocabulary and files is usually *.fth. Usually, the output is sent to the file whatsup.doc}, which implies a document holding all of the words in the DSP system (i.e. programmer words). If you generate an user document, prefix doc with an u (whatsup.udoc), and if you generate an advanced user document, prefix doc with an a(whatsup.adoc).

dsphelp.pl: Similar script to whatdoc.pl except that it is used from within dspsys. It scans the forth files which are currently being used. This way the information is always up-to-date. As it is now, the program doesn't correctly find all words. Characters like ', " and \ cause some problems although I think " is handled correctly.

time2ltime.pl: Adds the LTIME field to FITS files that do not have TIME-OBS converted to seconds.

One of the fields that did not seem to make the transition from the old DRO software to the new software is the LTIME field. This field, in the DRO days, represented the time since the last start pulse was sent to the DRO electronics (divided by 60) (this time is referred to as RFD). In the new system, it was left out because the RFD was either no longer needed, renamed or forgotten. However, LTIME is useful with IRAF because it can be used to weight the first and second backgrounds so that both backgrounds can be used with both of the source's images (common procedure, it seems, is to take two images of the same source in a background-source-source-background pattern.)

In order to use bgsub with the data that was taken without the LTIME field, time2ltime.pl can read in a FITS file, figure out what TIME-OBS is and convert it to seconds, find the first empty HISTORY line and replace it with TIME-OBS in seconds. IRAF can now use the bgsub CL script routine written by Steve Solomon to appropriately weight the background images for use with each source image.

The best way to use time2ltime.pl is to copy the original FITS files to a new, expendable directory. Enter this directory and execute:

time2ltime.pl * Each file takes approximately ten seconds to process. If you receive a ``File not found'' error, or something similar, check the script to see if the path to perl is correct. Currently, it should be set to "/applic/nir/sun4/bin/perl".

Technically, this functionality should be written into the bgsub cl script, but I do not know how to program in cl and have no real interest in learning how.