DISRSOFT Image Processing Document 

The DISR and IMP calibration package

Release Version 1.6

18‑December‑1994

Nicolas Thomas and Joachim Stüwe

Max-Planck-Institut für Aeronomie

Contents	  2

1 General	  4
1.1 Purpose	  4
1.2 Hardware/software requirements	  4
1.3 Supported databases	  5

2 Detailed software description	  5
2.1 Directory structure	  5
2.1.1 GENERAL	  5
2.2 Directories with IDL programs	  7
2.2.1 STARTUP	  7
2.2.2 SYSTEM	  7
2.2.3 COMMON	  9
2.2.4 DATABASE	 10
2.2.5 DOC	 10
2.2.6 README	 11
2.2.7 TOOLS	 12
2.2.8 XY	 14
2.2.9 VERIFY	 15
2.2.10 RADIO	 16
2.2.11 RESTOR	 16
2.2.12 SIMULATE	 17
2.2.13 ENHANCE	 17
2.2.14 GEOMETRY	 17
2.2.15 ABSCAL	 18
2.2.16 REGIS	 18
2.2.17 OUTPUT	 18
2.2.18 BATCH	 18
2.2.19 DISPLAY	 19
2.3 Directories for DISRSOFT distributed data  -- preliminary description	 19
2.3.1 DATA	 19
2.4 Directories for DISR EGSE generated data  -- preliminary description	 20
2.5 Data Storage	 21
2.5.1 General	 21
2.5.2 Header Structure	 21
2.5.3 Header Line Structure	 28
2.5.4 Pixel data structure	 29
2.5.5 Filename conventions	 31
2.6 Programs	 33
2.6.1 General Philosophy	 33
2.6.2 Widget applications	 36

3 Use	 36
3.1 Installation	 36
3.1.1 Windows	 37
3.1.2 VMS	 37
3.1.3 UNIX	 37
3.2 Operation	 38
3.2.1 Windows	 38
3.2.2 VMS	 38
3.2.3 UNIX	 39

4 Examples of use	 40
4.1 Reading and displaying images	 40
4.2 Header Manipulation	 45
4.3 Writing, deleting, updating	 47
4.4 What have I done?	 48
4.5 Searching, sorting, and cataloging	 49
4.6 Investigating images	 51
4.7 Dangerous system procedures	 52

5 Changes from Version 0.1	 53

6 Appendices and Tables	 59
6.1 Appendix on D_HOLDER.DOC	 59
6.2 Appendix on D_HOLD.DOC and DISRHEAD.DOC	 60
6.3 Appendix on C_SYSTEM	 60
6.4 Appendix on HMC_SOFT header entries	 60
6.5 Appendix on IMP_SOFT header entries	 65
6.6 Appendix on SNR_SOFT header entries	 69

7 Documentation of Individual Routines	 74

The DISR database system (DISRSOFT) will be used to retrieve, process, and study calibration and flight data from three experiments (DISR, IMP, and HMC).  This document will describe the DISRSOFT database system, the hardware/software required, the header and file structure, and the storage requirements.  It will also attempt to describe everything necessary for the calibration of DISR and IMP data.  This is a living document and will be expanded and modified when any changes to the system are made.

 
There are three countries involved in the DISR project each with different hardware requirements or restrictions.  Specific image processing software has been selected to minimise compatibility problems between machines.  The software package selected to perform the task of serving the DISR project is IDL (Interactive Data Language).  This software offers low level mathematical and graphics routines which can be simply and rapidly combined to produce procedures.  These procedures can take into account the specific nature of DISR and IMP and allows the rapid reduction of these images into scientifically valid data.  The IDL version numbers on which DISRSOFT has been tested are Versions 3.1, 3.5.1, and 3.6.1.  While IDL supports some cartographic and mapping procedures, it is envisaged that after the calibration process has been completed, the output data will be converted into a format readable by packages such as PICS (available from U.S. Geological Survey) or VICAR (available from JPL).  This concept would avoid the prospect of "re‑inventing the wheel" because these software packages already possess quite sophisticated cartographic procedures.  The respective merits of these packages will be tested at a later date.

Several hardware/software combinations will be supported by DISRSOFT.  To be supported the machine must be capable of running IDL.  This can be verified by contacting Research Systems Incorporated, Denver, Colorado.  There are one or two features of IDL which are specific to either UNIX, VAX/VMS, or Windows operating systems.  In general, DISRSOFT programs will NOT use these features hence enhancing compatibility.  In the case of I/O, it is not possible to make platform independent software without incorporating case statements which branch depending upon the operating system.  The reading and writing of DISRSOFT images will require branching of this sort but this should mostly concern the "system" section of the software.  It is strongly discouraged elsewhere.

The DISR software will be written at MPAE on 486 50MHz PCs.  The machines require at least 8MB of memory and Windows 3.1 or later.  We are currently using TIGA extended VGA cards (1280 x 1024) but provided that Windows supports the graphics card, IDL and DISRSOFT should not experience problems.

New versions will be tested at MPAE on an HP series 700 machine and a DEC ALPHA.  We do NOT envisage testing on other machines at present for cost reasons although a Mac may be procured at some point for test purposes.  However, we will be available to give assistance to users working on other machines provided they are fully IDL compatible.  Currently, the system appears to be running successfully on an HP 735.  Testing on a DEC ALPHA machine has revealed a probable IDL bug which means that at present D_WRITE cannot be used on this machine while running IDL version 3.1.  The bug has gone away under IDL 3.5.1.  There is also an IDL bug in the text widgets on all platforms under IDL 3.5.1 which makes Version 1.0 or earlier versions of DISRSOFT crash during text widget operations.  In Version 1.1 and later, this problem has been solved.

Version 1.6 supports Windows, HP-UX, Alpha/VMS, Alpha/OSF, Sun, and Mac.

The decision taken at the beginning of 1994 to use DISRSOFT for the reduction of IMP data has meant an expansion of the original DISRSOFT system.  In addition, the original Halley Multicolour Camera database (written by DLR and upon which the concepts for DISRSOFT are based) has become out of date because it was written in IDL version 1.0 for a microVax II system.  The requirement for new databases for IMP and HMC has pushed us to expand the concept of DISRSOFT to incorporate data other than DISR data in the system.

We are currently supporting an HMC database (HMC_SOFT), a database for ground-based observations and HST WF-PC data (SNR_SOFT), and a database for IMP (IMP_SOFT).  Further expansion may also be possible.  This document will describe the features of DISRSOFT for DISR.  Differences between the databases for HMC and IMP will be noted.

The programs and data need to be stored in a tree of directories for clarity.  All programs and data will be found under a directory called CAL_SOFT which should be at the main level of the machine.  The directory structure is then as shown in .  Sub-directories of DISRSOFT are covered in the remaining points in this section.

2 Directory structure of DISRSOFT

Each database has its own directory (e.g. IMP_SOFT) underneath CAL_SOFT.  The structure of the database beneath this database directory is identical to that shown for DISRSOFT in the figure.  At MPAE only, a database directory called DISRTEST will be created.  All development work towards a new version of DISRSOFT will be made on programs contained in DISRTEST.  When a new version DISRSOFT is released the programs in DISRTEST will be installed under the DISRSOFT directory, thereby maintaining a standard system.  A sub-set of the programs will be installed in the other directories.  Where possible the other databases will use the same routines as the DISR database.  For the system, we envisage  80% of the code for DISR being useful for the other databases.  For calibration the percentage will be much less.

All programs stored in the directories of the DISRSOFT system will be in lower case where the system is case sensitive.

This directory contains a startup file for the system.  This file can be called by the IDL startup procedure so that the basic system (including all files in the SYSTEM sub-directory) is available to the user without compilation as soon as the user starts IDL.  Examples of how this can be done for the PC and for HP-Unix are shown in the README directory (see below) as files START_UX.PRO and START_PC.PRO.  Consult the IDL manual for details as to how these files can be assigned to the logical variable IDL_STARTUP.  The startup also modifies the path to allow other procedures to be compiled without a directory specification.

Filenames:

	D_DEFKEY	A program which can be used to define function keys on the PC and on xterms.  This cannot be used for hpterms and Dec Alpha systems (unfortunately!).
	D_START	The system startup procedure.
	D_CHGSYS	A low level program used by D_START to modify which database will be initialised during startup.
	D_CHGLCL	A routine which modifies the path so that the directory called 'local' can be replaced by another directory name in the path.

This directory contains the software for the system.  The system allows users to read and write images to disk, extract and insert values into the header, catalogue, sort, and search on headers, and provides an on-line help facility.  Lower level routines for modifying the system are also here.  Dont screw around with these unless you really know what you are doing!

Filenames:
	D_ALLSET	gets the DISR set id and set codes in a table (DISR ONLY)
D_APPROC	append process to header
	D_CAT 	a widget-driven cataloging facility
	D_CCDSEG	shows the section of the CCD from which the image came (DISR ONLY)
	D_CO_FIL	to fill the correct CCD coordinates into the coordinate section of the header depending upon the image type (DISR ONLY)
D_DELIM 	delete image
	D_EXIST	allows the user to determine whether a header conforms to a DISRSOFT standard and can also be used to test whether pixels exist or not.  Good for error checking in programs
	D_HCONT	reads all headers in a nametable and extracts two entries
D_INSERT 	insert value into header
D_IRREAD	IR data set read    (DISR ONLY)
D_IRWRIT	IR data set write    (DISR ONLY)

	D_LOOK	an image browser for several different formats
	D_MKLIST	make ordered lists of several parameters from a list of data files.  An interactive cataloguing program.
D_READ	read image
D_RHEAD 	read header
  	D_RNAME	read a nametable
	D_SEARCH	a widget-driven search program for DISRSOFT headers, this program can also work non-interactively within a procedure
	D_SETID	determines the data set id of a data set name    (DISR ONLY)
	D_SETCOD	determine the data set id and the data set name from the code which can be found as the 8th character of the filename     (DISR ONLY)
D_SHEAD	show header
	D_SORT	sort a nametable of images based on the contents of a header entry
D_SPROC 	show processing history
D_TEMPL 	header template
D_UPIM 	update image
D_VALUE 	obtain value from header
D_WHELP 	on-line widget driven help facility
	D_WINSER	widget driven D_INSERT
	D_WNAME	write a nametable
	D_WREAD  	widget driven reader of data files
D_WRITE	write image
	D_WSHEAD	widget driven version of D_SHEAD
	D_WWRIT	widget driven writer of data files

lower level utilities not normally for the user
D_HLINE	headerline construction 
	D_MKCOMM	a program which re-constructs the common blocks needed to run DISRSOFT if changes are made.  This should not be used by normal users.
	D_NEWENT	a widget driven program which allows you to define a new single header entry in the system or to modify an old one.  Although there are error checks, this program must be used very carefully as the DISRSOFT can be corrupted by reckless use.
	D_PARSE	this is a routine which allows you to enter a DISRSOFT directory and filename and returns the full path under the current operating system.  It is useful for limiting the number of changes you have to make when you port DISRSOFT to a new operating system.
D_TRANSL	determine names and formats of header elements including pointers

Future developments

	D_ISRSFT	This will be a widget-driven interface incorporating as many of the above routines as possible.  A prototype is currently available so that you can see what you are going to get!!  You should then be able to manipulate data without going to the command line.     (DISR ONLY)
D_CUTNAM	truncates all data filenames in a directory to a 3 letter extension (used for VAX and HP to allow transfer to PC) 

In general we will avoid the use of common blocks in IDL.  However, this will not be possible in some cases (particularly widget and header control applications).  All variables in common blocks will begin with either "C_" or "H_" and therefore users should NEVER adopt a variable name beginning with these character combinations.  Common blocks may be included in user defined procedures so that names of header variables can be used inside procedures.  Consequently in the COMMON directory each common block can be found in two forms, once as an actual procedure (extension .pro) and once in the form of an include file (extension .inc).  When writing a procedure, users may include the full common block by using the @ sign.

Example:

This program takes a DISRSOFT header as input and returns the contents of the H_FILENAME entry as output.

PRO DOG_BISCUIT,HEADER,PARAMETER
@c_header.inc
PARAMETER=D_VALUE(HEADER,H_FILENAME)
RETURN
END

Note that the include file is in lower case.  This is to conform to the definition that filenames should be in lower case where the system is case sensitive and therefore maintains compatibility with the UNIX version of DISRSOFT.

At some point you may want to look in this directory and will see some files beginning with the characters O_.  These files are backup files of the main system.  Backups are created by the program D_NEWENT when it modifies the DISRSOFT header structure.  They should be left alone!!

Finally, if the C_SYSTEM common block has been corrupted you may try to run c_system.pro from the main level to re-initialise it. This should only be used as a last resort and even then it might not save you!

Filenames:
	C_CCD	common block used for HMC CCD data (HMC ONLY)
	C_COLORS	the colors include files defines a common block called COLORS.  This breaks the DISRSOFT convention but for a reason!  IDL has its own COLORS common block.  Thus when you use C_COLORS.INC you are compatible with the IDL common block so that changing colour tables with IDL routines will also modify the DISRSOFT colour common block.
	C_DISPL	common block used for displays (HMC ONLY)
	C_HEADER	translation of header numbers to logical names
	C_SYSTEM	system parameters (machine type etc.)

This directory will contain auxiliary data which may be of assistance in the evaluation of DISR data.  One example might be the solar flux.

Filenames:

This directory contains files which control the system

a) the header description accessed by the D_SHEAD routine,
b) the default formats for the header structure,
c) files describing the header structure,
d) files accessed by the on-line help facility
e) files used by the anomaly checker for verification purposes
f) a file relating DISR data set id to a text string
g) When the post-processor is run a file called r_master.doc will also be created in this directory.  This will give the master times for how long the experiment has been operated in total, how long the lamps have been switched on, and how many shutter cycles have been performed.  To set these values back to zero for the post-processor, simply delete this file.  

Backup files of the main system can be found here with the characters O_ at the start of the file name.  Backups are created by the program D_NEWENT when it modifies the DISRSOFT header structure.  They should be left alone!!  Note that a backup copy of the post-processor resource tracker ("o_master.doc") is generated by the post-processor whenever a new run is performed.  This is also present in this directory.

Filenames:

	D_HOLDER.DOC	this holds formatting and header definition information for the system
	D_HOLD.DOC	documentation for the D_SHEAD routine
	DISRHEAD.DOC	long version of D_HOLD.DOC for information
	DATASETS.DOC	a table used for the D_SETID routine which tells you the data set id for each data set    (DISR ONLY)
	D_ANOM.DOC	the datafile for the anomaly checker
	R_MASTER.DOC	resource tracker master file (DISR ONLY)

This directory contains all documentation for DISRSOFT.

a) examples of IDL_START files for Unix, Windows, and VMS
b) a POSTSCRIPT version of this document
c) an RTF version of this document
d) documentation on the released versions of DISRSOFT
e) documentation templates for user-defined procedures

Filenames:

	VERSIONS.REL	documentation for released version
	DISRDOC.PS		this documentation in POSTSCRIPT
	START_PC.PRO	example PC startup file
	START_UX.PRO	example HP startup file
	TEMPLAT.PRO	DISRSOFT documentation and programming standard template
	TEMPLAT2.PRO	useful template for CASE statement for datatypes

This directory will contain a series of tools which users might find useful.  These will, in general, do lower levels tasks such as finding the brightest point in an image etc.  The programs should not usually be DISR specific.  If the concept of the program is to operate in some way on an image then the program should be written so that it performs the task on any image.  Users are free and encouraged to contribute to this directory by forwarding their programs to MPAE.

Filenames:

	T_ADDIMS	add, average, or subtract two images of differing size and correlation position 
	T_APLPSF	apply a Gaussian PSF of specified FWHM to an image
T_ARC	draws an arc
T_ARROW	draws an arrow
T_BP	finds the brightest point in an image
T_BYTSPL	byte scales an image between variable upper and lower bounds
	T_CARTES	back transform from polar to cartesian coordinates
T_CIRCLE	draws a circle
T_COLBAR	draws a colour bar
	T_COLROW	widget driven profiles along rows or columns only
	T_COLSEP	a colour separation program which plits an image into its r,g,b components
	T_CORREL	an FFT sub-pixel correlation routine for accurate overlaying of images
T_CROSS	draws a cross
	T_CUTPST	a widget-driven routine which allows you to modify byte arrays using a cut and paste buffer
	T_DIALOG	a simple dialogue box widget
	T_GETDIR	determines all the directories in the current directory
	T_GETFIL	determines all files in the current directory
	T_HELP	a routine which simplifies the construction of a help box for widget routines
	T_HEXINT	converts hex strings into long integers
	T_IMAGE	trial version of a program simulating the IMAGE program on the Mac
T_INTERP	interpolation routine
T_LAGR	four-point Lagrange interpolation
	T_LEAST	linear least squares fitting routine
	T_LOMMEL	the normalised surface brightness according to a Lommel-Seeliger law
T_MARK	marks a point on an image with its value
	T_MEANS	a widget driven program which takes an image as input and allows you to calculate the mean and slope of sub-sections of the array interactively
	T_MIEPHA	particle phase functions from Mie theory
	T_MINNAE	computes normalised Minnaert functions
T_MISSED	fills missed (i.e. set to -32768) pixels
	T_MJD	convert a time to modified Julian date
	T_MKDIR	a program to make a directory from inside IDL independent of the operating system
	T_MOSAIC	an interactive mosaic program
	T_MULFIT	fitting routine for several different type of fits
	T_MULWHE	finds which elements are equal to values in a vector of other values (i.e.  WHERE(ARRAY EQ VECTOR)).
T_NEAREL	finds the element in an array nearest to your value
	T_NUMERC	determines whether a string can be converted into an integer or a floating point number.  Useful for controlling errors when trying to convert strings into numbers.
	T_POLAR	polar coordinate transform
	T_POSIT	simple program for determining position and value on an image
T_PROFIL	creates and displays a profile  (BECOMING OBSOLETE)
	T_PSSET	A widget interface for the PostScript device driver.
	T_RESWIN	restores the contents of a window saved by the program T_SAVWIN
	T_ROTATE	complete a rotation about an arbitrary axis
	T_SAVWIN	saves the contents of a window in XDR format.  The routine also save the colour table of the window.  Useful for saving displays you have worked hard to create.  The contents of the window can be restored using the T_RESWIN procedure
	T_SIGMA	computes the mean, standard deviation, and variance of an input array
T_SIMPSO	Simpson's rule integration
	T_SEPARA	this routine determines whether the input character is a UNIX, WIN32, or VMS directory separator
	T_SLWBOX	a program which should be called from a widget providing a rubber-band cursor for defining a box interactively
T_STRREV	reverses a string
	T_SUBSFT	sub-pixel translation of arrays
	T_SUBMAX	a program to determine with sub-pixel accuracy the maximum in an image (used by T_CORREL)
	T_SYMBOL	offers the user more symbols which can be loaded into the user-defined symbol of IDL to give better plots
	T_TIMMJD	convert the output from SYSTIME() to modified Julian date
	T_TREE	procedure which determines all sub-directories of the current directory
	T_TVSURR	draws a surrounding box on the current graphic device
	T_UNIVEC	determines unit vectors from azimuth and declinations and vice versa
	T_VALDIR	determines whether the input directory exists or not (NOT YET MAC COMPATIBLE)
	T_WEXTRA	widget-driven extraction of sub-array from original array
	T_WPROFI	replacement for T_PROFIL.  This routine allows you to create and display profiles on an image in a widget environment.  Output to PS available.
	T_WIDGET	simple function to test whether widgets are available or not
	T_ZOOM	simple routine providing a zoom facility using the CW_ZOOM compound widget 

This directory will contain programs which will help optimise interpolations needed for geometrical transforms of data.  In order to preserve as much as possible the high frequencies in an image, interpolation between data points should only occur once.  Replacing an image with the values of its pixel address allows one to manipulate the addresses as if they were the pixels.  The pixel address matrices have no high frequencies so that bilinear interpolation is almost perfect.  After several manipulations, the original image can be transformed to the final form using just one interpolation.
 
Filenames:
	XY_BILIN	bilinear interpolation for the XY scheme

This directory contains software designed to verify that the header and pixels of DISR images are correct and apply the post-processing tools to input DISR data.  Verification will identify any problems in the image structure and provide checks on certain header parameters to determine whether they fall within certain limits.  Programs are also available which produce time-ordered lists of header information in DISRSOFT files.  Resource tracking programs are also present.  In general, the main program D_PSTPRC should perform all tasks calling the subroutines as it needs them.  The routine requires the name of a directory in which DISRSOFT files are stored and a directory (not yet existing) where it can put verified data, the lists and the tables it generates.

Verification should be used as a first step in the calibration of DISR data.

Filenames:
				
	D_ANOM	an anomaly checker to determine whether entries are within limits    (DISR ONLY although may be possible to use with other databases)
	D_CHKSET	this routine looks into a directory and its sub-directories for specific data sets and creates a listing (DISR ONLY)
	D_DSRTIM	checks how many time data sets have been produced (DISR ONLY) 
	D_INCCAL	Program to put calibration file info into a header (DISR ONLY)
	D_LMPTIM	this determines the length of time each of the lamps has been on by analysing Lamp data sets  (DISR ONLY)
	D_PSTPRC	the main post-processor program    (DISR ONLY)
	D_PSTDIR	a simple routine which generates the directory tree in which data will be transferred after the post-processor is applied    (DISR ONLY)
	D_RDCAL	reads the DISR calibration log file into a structure (DISR ONLY)
	D_RDOGSE	Program to read the OGSE log file for DISR (DISR ONLY)
	D_RESTAB	a procedure which generates the DISR resource tracking tables  (DISR ONLY)
	D_SHTTIM	a routine which determines the number of IR shutter cycles performed from a list of files  (DISR ONLY)
	D_TOLIST	a routine which generates time ordered lists as required by the post-processor    (DISR ONLY)

This directory will contain software designed to perform the radiometric calibration of DISR data.  Radiometric calibration includes :

a) bias subtraction
b) dark current removal
c) flat-fielding (or responsivity) correction

Filenames:
	D_DRKCAL	a program which obtains the dark matrix at the specified temperature and exposure time extrapolated from data held in the DATA/DARK directory.  This program gives mean results to better than about 0.2 DN mean background at present  (DISR ONLY).
	D_DRKSUB	a routine which subtracts a dark matrix from an image (DISR ONLY).
	D_DRKVAL	a program which compares a DISRSOFT image obtained with 0ms exposure time with a long exposure image on the same CCD and output the dark current generation for several areas of the CCD      (DISR ONLY). 
	D_REPAIR	initial version of Rainer Kramm's program which repairs sensor defects    (DISR ONLY)

This directory contains programs for the restoration of images.  Images may have missed pixels or spikes introduced by some external influence.  Coherent noise removal procedures and programs to correct the electronic shutter effect may also be present.  The procedures herein will seek to correct these errors.  This directory may also contain programs used to deconvolve the instrument point spread function.

Filenames:

Future developments:
D_MISSED	fill missed pixels
D_SPIKE	remove spikes

This directory contains programs which can be used to simulate expected effects on the CCD.  Thus programs which simulate the effects of the electronic shutter, bad charge transfer efficiency etc should be included in this directory.

Filenames:

S_NOISIM	simulation of random noise    (DISR ONLY)
S_COISIM	simulation of coherent noise    (DISR ONLY)
S_SHTSIM	simulation of electronic shutter effect    (DISR ONLY)
S_CTESIM	simulation of charge transfer efficiency effects
S_CTE_HV	simulation of cte in both horizontal and vertical directions
	S_FALSE	false data generator for DISR data sets (DISR ONLY)

Future developments:
S_RESSIM	responsivity simulation    (DISR ONLY)
S_DARSIM	dark current simulation    (DISR ONLY)
S_LAYSIM	crude model of expected intensity on chip at specified times    (DISR ONLY)

This directory contains programs needed to enhance an image.  In general, these programs will contain non-linear filters which should NOT be applied to images when absolute units of intensity are required.  The programs will enhance visualisation using, for example, Wiener filters and/or MaxEnt.

Filenames:

	D_FILTER	general low pass/high pass FFT filters
	D_WRAP	wrapping function for D_FILTER

This directory will contain programs to make geometrical corrections to the observational data taking into account the footprint that the imagers make on the surface of Titan.

Filenames:

This directory will contain programs designed to convert DISR images into absolute units of intensity.  In addition, programs will be available to provide wavelength calibration for the spectrometer data. 

Filenames:

It is envisaged that correlation and registration of images with a view to creating mosaics will be performed using software from either USGS or JPL.  This directory will be used to house IDL programs designed for this purpose should resources allow.  This remains a low priority item.

Filenames:

This directory will contain programs designed to output a DISR image in other formats.  It is currently thought that three formats will be supported

a) FITS
FITS routines have now been implemented.  The most important routines are

	F_READ_F	a function to read FITS
	F_READ	which reads a FITS image and puts it into a DISRSOFT type format
	F_WRITE	write a DISRSOFT image away in FITS format.

b) PICS

c) VICAR

Filenames:

This directory contains a series of batch files for taking a data set from one processing level to another without user intervention.  These files may be particularly useful for quick-look.  The directory will also contain low level DOS programs ( extension .BAT) which may be used to install DISRSOFT, copy DISRTEST to DISRSOFT, and copy DISRSOFT to floppy (with compression) for shipping to other users.

Filenames:
COPYDISR	copies DISRTEST to DISRSOFT directory
	COPY_HMC	copies DISRTEST system files to HMC_SOFT directories at Lindau only
COPYPCHP	copies DISRTEST to the HP directory at Lindau
	D_GETPRC	this routine only works on the PC at present but obtains all the header templates of current DISRSOFT routines
INSTALL	installs DISRSOFT on a PC hard drive from floppy
STORDISR	stores DISRSOFT on floppy

This directory will contain a package designed to provide a widget interface to DISRSOFT.  Widgets are now available under PC IDL and should work on all platforms.  The surface will provide simple plotting tools and displays to allow inexperienced users to see data without having to learn details of the system. 

Filenames:

This directory is the top level directory for all DISR data files which will be used in calibration.  Each data set will have one principle purpose.  The following purposes are so far foreseen,

a) Test CCD (T)
b) Dark current subtraction (D)
c) Response correction (R)
d) Calibration testing (C)
e) Flight (F)

The purpose will define the name of a sub-directory to DATA (see below).  Within that sub-directory each data set will be allocated its own individual directory.  The name of that directory will be an 8 letter code.
The first letter will specify the purpose (see letter after defined purposes above)
Letters 2-7 will be the date in the form 920228 (for 28 Feb. 1992)
Letter 8 will indicate the site (A - MPAE, U - UoA, M - MMC, P - OP) 

Filenames:

 TESTCCD

 DARK

 RESPONSE

 CALIB

 FLIGHT

The main level directory of EGSE generated data can take any position in the host computer.  It is expected, however, the underneath this main level directory a well ordered tree of directories exist.  Each data set has its own sub-directory.  The names should be lower case and should not exceed 8 letters long (the famous DOS constraint!).  The names should be the same as the names of the data sets found in DATASETS.DOC in the DOC directory except that all spaces are removed, the length is truncated to eight characters, and is in lower case.  The allowed directory names are as follows :-

message
time
sunsenso
housekee
lamp
descent
calibrat
visible
image
strip
solaraur
darkcurr
fullccd
ir
violet
irshutte
dcs
heater
callamp
surfacel
sunlamp
badram
badeepro
memorydu

It is important that this structure is maintained because the post-processor needs to know where to look for certain data sets.  The post-processor recreates this structure in a new main level directory (specified by the user) but creates only those directories which will contain pixel data (e.g. the housekee directory will not be re-created).  The post-processor creates an additional directory called timelist in which the time-ordered lists will be stored.

All data will be stored using "XDR" (eXternal Data Representation).  XDR provides portability between machines and corresponds to a VAX stream file. The portability of DISR header and pixels in one file will be verified between VAXs, PCs, and UNIX (HP) machines. It should be noted that transfer of files between PCs and VAXs using the PCSA software provided by Digital corrupts the XDR files to make them unreadable.  Transfer between PCs and VAXs should therefore be performed using standard file transfer systems such as NFT (Network File Transfer).  Simulated DISRSOFT files have been successfully transferred between PCs and VAX machines using the NFT command  COPY/BLOCK.  Transfer of files between UNIX and PCs have been successfully tested with no problems using FTP in binary mode.

DISRSOFT will store header and pixel information as one file per image.  The file will begin with header information and will be completed with the associated pixels.  The header will contain all the information needed to read the file completely and correctly.

A header will be a string array made up of individual entries.  One string array element for each entry.  Entries can be either single entries, multiple entries, or pointers (see below).  The header is split into two parts.  The first part comprises the template section.  The second part is referred to as the extendable section.  The total length of the header and the dimensions of the accompanying image will appear near the beginning of the header.

 Template section

The template section is not restricted in size.  It is possible to calculate its size from information at the top of header.  Each entry in this section must have a logical name which must be entered in the database and in the appropriate common block so that when the header is printed the name will appear adjacent to the appropriate entry.  It is also possible to use the logical name of the entry, in addition to its element number in the header array, to access the value of the entry.  In the initial development, the template section will have a length that is greater than the number of entries required by the users.  It is envisaged that users will make requests to MPAE to assign an entry to a specific task.  (For example, UoA may request that entry 123 is permanently assigned to showing the HK frame counter).  This will then be controlled by MPAE so that in the next release the requests are complied with.

Example:
UoA may request that entry 123 is permanently assigned to showing the HK frame counter with a format of I4.  They will pass this request to MPAE where it will be verified that that entry is free.  The system will be updated and a logical name (e.g. H_HKFR) will be given to the entry.  A new version will then be provided.  Subsequently, users will be able to type 

PRINT, D_VALUE( HEADER,H_H_HKFR)

and the system will return the value from the entry if it exists.

In the event that all positions in the template section are filled the database system will be able to understand entries commanded outside the header template IF THE VALUE HAS BEEN ASSIGNED.  The database software thus will be designed to cope with a variable template section.

 Procedure for new header entry

To insert a new header into the system, the following tasks have to be performed.

a)  Enter the new entries characteristics in D_HOLDER.DOC in the directory DISRSOFT/DOC.  The entry name must be entered in column 2.  Column 3 indicates whether the entry is a single, multiple, or pointer entry.  Column 4 indicates the number of entries (this is for multiple entries).  Column 5 indicates the data type and column 6 indicates the default format.  The crosses indicate which data set type the header entry will be used for normally.  Note that this is for the help facility provided by D_WHELP.
The crosses begin at character 52 in the line.  The crosses then correspond to the order of the data sets given in DATASETS.DOC in the DOC directory.  Currently, a cross at character 52 indicates that this header entry is supplied by the message data set, character 53 corresponds to the time data set and so on.

b)  Update D_HOLD.DOC and DISRHEAD.DOC in the directory DISRSOFT/DOC.  These files are used as templates for the D_SHEAD procedure.

c)  Modify the common block definitions in the files DISRSOFT/COMMON/C_HEADER.PRO and DISRSOFT/COMMON/C_HEADER.INC

A program exists called D_MKCOMM in the SYSTEM directory which updates these files automatically.  You must enter DISRSOFT, edit the D_HOLDER.DOC program, call D_MKCOMM, and then exit IDL and re-enter for the new common blocks to be correctly recognised.  D_MKCOMM requires a password.  This is more to indicate that the program is dangerous and should be used with real caution rather than a protection device.  The password can be found easily if you are determined!

d)  Document the modifications in this document!

The whole process can be simplified by the use of D_NEWENT in the system directory.  This is a widget driven program which can be used to insert new single entries into the database system.  The program uses a back-up system to provide a safety net if you screw up.  There is error checking but it is not possible to do this completely because of the way the database is structured.  However, for most purposes this routine should be adequate.  You can edit all entries from entry 13 onwards (the system entries from 0-12 have to be protected!).  Watch out particularly for the default formatting of the new entry.  This is not checked for its consistency (because it's damn hard to do)! 

 Extendable section

The extendable section will contain data on the processing history of the image and will have at least two fully extendable areas for data not to be included in the template section.  All extendable areas will be accessed by pointers.  It will not be necessary for the user to know where the extendable areas begin or end.

 Current DISR header

The allocation of entries in the header at present is as follows,

0    H_TYPE              Header type  (D=DISR, I=IMP)
1    H_DIRECTORY         Directory file last stored in
2    H_FILENAME          Filename file was stored as
3    H_FILETIME          Time file was last written by D_WRITE
4    H_LENGTH            Length of header string array
5    H_DIMENSION         Number of dimensions in data
6    H_XSIZE             Number of columns
7    H_YSIZE             Number of rows
8    H_ZSIZE             Number of images
9    H_DATATYPE          Type of data
10   H_EXTENSION         Position in header where extension area starts
11   H_EXTRA             Position in header where extra area starts
12   H_PROCESS           Position in header where processing area starts
13   H_PURPOSE           Purpose of observation
14   H_SUBJECT           Subject of observation
15   H_DATE              Date observation made
16   H_ENGINEER          Engineer responsible
17   H_SITE              Site of observation
18   H_SET_NAME          Text description of data set
19
20
21
22   H_CCDTEMP           On chip CCD temperature in [K]
23   H_REF_TEMP          CCD electronics reference temperature (MPAE)
24
25
26
27
28
29
30   H_DETECTOR          detector type (CCD, IR, PHOTOMETER)
31   H_SENSOR_ID         sensor id number
32
33
34
35
36   H_EXPTIME           integration time [ms] for CCD measurement
37   H_IMAGE_TIME        start time of exposure
38   H_ABSCAL            absolute calibration factor used
39
40
41
42
43
44
45
46
47
48   H_AXIS_EL           elevation of DISR spin axis
49   H_AXIS_AZ           azimuth of DISR spin axis
50   H_COORD_XL          image coordinates (lower x)
51   H_COORD_YL          image coordinates (lower y)
52   H_COORD_XU          image coordinates (upper x)
53   H_COORD_YU          image coordinates (upper y)
54   H_FILTER            filter in use
55   H_GAIN              gain factor (MPAE)
56   H_DC_OFFSET         DC offset (MPAE)
57
58
59
60   H_TIMING_GEN        timing generator code (MPAE)
61   H_CAMERA            BB/EM/FM model
62   H_VACUUM            vacuum or not (yes or no)
63   H_OPTICS            additional optics on bench (MPAE)
64   H_TESTLAMP          external test lamp (MPAE)
65   H_SHUT_TIME         opening time of CCD test shutter (MPAE)
66   H_LED_TIME          LED on time (MPAE)
67
68
69
70
71
72
73
74
75
76
77
78
79
80   H_GSE_REV           GSE revision creating data set
81   H_CONFIG_FILE       configuration file associated with data set
82   H_TEST_LOG          test log filename generating data
83   H_REC_BEG           first record of this data set in test log
84   H_REC_END           last record of this data set in test log
85   H_PIXEL_UNITS       units of pixels
86   H_SET_ID            data set id
87   H_SET_NUMBER        sequential number of this data set
88   H_MISSION_TIME      mission time in seconds
89   H_CYCLE_NUMBER      sequential numbering of cycles
90   H_CYCLE_TYPE        cycle type
91   H_SCEN_STEP         cycle criteria table entry number
92   H_SPM_FLAG          spectrophotometric flag
93   H_CCD_MEAS          number of CCD sets performed during cycle
94   H_IR_MEAS           number of IR sets performed during cycle
95   H_VIOLET_MEAS       number of violet sets performed during cycle
96   H_MEAS_TYPE         measurement type
97   H_AZIMUTH           azimuth at start of cycle
98   H_ALTITUDE          altitude at start of cycle
99   H_SPIN              spin rate at start of cycle
100  H_TARGET_AZ         target azimuth for measurement
101  H_ACTUAL_AZ         actual azimuth for measurement
102  H_LAMP_STATE        cal and surf lamp status
103  H_IR_STATUS         IR hardware status word
104  H_IR_FLAGS          IR sampling and compression flags
105  H_IR_CHP_TMPB       IR chip temperature (start)
106  H_IR_CHP_TMPE       IR chip temperature (end)
107  H_PRECHARGE         Average precharge voltage
108  H_IR_COL_TIME       IR collection time [ms]
109  H_NUM_ROT           number of region/rotations (IR)
110  H_NUM_REGIONS       number of regions (IR)
111  H_DC_OFFSET_U       DC Offset voltage for ULIS
112  H_DC_OFFSET_D       DC Offset voltage for DLIS
113  H_UIR_TGT_PRC       target %age for ULIS
114  H_DIR_TGT_PRC       target %age for DLIS
115  H_UIR_PRCTILE       %ile point used for ULIS
116  H_DIR_PRCTILE       %ile point used for DLIS
117  H_CCD_STATUS        CCD hardware status
118  H_DCS_STATUS        DCS hardware status
119  H_CCD_FLAGS         CCD flags
120  H_PROC_FLAGS        CCD processing flags
121  H_NUM_COL           number of columns transmitted
122  H_NULL_PIXEL2       sum of null pixels (col 2)
123  H_NULL_PIXEL3       sum of null pixels (col 3)
124  H_CCD_TGT_PRC       target %age for CCD
125  H_CCD_PRCTILE       %ile point for CCD
126  H_STP_CNT_COL       strip centre column
127  H_STP_FST_COL       1st column of strip
128  H_CAL_TMP_SORS      cal. source voltage
129  H_CCDLUG_TEMP       CCD thermal lug temperature [K}
130  H_STRAP_TEMP        thermal strap temperature
131  H_OPTICS_TEMP       conduit housing temperature
132  H_VIOLET_TEMP       violet detector temperature
133  H_SH_AUX_TEMP       sensor header aux board temperature
134  H_SH_BOX_TEMP       sensor header box temperature
135  H_EA_BOX_TEMP       EA box temperature
136  H_AUX_BRD_VOLT      divided 12V in volts
137  H_CPU_BRD_VOLT      divided 5V in volts
138  H_ADC_OFFSET        0V input; ADC offset
139  H_ADC_GAIN          2.5 input; gain of ADC
140  H_DISPQ_SIZE        max. dispatcher queue size
141  H_ALRMQ_SIZE        max. alarm queue size
142  H_TLMQ_SIZE         max. TM queue size
143  H_SCIPRQ_SIZE       max science processing size
144  H_STACK_SIZE        max stack size
145  H_CAL_SCENARIO      cal. scenario number
146  H_CCD_REP           CCD cal. repetition number
147  H_IR_REP            IR cal. repetition number
148  H_VIOLET_REP        violet cal. repetition number
149  H_SHUTTER_REP       shutter test rep. number
150  H_SHUTTER_CYC       number of shutter cycles
151  H_DCS_REP           DCS cal. repetition number
152  H_COMP_RATIO        compression ratio
153  H_HEATER_REP        heater test rep. number
154  H_HEATERS           which heaters
155  H_CAL_LAMP_REP      cal. lamp repetition number
156  H_NUM_BINS          number of IR bins for data collection
157  H_SURF_LAMP_REP     surface lamp rep. number
158  H_SUN_LAMP_REP      sun sensor LED rep. number
159  H_CAL1_VOLT1        voltage on cal. lamp 1
160  H_CAL1_CURR         current on cal. lamp 1
161  H_CAL2_VOLT1        voltage on cal. lamp 2
162  H_CAL2_CURR         current on cal. lamp 2
163  H_CAL3_VOLT1        voltage on cal. lamp 3
164  H_CAL3_CURR         current on cal. lamp 3
165  H_SURF_VOLT1        voltage on surface lamp
166  H_SURF_CURR         current on surface lamp
167  H_DCS_TST_STAT      overall DCS test status
168  H_DCS_SLF_STAT      DCS self test status
169  H_DCS_SW_STAT       DCS s/w test status
170  H_SUN_LED_VLT1      voltage on Sun sensor LED
171  H_SUN_LED_CURR      current on Sun sensor LED
172  H_SUN_RESP          Sun sensor reading with LED on
173  H_NUM_HEAT          number of heaters tested
174  H_NUM_TRIPLET       number of sun triplets in data set
175  H_NUM_TIME_PAIRS    number of time data pairs
176  H_DUMP_START        address of first word in dump
177  H_DUMP_LEN          number of words in dump set
178  H_DUMP_FLAG         packing flag
179  H_MESSAGE           message type code
180  H_MESSAGE_ID        additional information code
181  H_NUM_BAD           number of bad ranges in RAM or EEPROM
182  H_LOTS_BAD          flag ‑ lots bad RAM or EEPROM areas
183  H_CCDTEMP_R         Raw CCD temperature
184  H_EXPTIME_R         Raw exposure time reading
185  H_MISSION_TIME_R    Raw mission time reading
186  H_AZIMUTH_R         Raw azimuth reading
187  H_ALTITUDE_R        Raw altitude reading
188  H_SPIN_R            Raw spin rate reading
189  H_TARGET_AZ_R       Raw target azimuth
190  H_ACTUAL_AZ_R       Raw actual azimuth
191  H_IR_CHP_TMPB_R     Raw IR chip temperature start
192  H_IR_CHP_TMPE_R     Raw IR chip temperature  end
193  H_PRECHARGE_R       Raw average precharge voltage
194  H_IR_COL_TIME_R     Raw IR collection time used
195  H_CAL_TMP_SORS_R    Raw cal. source voltage
196  H_CCDLUG_TEMP_R     Raw CCD thermal lug temperature
197  H_STRAP_TEMP_R      Raw strap temperature
198  H_OPTICS_TEMP_R     Raw conduit temperature
199  H_VIOLET_TEMP_R     Raw violet temperature
200  H_SH_AUX_TEMP_R     Raw SH aux board temp
201  H_SH_BOX_TEMP_R     Raw SH box temperature
202  H_EA_BOX_TEMP_R     Raw EA box temperature
203  H_AUX_BRD_VOLT_R    Raw divided 12V
204  H_CPU_BRD_VOLT_R    Raw divided 5V
205  H_ADC_OFFSET_R      Raw 0V input
206  H_ADC_GAIN_R        Raw 2.5V input
207  H_CAL1_VOLT1_R      Raw cal. lamp 1 voltage
208  H_CAL1_VOLT2_R      Raw cal. lamp 1 voltage
209  H_CAL2_VOLT1_R      Raw cal. lamp 2 voltage
210  H_CAL2_VOLT2_R      Raw cal. lamp 2 voltage
211  H_CAL3_VOLT1_R      Raw cal. lamp 3 voltage
212  H_CAL3_VOLT2_R      Raw cal. lamp 3 voltage
213  H_SURF_VOLT1_R      Raw surf. lamp voltage
214  H_SURF_VOLT2_R      Raw surf. lamp voltage
215  H_SUN_LED_VLT1_R    Raw sun sensor LED volt
216  H_SUN_LED_VLT2_R    Raw sun sensor LED colt
217  H_OBJECTIVE         Objective of test
218  H_DUMMY             Flag for dummy detector
219  H_MODEL             DISR model for MMC
220  H_DCOFFSETU_R       Raw ADC value of DC offset voltage, ULIS
221  H_DCOFFSETD_R       Raw ADC value of DC offset voltage, DLIS
222  H_SQRT_MIN          Minimum value for sqrt table
223  H_SQRT_MAX          Maximum value for sqrt table
224
225  H_SUN_SOURCE        source of spin data
226  H_OGSE_STATUS       status of OGSE
227  H_OGSE_MSG          last msg from EGSE displayed on OGSE
228  H_OGSE_LAMP         lamp current
229  H_OGSE_SUNFILE1     path of sun pulse file
230  H_OGSE_SUNFILE2     path of sun pulse file
231  H_OGSE_SAMP         sun amplitude current
232  H_OGSE_SUNTABLE     sun table
233  H_OGSE_RPM          sun pulse RPM
234  H_OGSE_SPAN         sun pulse span value
235  H_OGSE_SIDEC        Si detector reference
236  H_OGSE_GEDEC        Ge detector reference
237  H_OGSE_EXTDEC       external detector reference
238  H_OGSE_5V           5V reference
239  H_OGSE_TEMP         internal temperature
240  H_OGSE_SSS_TEMP     sun sensor stimulator temp.
241  H_OGSE_GN           analog ground noise
242
243
244
245
246
247
248
249
250
251
252
253
254
255  H_MONO_WAVL         Monochromator wavelength [nm]
256  H_MONO_SI           Monochromator Si detector reading
257  H_MONO_GE           Monochromator Ge detector reading
258  H_MONO_FLTR         Monochromator filter
259  H_MONO_G            Monochromator gain
260  H_MONO_RT           Monochromator response time [s]
261  H_MONO_GRAT         Monochromator grating
262  H_MONO_TUR          Monochromator turret number
263  H_SPSI              Sphere Si detector reading
264  H_SPFLSI            Sphere filtered Si reading
265  H_SPINGAS           Sphere InGaAs detector reading
266  H_SP_DETTMP         Sphere detector temperature
267  H_COSI              Collimator silicon detector reading
268  H_COFLSI            Collimator filtered Si reading
269  H_COINGAS           Collimator InGaAs detector reading
270  H_COTMP             Collimator detector temperature
271  H_PLMINGAS          Palmer InGaAs detector reading
272  H_PLMTMP            Palmer detector temperature
273  H_CAL_D1            Spare calibration detector 1
274  H_CAL_D2            Spare calibration detector 2
275  H_CAL_D3            Spare calibration detector 3
276  H_CAL_D4            Spare calibration detector 4
277  H_CAL_D5            Spare calibration detector 5
278  H_CPGASTEMP         Temperature of SH internal purge gas
279  H_AMBTEMP           Ambient temperature of clean room
280  H_SPTEMP            Temp[erature of gas in sphere
281  H_BOXTEMP           Temperature of gas in dry box
282  H_CHMBTEMP          Temperature in environment chamber
283  H_CAL_T1            Spare calibration temp 1
284  H_CAL_T2            Spare calibration temp 2
285  H_CAL_T3            Spare calibration temp 3
286  H_CAL_EL            Sensor head elevation
287  H_CAL_AZ            Sensor head azimuth
288  H_CAL_POL           Collimated beam polarizing angle
289  H_CAL_SHUT          Calibrator high intensity shutter state
290  H_LAST_CALTIME      Time of last cal. log entry

The total number of entries in the template at present is 291

Each header line has a certain format depending upon the validity, type, and data type of the entry.  The structure of each header line is summarised as follows.

No entry present          line left blank

Column
0     Goodness criterion
                G = from GSE
                C = from calibrator file
                P = from post‑processor
                H = human intervention
                V = control parameters in header or a validated entry
                N = from configuration file
	          R = raw data read‑only
          U = unvalidated
1     Entry type
    P = pointer
    M = multiple entry
    S = single entry
2     Number of entries
3     Number of entries
4     Number of entries
5     Data type
    1 = byte
    2 = integers
    3 = long integers
    4 = floating point
    5 = double precission
    6 = complex
    7 = string
    8 = structure
6     Reserved column
7	   Start of information

There are three entry types.

A single entry might specify, for example, the file name.  This is the simplest form of entry. 

A pointer is used to make certain areas of the header infinitely extendable.  The pointer points to the beginning of a certain area.  There are 3 pointers in the DISRSOFT headers.  One controls the processing history of the header (H_PROCESS).  One is an extension area for parameters which have not been assigned a header entry but need to be carried with the header in some way (H_EXTENSION).  There is one spare at present (H_EXTRA).

A multiple entry is the most complex.  Sometimes it is desirable to keep certain entries together when reading or manipulating the header.  One example might be the coordinates of the image.  Four numbers are required to specify from which area of the CCD a sub-array comes from.  A multiple entry (made up of 4 single entries) can be used to hold these data.  By accessing the first entry one obtains all in a four-element vector.  The number of entries is specified in columns 2-4 (column 4 is units).  Note that at present there are no multiple entries defined in the DISRSOFT system.

The reserved column is available for any problems that may arise.

The image data will follow the header in the file.  Image data may have up to 3 dimensions.  Missing pixel data will be set to -32768 to indicate that it is not valid information.  The pixels data will be written using the WRITEU function in IDL.  One unfortunate characteristic of XDR is that it does not provide a standard two-byte integer format.  XDR instead assumes the integers are 4-bytes long and pads the rest with zeros.  This has the effect of blowing up the storage needed for images by a factor of 2.  It was recognised that this is not desirable and hence 2-byte integers are stored differently from other arrays.  Two byte integer arrays are split into two byte arrays and then these two arrays are stored consecutively in the file.  The IDL code that performs this task is 

; special structure to reduce the size of the XDR file for 2 byte
; integers

ZP=SIZE(PIXELS_IN)
IF ZP(ZP(0)+1) EQ 2 THEN BEGIN
	PIX1=BYTE(PIXELS_IN/256)
	PIX2=BYTE(PIXELS_IN MOD 256)
	WRITEU,UNIT,PIX1
	WRITEU,UNIT,PIX2
ENDIF ELSE BEGIN
; write away unless PIXELS_IN is undefined

	IF (ZP(0) EQ 0) AND (ZP(1) EQ 0) THEN BEGIN

	ENDIF ELSE BEGIN
	WRITEU,UNIT,PIXELS_IN
	ENDELSE

ENDELSE

In this code PIXELS_IN is the input array and ZP is the output of the IDL function size performed upon the array PIXELS_IN.

 Standard data files (NOT DISR IR DETECTOR)

No further information is contained in standard files.  Standard files may be read and written using the system procedures, D_READ and D_WRITE, respectively.

 IR data set files    (DISR ONLY)

The IR data sets require additional information to be carried with the file.  This additional information is in the form of three tables.  The region table is a 5 x H_NUM_REGIONS long integer (4 byte) array.  The reading table is a long integer array of size 6 x (H_NUM_ROT).  This table is stored as a 4 byte integer table in XDR.  The final table is the bin definition table.  This table is a 6 x H_NUM_BINS 4 byte integer array.  An IR image should normally be read by D_IRREAD.  However, D_READ can be used to read the header and pixels but cannot read the table.  It consequently will report an error although it will return the header and pixels.  D_WRITE will not write IR data sets under any circumstances.  Only D_IRWRIT can perform this function.  Note that the system programs determine whether the data set is IR or not by accessing H_SET_ID.

When D_IRREAD is correctly executed the additional three tables are returned as one variable of data type structure.  The structure contains the three arrays with tag names REGIONS, READING and BINS.

Programs in DISRSOFT will normally have a filename not greater than 8 letters with the ".PRO" as the default extension.  It is intended that all DISRSOFT procedures will have an underscore ("_") as the second or third letter in the filename.  The first letter or letters will define the purpose of the file,

D_ DISRSOFT calibration procedure
C_ system common block procedures and include files
T_ tool procedure (not DISR specific)
XY_ xy scheme for address manipulation
S_ simulation procedure
F_ FITS output files
O_ backup files

Others TBD.

Filenames for DISR data files will comprise an 8 letter filename plus a 3 letter extension.  The filename will be constructed in such a way that a user will be able to identify certain characteristics of the contents of the files from the name alone.  MMC may occasionally require replays or repeat tests and have therefore requested that the mission time be appended to the filename extension to avoid any possible confusion.  A UNIX tool is available which can remove the mission time from the filename in all files in the current directory.  A UNIX specific program (D_CUTNAM) in IDL will also be written to provide this capability. 

The data file names have the following structure

The first character will be

C -  calibration
F -  flight
R -  response matrices
D -  dark matrices
I -  infra red test
M -  CCD testing
V -  MMC testing
A -  UofA testing
P -  OP testing

The second character is TBD

Characters 3 - 7 specify the image number in the sequence of frames accumulated.

Character 8 will specify the data set type according to the following code

a is a control number
b is the data set id
c is the character 8 code
d is the data set name
 
a  b  c d
01 01 M Message
02 02 T Time
03 03 S Sun sensor
04 06 H Housekeeping
05 07 L Lamp
06 08 D Descent
07 09 C Calibration
08 10 B Visible
09 11 I Image
10 12 P Strip
11 13 A Solar aureole
12 14 K Dark current
13 15 F Full CCD
14 16 R IR
15 17 V Violet
16 20 U IR shutter
17 21 X DCS
18 22 E Heater
19 23 Z Cal lamp
20 24 Y Surface lamp
21 25 W Sun lamp
22 26 G Bad RAM
23 27 J Bad EEPROM
24 28 N Memory dump
The extension will indicate the processing level of the stored image.

The first two letters of the extension are TBD.  The last letter of the extension will be as follows

X - raw data
A - verified data
R - radiometrically calibrated data
E - enhanced
G - geometrically corrected data
S - science data

Examples:

Vx02135A.xxX   would be a raw data frame obtained during MMC testing.  It would a solar aureole data set.  It would be the 2135th frame obtained in the 1st operational sequence of the day.

After the startup procedure has been completed, a welcome message appears and the prompt changes.  The prompt will give the name of the database currently in use  (e.g. to DISR> for DISRSOFT, or IMP> for IMP_SOFT).  Commands must then be entered from the command line as with IDL.  Indeed all the IDL routines are there for you in addition to the specific DISRSOFT routines.  A widget interface will be developed for a quick look at the data.  This will only provide fairly simple graphics and displays so that the user can get a quick impression of the data without having to know program details.  From previous experience, users like to customize their diagrams and plots as soon as they are able to.  Thus, complex displays in the widget interface will not be supported.

It should be noted that DISRSOFT can also run from a terminal which does not support widgets.  Calling a widget driven program, however, will produce a controlled error state and the program will exit.

For detailed analysis and study, it is expected that users will want to go to the IDL prompt and simply use the system to complete a series of standard operations.  Users may wish to use their own routine for one operation or a more sophisticated post-processing may be desirable.  In either case they will want to interact more closely with the system.  This will be possible from the IDL prompt.

An on‑line help is provided which the user can access by calling D_WHELP.  This lists DISRSOFT procedures available and gives their procedure call.  It also provides general information on the header structure and the header elements expected for each data set.  For DISR only, this procedure also provides information on the data sets showing which header entries are filled by which data sets.

In general, the procedure calls will be of the form :‑

PROCNAME, [FILENAME,] HEADER_IN, PIXELS_IN, HEADER_OUT, PIXELS_OUT [,KEYWORDS] [,STATUS]

The procedure name will be limited to eight letters in all cases (due to restrictions for DOS filenames).  The square brackets indicate an optional parameter.  The input header and pixels will remain unchanged within the procedure.  An operation will be performed which will be noted in the output header.  The modified output pixels and the accompanying header are then returned in HEADER_OUT and PIXELS_OUT.  Some database management routines do not follow this scheme exactly because the user must input filenames etc., or specify variables to be extracted from the header.  In one or two cases no output is required; in one case, no input!  Filenames will in general come before HEADER_IN while input parameters for the operation will appear after PIXELS_OUT.  The STATUS parameter will always be a four element string which will report on the success or failure of the applied routine.  It will always be the last parameter and will always be optional.  Possible values for STATUS are shown in the table.

element of STATUS	possible values	meaning	
0	S
F	successful execution
failure of routine	
1	SUCCESS
FAILURE	successful execution
failure of routine	
2	routine name	name of procedure executed	
3	
error message	successful execution
more information on failure	

If the parameter STATUS is not given to a routine then the error message will be printed to the screen.  If STATUS is given to the routine NO ERROR MESSAGE WILL BE PRINTED if a failure occurs.  It is expected that you have included the STATUS parameter in order to check its contents yourself.  This would be the case in a program for example which you leave running overnight.  You should use the STATUS parameter to control errors that occur.

Example:

DISR> D_READ,'C:%MF490003.X',H,P

This will print,

D_READ: I/O error.  Exit.

However,

DISR> D_READ,'C:%MF490003.X',H,P,STATUS

will not print anything but if you now

DISR> PRINT, STATUS

the result will be 

F FAILURE D_READ I/O error

You may now correct this by

DISR> D_READ,'C:MF490003.X',H,P,STATUS & PRINT,STATUS

and the system will respond by

S SUCCESS D_READ

You can test STATUS in a program by using the following IF statement

D_READ,'C:MF490003.X',H,P,STATUS
IF STRUPCASE(STRMID(STRTRIM(STATUS(0),2),0,1)) EQ 'S' THEN BEGIN
	; do something when the routine successfully executes
ENDIF ELSE BEGIN
	; do something else when the routine fails
ENDELSE

The ON_ERROR facility in IDL will be used for all procedures to catch errors.  It should be noted that making ctrl-C or break inside a DISRSOFT program will return the user to the calling procedure or the main level.  In preliminary versions of DISRSOFT, the ON_ERROR facility will not be implemented to assist in de-bugging etc.

All programs will contain a completed documentation template a blank copy of which will be found in the /DISRSOFT/README directory.  This template also contains bits of code which could be useful to the general user including an input parameter checker, a header checker, a pixels checker and a widget checker.

Many of the routines in the system area have widget-driven counterparts.  For example, one can also use D_WREAD to read an image in place of D_READ.  In this case, a widget will be generated allowing you to select which image you wish to read from a menu.  Several widget-driven programs are available for system operations and there are also one or two tools which may prove useful.  An ultimate objective is for there to be a widget-driven surface for the entire DISRSOFT system which could be run to allow simple yet effective operations on images.  A preliminary version of this program can be found in the system routine D_ISRSFT.

Widget applications also have status reports although because they will be used interactively, these reports need not normally be looked at by the user.  All widgets use the XMANAGER to pass control to an event manager which waits for events to be generated and then performs some action.  The structure of the event manager procedure uses a CASE statement to find out which type of widget has generated the event (BUTTON, TEXT, LIST, or DRAW) and then branches depending on the exact type of event generated.  This usually allows a well structured program.  In some cases the widget events call sub-procedures in order to simplify the event structure further.  Please note that the names of these sub-procedures do not follow the standard DISRSOFT conventions and are not documented here (they are almost never of use to the DISRSOFT user as a general routine).

The DISR EGSE currently only supports IDL 3.1.  As a result, the functionality of some widgets does not conform precisely with standard widgets.  An important case here is the text widget which can only generate an event when <return> is pressed.  This is particularly important for the selection of directories in reading and writing files.  This operation is usually performed by the IDL library procedure PICKFILE.  When entering the directory name under UNIX or VMS you MUST press <return> otherwise the file will be written or read from the current directory.

This section describes how to install DISRSOFT.

DISRSOFT will usually be installed by floppy onto a PC.  Distribution of the software will usually be by 3.5" floppy.  Assuming that your 3.5" floppy drive has the logical name B:, the following will install DISRSOFT.

Insert disk into drive B:
Go to the DOS prompt on the PC.
Type the following

B:
INSTALL x:	where x is the logical name of the hard disk on which you wish to install DISRSOFT

DISRSOFT should then be successfully installed on your hard drive in a main level directory called CAL_SOFT.  At present you must make one further modification by hand.  Enter IDL and find the menu under PREFERENCES which is found under FILE.  In this menu there will be a initial path which will contain either nothing or some directory specification.  Add to this list the path

x:\cal_soft\disrsoft\startup	where x is again the logical name of the hard drive where DISRSOFT is installed.

Save this setting.  You may then enter IDL and startup DISRSOFT.

Currently installation of the VMS version is being made by using DECNET to access a PC with the DISRSOFT software installed.  The PC is set to FAL (file access listening) and the software copied over the local area net.  This will be changed at some later date.

Currently we are copying DISRSOFT by FTP onto the HP 700 machines.  This is tedious in the extreme and will be modified as soon as we have figured out a better way.  For transfer to other machines, we have used the shar facility for shipping data between HP machines successfully.

This section describes how to start up DISRSOFT.

 Manual initialisation

To start DISRSOFT you must first start IDL.  Once IDL is running correctly you may type at the IDL prompt

IDL>  @d_start

You will then be prompted to state which database you require.  The program searches to determine which databases you have available.  If you only have DISRSOFT available then pressing any key and return will start up DISRSOFT.  If you have IMP_SOFT or HMC_SOFT on your disk then you will have to make a selection at this point.  DISRTEST (as explained above) is used by MPAE for test purposes only.  You should not make this selection unless you are doing program development work.

After you have selected, the prompt will change to DISR> and a welcome message should appear.  You are in!

 Automatic initialisation

You may wish to start DISRSOFT every time you enter IDL and not want to type in the command every time.  If so, you may use the program D_START as a startup file.  To do this move your mouse to FILE on the IDL bar and select PREFERENCES from the menu.  You will then be able to input x:/cal_soft/disrsoft/startup/d_start as an IDL start up file.  D_START will then run immediately after you enter IDL.

If you have other commands you wish IDL to perform as soon as you enter IDL (such as starting an automatic journal file), you may make a copy of the file START_PC.PRO from the README directory and edit this file.  Entering the name of this file in the PREFERENCES of IDL will give you your own specific startup procedure.  If you choose to do this, take care not to overwrite variables or common blocks specified in D_START as this could affect DISRSOFT and give you some severe headaches.

 Manual initialisation

To start DISRSOFT you must first start IDL.  Once IDL is running correctly you must type a path specification at the IDL prompt which points to where the DISRSOFT common blocks are resident.  On our DEC ALPHA machine at present this is

IDL> !PATH=!PATH+',[cal_soft.disrsoft.startup]'

Note the comma before the square bracket - it's important!

Then you must begin the DISRSOFT software itself by running a program called D_START.  On our DEC system this would look like 

IDL>  @d_start

You will then be prompted to state which database you require.  The program searches to determine which databases you have available.  If you only have DISRSOFT available then pressing any key and return will start up DISRSOFT.  If you have IMP_SOFT or HMC_SOFT on your disk then you will have to make a selection at this point.  DISRTEST (as explained above) is used by MPAE for test purposes only.  You should not make this selection unless you are doing program development work.

After you have selected, the prompt will change to the database specific prompt (e.g. DISR>) and a welcome message should appear.  You are in!

Currently, we are using a simple assignment statement inside D_START which tells DISRSOFT where the path to the main directory.  If this is not correctly defined inside D_START, DISRSOFT will come back with an error and will not start up.  In this case you should edit D_START.PRO and put in the correct path.  Instructions are contained in the code itself to help you.  Note that you should only change the VMS section of the IDL code.

 Automatic initialisation

Not currently available

 Manual initialisation

To start DISRSOFT you must first start IDL.  Once IDL is running correctly you must type a path specification at the IDL prompt which points to where the DISRSOFT common blocks are resident.  On our machine at present this is

IDL> !PATH=!PATH+':/disr01_fw1/cal_soft/disrsoft/startup'
Then you must begin the DISRSOFT software itself by running a program called D_START.  On our UNIX system this would look like 

IDL>  @d_start

You will then be prompted to state which database you require.  The program searches to determine which databases you have available.  If you only have DISRSOFT available then pressing any key and return will start up DISRSOFT.  If you have IMP_SOFT or HMC_SOFT on your disk then you will have to make a selection at this point.  DISRTEST (as explained above) is used by MPAE for test purposes only.  You should not make this selection unless you are doing program development work.

After you have selected, the prompt will change to the database specific prompt (e.g. IMP>) and a welcome message should appear.  You are in!

Currently, we are using a simple assignment statement inside D_START which tells DISRSOFT where the path to the main directory.  If this is not correctly defined inside D_START, DISRSOFT will come back with an error and will not start up.  In this case you should edit D_START.PRO and put in the correct path.  Instructions are contained in the code itself to help you.  Note that you should only change the UNIX section of the IDL code.

 Automatic initialisation

A template exists in the README directory for a startup file in IDL which sets up and starts DISRSOFT as soon as you enter IDL.  This startup file can be edited and customised.  When you have done this you should follow the method shown at the end of Chapter 2 in the IDL user manual.  You should set up a shell script and include the statement

setenv IDL_STARTUP filename

where filename is the name of your startup file.  On entering IDL, the startup file should then be executed.

Here are given a series of examples of how DISRSOFT can be used to get information about DISR data both interactively and in a user-defined program.

The first thing you want to do is to read an image, display it, and show the contents of the header.  You might not even know which file you want so you want to look around first before selecting your file.  The program D_WREAD allows you to do this if you are working on a terminal which supports widgets.  (If you are not on such a terminal, D_WREAD will give an error and you have to do things the long way round and go straight to D_READ.)

Typing,

DISR> D_WREAD,HEADER,PIXELS

will produce a widget and ask you to select a file to read.  Selecting a non-DISRSOFT file or an IR file in this way will produce an error message.  The reason why the IR also produces an error is because DISRSOFT is not allowed to read IR pixels without also reading the associated data which comes with every IR data set.  To read an IR file you MUST provide an extra keyword parameter, i.e.

DISR> D_WREAD,HEADER,PIXELS,IRDATA=IRDATA

If you click on a CCD DISRSOFT file, the header and pixels are brought into your IDL interactive environment as HEADER and PIXELS.  If you now type

DISR> HELP,PIXELS

IDL will return with (for example)

PIXELS    FLOAT   = Array (74,  74) 

Typing

DISR> HELP,HEADER

will give information about HEADER viz.

HEADER     STRING   = Array (256)

You may show the image on your TV display by typing

DISR> TVSCL, PIXELS

This command scales the image between 0 and 255 linearly, generates a window and displays it.  The array, PIXELS, is not affected by this operation.  The display of 2-D and control of the window it appears in, is explained in the IDL manual.
To display the contents of the header requires DISRSOFT commands.  By typing

DISR> D_SHEAD, HEADER

the contents of the header will be displayed.  On the left of the screen will appear the names of the header entries and a very brief description.  The right side will show the entries themselves.  Only filled entries are shown.  The last thing shown is the processing history.  This can also be shown by typing

DISR> D_SPROC, HEADER

the processing history will then be shown.

The widget driven program D_WREAD can also just read a header.  This can be useful if you want to include IR data in your search for the best data.  D_WREAD will only give an error for a non-DISRSOFT file in this case.  The call is

DISR> D_WREAD, HEADER, /headonly

headonly is a keyword to the DISRSOFT procedure D_WREAD.  Note that any previous definition of HEADER will be erased on exiting the D_WREAD procedure and replaced by the contents of the new file.

You can make a hard copy of a header using a second parameter with D_SHEAD.

DISR> D_SHEAD,HEADER,'MYHEADER.DAT'

will output the contents of the header to a file called MYHEADER.DAT in the current directory.  Note that the current directory can be found by typing

DISR> CD,CURR=CURR & PRINT,CURR

Some people may find D_SHEAD a little annoying because when there is a lot of information in the header, the top section runs off the screen before you have a chance to read it.  This can be avoided if you have widget capability using D_WSHEAD.

DISR> D_WSHEAD,HEADER

This routine shows the header in a widget and immediately returns control to the user without destroying the widget.  You can therefore look at the header and scroll around it while completing some other operation.  You can destroy the widget by going into the control box and clicking on "Close".

The program, D_WREAD, is actually a very simple procedure which just allows you to view the contents of directories before picking your file to be read.  Underneath D_WREAD sit three other DISRSOFT programs which do most of the work.  You can also use these routines to access data.  (This is how you have to access data if you are on a terminal which does not support widgets.)

Typing,

DISR> D_RHEAD,'FILENAME.X',HEADER

will read the header of the file 'FILENAME.X' if it is a DISRSOFT header and will place the contents in the string array, HEADER.  This can be shown as before by using

DISR> D_SHEAD,HEADER

If FILENAME.X is not a DISRSOFT header then an error message will result.  A further parameter can be supplied to D_RHEAD.  This is a status parameter.  Most DISRSOFT procedures have such a status parameter.  It is always the last parameter and it is always optional.  The main use of the status parameter is so that you can perform a check on whether a routine has been completed successfully in a program although you can use it interactively also.

Consider the command

DISR> D_RHEAD,'FILENAME.Y', HEADER, STATUS

Let us also assume that FILENAME.Y does not exist.  D_RHEAD exits.  In this case no error message is displayed because the status parameter has been supplied.  You must now check the status parameter.  So print it.

DISR> PRINT,STATUS
F FAILURE D_RHEAD I/O error

The status is a four element string array.  The first element species 'S' for success or 'F' if the routine has failed.  The second element will say 'SUCCESS' or 'FAILURE' while the third element gives the routine name.  The fourth element will contain some message which can give you a clue as to why the program has failed.  When you write a program containing DISRSOFT routines you can then make a test on whether an operation has completed correctly and handle any error that occurs in software.  'S' and 'SUCCESS' only appear if the operation was correct.  Only letters other than 'S' will be used to signify a failure or error.  Program example:

PRO JUNK
;define the system and header common blocks.  Note that these common blocks
;MUST be defined in all user written procedures if you want to use the
;logical names of header entries.

@c_system.inc
@c_header.inc

;perform a read header with status check
D_RHEAD, 'FILENAME.Y', HEADER, STATUS

;perform an action based on the status check
	IF STRMID(STRUPCASE(STRTRIM(STATUS(0),2)),0,1) NE 'S' THEN BEGIN
		PRINT,' '
		PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+' :  D_RHEAD ERROR.  EXIT.'
		RETURN
	ENDIF ELSE BEGIN
		PRINT,' '
		PRINT,' I have read correctly -- now going to do something else.'
	ENDELSE

;exit
RETURN
END

In addition to D_RHEAD, there are D_READ and D_IRREAD.  D_IRREAD is specific to the IR data while D_READ reads everything but will give you a very clear warning if you attempt to access IR data with it.

DISR> D_READ, 'FILENAME.Y',HEADER, PIXELS, STATUS

will read the header and pixels of the file FILENAME.Y if it exists.  An error occurs if it does not exist.  Also if you type

DISR> D_READ, 'FILENAME.Y', HEADER

will result in an error because D_READ assumes you want to read the header AND the pixels.

Typing,

DISR> D_IRREAD, 'FILENAME.Y', HEADER, PIXELS

will also result in an error because for the IR data you MUST read in the additional orientation data.  The correct call for D_IRREAD is therefore

DISR> D_IRREAD, 'FILENAME.Y', HEADER, PIXELS, GEOM_DATA, STATUS

(STATUS is, as always, optional.)

You might be wondering how do these routines know what is IR data and what isn't.  The easy answer is that the header tells you.  The critical entry is H_SET_ID.  If that entry is 16 then the routines (and the DISR EGSE) know that an IR data set is coming.  You might want to know which data set corresponds to which set id.  A simple system routine called D_SETID will do this for you.

DISR> PRINT,D_SETID('IR')

will return the value 16.  Other data set names can be entered.  Dont add the words "data set" or "set" after the data set name in this routine because the software wont recognise it.  Try

DISR> PRINT,D_SETID('CAL LAMP'),D_SETID('BAD EEPROM')

If you are interested in looking around in a directory for the DISRSOFT image you want, you can use D_LOOK which creates a list widget.  You can click on an image in the list and that file will be read and the pixels displayed in the accompanying window.  This routine only works for CCD images at present but might be useful for browsing through your data.  The call is

DISR> D_LOOK

You can, however, use the routine in a similar way to D_WREAD by adding the parameters

DISR> D_LOOK, HEADER, PIXELS

When you exit D_LOOK, the last image you read will be returned in HEADER na d PIXELS.

We have already seen how you can read and display a header.  Now you want to actually use that data.  There are two simple routines available for this purpose.

Typing,

DISR> PRINT, D_VALUE(HEADER, H_FILENAME)

will print the contents of the header element H_FILENAME in the header, HEADER.  D_VALUE is a function which can be called in a user-defined procedure.  Thus,

PRO JUNK

;define the system and header common blocks
@c_system.inc
@c_header.inc

;perform a read header with status check
D_RHEAD, 'FILENAME.Y', HEADER, STATUS

;perform an action based on the status check
	IF STRMID(STRUPCASE(STRTRIM(STATUS(0),2)),0,1) NE 'S' THEN BEGIN
		PRINT,' '
		PRINT,STRTRIM(STRUPCASE(STATUS(2)),2)+' :  D_RHEAD ERROR.  EXIT.'
		RETURN
	ENDIF ELSE BEGIN

		ACT_FILENAME=D_VALUE(HEADER,H_FILENAME)
		PRINT,' The original filename of this header was '+ACT_FILENAME

	ENDELSE

;exit
RETURN
END

The above program reads a header, if successful it extracts a value and prints it.  Each header entry also has a goodness criterion associated with it which has been defined in the paragraph on header line structure above.  This criterion can be determined by 

DISR> PRINT, D_VALUE(HEADER, H_FILENAME, GOODNESS, STATUS)

where STATUS is the standard status report.  Each header entry has a datatype associated with it.  Thus, D_VALUE returns the contents of the header entry in the datatype it was stored as.  Thus the exposure time H_EXPTIME will normally be returned as a floating point number while H_FILENAME is returned as a string.  Note that the user can overwrite this under certain conditions with D_INSERT.

D_INSERT is a program which can put data into the header.  An example would be

DISR> D_INSERT, HEADER, NEW_HEADER, 12.23, H_GAIN, 'V'

This inserts the value 12.23 into the entry H_GAIN of header HEADER with a goodness criterion of 'validated', appends a processing entry, and returns the changed header as NEW_HEADER.  Note that all the parameters here were needed.  You cannot exclude the goodness criterion.  If the entry H_GAIN in HEADER has been set to read-only, this routine will fail and produce an error message.

When storing information in the header, DISRSOFT has a series of default formats.  The default format for each entry can be found by typing

PRINT,C_FORMATS(H_ENTRY)

where H_ENTRY stands for the logical name of any header entry.  This format can be overridden using the format parameter of D_INSERT.  Thus,

DISR> D_INSERT, HEADER, NEW_HEADER, 12.23, H_GAIN, 'V','(F8.2)',STATUS

would ensure that the new header entry has the correct level of accuracy.  The formatting statement is a string contaiinng the FORTRAN formatting code enclosed in parentheses.  Some formats will be forbidden by DISRSOFT (i.e. trying to force a string into a numerical entry).  But this cannot be guarded against in all cases without making the system extremely complicated.  You should therefore be careful with formatting using D_INSERT.  As a general rule you should try to use the default format.

If you are intoxicated by widgets and cant get enough of them, D_WINSER provides you with a widget which can be used to perform the same tasks as D_INSERT.  Using the command

DISR> D_WINSER,HEADER_IN,HEADER_OUT

will fire up a widget and allow to modify values interactively.

So you have processed some DISRSOFT data, modified the header, and now you want to write away your staggering work.  Your main workhorse here is D_WRITE.

DISR> D_WRITE, 'NEWFILE.MY',HEADER, PIXELS, STATUS

This procedure will write away the contents of HEADER and PIXELS to the file NEWFILE.MY.  If NEWFILE.MY already exists, D_WRITE will exit giving an error.  You cannot overwrite files with D_WRITE.

There are occasions where you only want to write the header away.  This also applies to data sets which contain no pixels (e.g. the housekeeping data set).  In this case you must use a keyword option to D_WRITE as follows

DISR> D_WRITE, 'NEWFILE.HDR',HEADER, PIXELS, STATUS,/HEADONLY

PIXELS in this case will be ignored and only the header will be written away.

You cannot write away IR images with D_WRITE because you must have the orientation data with the header and pixels otherwise the data become useless.  D_WRITE will stop you doing this.  There is a special routine for the IR.

DISR> D_IRWRIT, 'NEWFILE.MY',HEADER, PIXELS, GEOM_DATA, STATUS

If you are very busy and very nervous, your disk is going to get full with all this writing.  So now you want to delete.  You can, of course, do this through the operating system using SPAWN but DISRSOFT also provides a routine called D_DELIM

DISR> D_DELIM, 'NEWFILE.MY', STATUS

If the status parameter is omitted, the routine will prompt you to ask if you are sure you know what you are doing.  If the status parameter is present, it assumes you are old enough to bear the consequences of your actions!

D_UPIM is the most powerful and dangerous tool in that it deletes the image of the same name completely before saving the new image.

DISR> D_UPIM, 'NEWFILE.MY',HEADER, PIXELS, STATUS

If, however, NEWFILE.MY does not exist, then the routine assumes you don't what you are doing and causes an error.  This routine does not at present work for the IR data.

So you have changed the file, you read it back but cant remember what the hell you did.  You should have used D_APPROC!  D_APPROC appends a processing history to the header for you.  You should call this every time you complete an operation on the pixels.  Note that if you insert things into the header then D_INSERT automatically calls D_APPROC to indicate that you have screwed around with a specific entry.  For the pixels, however, it is YOUR responsibility.  So,
 
DISR> D_READ, 'FILENAME.Y',HEADER, PIXELS, STATUS
DISR> NEW_PIXELS = PIXELS * 1.44E-6
DISR> D_APPROC, HEADER, NEW_HEADER, '*1.44E-6','V1.0',STATUS

Normally D_APPROC should be used in a program so that the string 'V1.0' corresponds to a version number of your program but D_APPROC can be used interactively also.  You can show the processing history of a header by commanding

DISR> D_SPROC, NEW_HEADER

An additional feature of D_APPROC is that it can now be used to enter a simple text string of any length into the header using the keyword /TEXT.  Thus,

DISR> D_APPROC, HEADER, NEW_HEADER, 'This is a text string which I want to enter.', /TEXT

will put exactly that text string into the processing area as a comment.  The date of the comment is append to the message automatically.

The concept of DISRSOFT is based on software produced for the HMC project by DLR, Oberpfaffenhofen.  One thing their ideas didn't cover, however, was the searching of the database for the files you want.  This is now covered by the routine, D_SEARCH, in DISRSOFT.  This program can work either as a widget driven program (and therefore interactive) or as a normal procedure.  Commanding

DISR> OUTPUT = D_SEARCH()

will fire up the widget interface (unless your terminal doesn't have one) and present you with something you can really get your mouse into.  You can search on ascii files or DISRSOFT files.  You can use the directory and file filters to isolate particular file types.  You can also search through all sub-directories as an option.  You can select up to three search strings.  You can search for an occurrance of any of the strings (boolean OR) or you can search for files which only have all three strings (boolean AND).  The result of the function, OUTPUT, is a string array containing all the names of the files which met the last performed search criteria.

Because of the options available the non-interactive routine has a lot of input parameters as keywords.  You may call this in a program or at the terminal prompt.

DISR> FILEOUT = D_SEARCH( /NOINTERACTIVE,$
	DIRECTORY='c:\rsi\idl', FILTER='*.x', SEARCHPARS=['RK','DARK'],/ORSEARCH,$ 	/DISRSOFT,/SUBDIRECTORIES, STATUS)

Here D_SEARCH will perform a search on all sub-directories of c:\rsi\idl for DISRSOFT headers which contain either the string 'RK' or the string 'DARK'.

The output nametable can be written away and saved by using the D_WNAME procedure, e.g.

DISR> D_WNAME,'MYNAMES.TAB',FILEOUT

They can be read back again using the D_RNAME function

DISR> FILEOUT = D_RNAME('MYNAMES.TAB')

STATUS parameters are again optional.  Once you have a nametable you can sort that nametable according to some header entry.  So let us assume you want to sort by mission time.  The procedure call would be

DISR> SORTED_FILES = D_SORT (FILEOUT,H_MISSION_TIME)

The nametable is then reconstructed according to the consecutive numbering of the mission time.  This routine also works on strings.

The next routine in this section is D_CAT which is a widget-driven program for interactively producing a catalogue of header parameters.  The directory and file filter is identical to the D_SEARCH routine.  Header entries can then be entered into specific windows and the default formatting can be modified to produce a nicely formatted catalogue of the parameters you want.  The scroll bar to the right shows all the header parameters as a guide.

Once you have a nametable you can also extract the same header entry from every file in the nametable using the procedure, D_HCONT.  D_HCONT actually needs to have two entries specified so for example you could get the CCD temperature varaition with mission time by

DISR> D_HCONT, FILEOUT, H_MISSION_TIME, H_CCDTEMP,$
		 MISS_TIMES, CCD_TEMPS

where MISS_TIMES and CCD_TEMPS are the output vectors containing the header values for each file in the nametable.

There are many occasions when you want to have all files in all sub-directories.  Although D_SEARCH can do this is with ascii or DISRSOFT files, this is a bit of a waste of time.  The routine T_TREE is more efficient.

DISR> OUTPUT=T_TREE(DIRECTORY='C:\DISRSOFT\DATA',FILES)

will search all directories under C:\DISRSOFT\DATA and return the directory names found in the variable OUTPUT and all the files (with full file spec) in the variable FILES.  (FILES is optional if you just need directories!)  T_TREE is an example of a tool in that it will work independent of whether DISRSOFT is running or not.

We have now looked at the most important routines that the system offers.  As DISRSOFT grows in the next months, more routines will begin to appear in other directories which are specific to the calibration of DISR data.  There are, however, other routines already available for performing general (non-DISR specific) tasks.  These are in the TOOLS directory.  Three examples are T_IMAGE, T_WPROFI and T_MEANS.  All are widget-driven routines for interactive analysis of pixel information.

DISR> T_IMAGE, PIXELS

allows you to use your mouse to pick off specific values in an image, mark points on the image, draw lines on the image, investigate angles between features on the image, make a histogram of a sub-image and calculate means of sub-images.

DISR> T_WPROFI, PIXELS

allows you to look at profiles in an image interactively.  The program is not restricted to rows and columns only but can interpolate to give profiles in any direction across an image.  The plot can be annotated interactively and output to a Postscript file.

DISR> T_COLROW, PIXELS

also allows you to look at profiles interactively but only along a column or a row.  However, you can also assign 2 keywords which can be used to give the correct scaling of the x and y axes.  Thus,

DISR> T_COLROW, PIXELS, X=FINDGEN(256)*0.1123, Y=FINDGEN(256)*1.23

will now allow you to plot PIXELS in the graphics window of the widget with the indicated scaling for the ordinate.

DISR> T_MEANS, PIXELS

allows you to investigate gradients in sections of the specified image which could be useful for dark current measurements for example.  The TOOLS directory contains several little routines we have found useful.  They might have use for you too!

This section is for those who are really confident they understand everything or in case I'm dead!  You are desperate to modify the DISRSOFT system and know that there are a couple of smart routines in the system area but what do you do?  First, dont panic.  The simplest way of entering a new header entry into the system is to use D_NEWENT.  D_NEWENT is a widget driven routine with some error checking and lots of safety nets.  If you type

DISR> D_NEWENT

you immediately get an error message asking for a password.  This password can be found in the DISRSOFT system if you look hard enough. It is only meant to discourage you from poking about with this routine! So now you type

DISR> D_NEWENT,PASSWORD=password

The first thing you see is that the system backs itself up.  The widget interface then appears.  You can then modify or insert new parameters using the slider to run around the header.  If you are satisfied you can try to save and exit.  This will fail, however, unless you verify that the header is correct.  The verification is not terribly sophisticated but it picks up the obvious errors and reports in the text box.  Once the program thinks your new system will work it will give a "system verified OK" message and allow you to save and exit.  You must then re-start IDL and DISRSOFT for the new system to take effect.

Ah.  But you screwed up.  You want to restore the old system.  Well no problem.

DISR> D_NEWENT,PASSWORD= password, /RESTORE

brings the old stuff back again.  You can delete your old backup by

DISR> D_NEWENT,PASSWORD= password, /DEL_BACK

This routine is not yet built to handle multiple entries but it should be able to extend the header infinitely using the EXTRA keyword.  This part of the program is not extensively tested thus far.

D_NEWENT calls another little system routine called D_MKCOMM.  If you modify D_HOLDER.DOC, D_HOLD.DOC, and DISRHEAD.DOC in the documentation areas manually (see Appendix ), D_MKCOMM can be used to relieve the tedium of checking and editing the enormous common blocks needed by DISRSOFT.  D_MKCOMM also needs the password!

Another system only routine is D_HLINE.  This function is used to construct the header line from its component parts.  It is called from D_INSERT and can be used to make low level modifications to header entries by outputing what the header line should be.  You can then attempt to put this string directly into a header array without going through D_INSERT.

The last major system routine is D_TRANSL.  This routine is critical to the running of DISRSOFT and performs several useful tasks during the system startup.  I don't believe it has any use during a DISRSOFT session and should not be executed in the middle of a DISRSOFT session.

15/7/93	Inclusion of OGSE header entries
21/7/93	Inclusion of D_WREAD
27/7/93	STATUS reports are not only sent to the terminal when the STATUS parameter is NOT set.  If a failure occurs when the STATUS parameter is set the STATUS is correctly filled but no error report to the terminal occurs.
27/7/93	D_DELIM no longer asks questions if the STATUS parameter is set.  You can perform deletions inside a program in this way without having to stay at the terminal.
10/8/93	SYSTIME is now used as the default time inserted into H_FILETIME. This works under all operating systems.
10/8/93	Inclusion of H_ABSCAL ; an absolute calibration factor
10/8/93	Version 0.2 ready for EM testing
21/9/93	D_SEARCH now works correctly for exclusive (boolean AND) for DISRSOFT headers as well as ASCII code.
21/9/93	D_WREAD can now be used to pull IR data into the IDL environment as well as CCD data.
22/9/93	D_START now has a directory checker to be sure that the path to the main directory is correctly defined inside the procedure.  This should help if Piepenbrink changes the disk definitions for a 4th, 5th, 6th.... time!
22/9/93	Bug in D_WHELP fixed.  Note that a common block definition should not appear after a common block element has been defined in a procedure.  This causes a compilation error with a particularly cryptic message.
22/9/93	The names of some internal functions in D_CAT and D_SEARCH have been modified to avoid conflicts.
22/9/93	Released to Laura Ellen as 0.3 version.  Also supplied to Rainer.
12/10/93	D_RNAME included.  Fix to Unix separator in D_SEARCH made.  IDLSTART template for UNIX put into DOC.
12/10/93	T_WPROFI implemented as replacement for the profile generator.
15/10/93	D_WRAP and D_FILTER included in ENHANCE, based on DLR routine from 1986.
27/10/93	Inclusion of D_HCONT, D_WNAME, and T_LEAST.  Fix to UNIX separator on 12/10/93 introduced another bug.  Fixed. 
08/11/93	Inclusion of D_SORT routine, modification of D_SEARCH to search in sub-directories, and further changes to allow non-interactive non-widget use.  Tools T_VALDIR, T_GETFIL, T_GETDIR, T_TREE added to toolbox (used by D_SEARCH).  D_CAT modified to allow use of the tools.
23/11/93	Inclusion of new MMC header definitions and H_DC_OFFSET from MPAE.  D_MKCOMM program installed to allow fast common block update.  D_WHELP also modified for new data set definitions.  IR modified for H_SET_ID definition.
24/11/93	D_GETPRC program generalised to allow the fast extraction of all program templates for documentation.  D_HELP now eliminated.  START_PC template put in documentation area.  VERSIONS.REL documentation put in documentation area.
25/11/93	Inclusion of H_MODEL in header.  Inclusion of T_MJD tools for conversion of SYSTIME() output into modified Julian date.  Bug fixed in D_HCONT.
28/11/93	D_APPROC now can be used to write just a text line in the header as well as the processing history.  All system files now output the procedure call if the number of input parameters is not good.  D_INSERT no longer produces an IDL error if the entry number is undefined.  H_MISS_TIME_R now set to H_MISSION_TIME_R.  The difference in the PICKFILE procedure when writing with different operating systems has been taken into account in DISRSOFT.  This is really an IDL problem but.....  New template installed.  Logo completed.  This document now stored as a PS file in the documentation section.
03/12/93	Fix bug in T_WPROFI for long profiles
10/12/93	D_EXIST implemented as a standard error checker for headers and pixels in the system routines.  The read, write, and update programs now check whether the header is a DISR header.  If so, H_SET_ID is read to check the IR data set.  Thus the DISRSOFT read and write statements can now be used for other projects (e.g. IMP) without modification.  Bug fixed in D_SHEAD N_PARAMS control.  Implementation for DEC ALPHA attempted.  Still have problems with the FREE_LUN so that D_WRITE still fails.  Other routines are OK.
13/12/93	Additional error checks for T_IMAGE, T_MEANS, and T_WPROFI.  Bug fix in D_SHEAD and D_RHEAD.  SIMULATE directory added to startup path.

01/01/94	Version 1.0 released.

21/01/94	Changes to D_SEARCH and T_MEANS to improve the button widget indicators.  Incorporation of the new goodness criteria in D_HLINE.  Implementation of D_MKLIST in preparation for the post-processor.  Bug fixes for D_WREAD.  Implementation of D_WWRIT and D_ANOM (the anomaly checker) in the verification directory.  D_IRREAD and D_IRWRIT modified to allow reading of new IR data format.
24/01/94	D_WINSER (widget driven D_INSERT) implemented.  Hourglass cursor implemented for long waits.  D_DEFKEY implemented for the PC.  This function can also be used under xterm but not under VMS or HPTERM.  D_NEWENT routine implemented on all platforms.  DISRSOFT running fully under IDL 3.5.1 on all platforms.  T_MEANS now has a maximum draw widget size of half the screen.  The rest of the image can be found using scroll bars if necessary.  This avoids widgets disappearing when the image is too big.
31/01/94	D_SETID function implemented.  D_WHELP slider size increased.  D_SORT used to crash when no valid header entries found.  Fixed.  D_MKLIST has been modified so that several SET_IDs can be entered as a vector.  In this way you can select many different data sets and then make a list of parameters within them.  This is used by the new verification routines.  D_ANOM now issues a one line message if no errors were found.  Prototypes of D_PSTDIR, D_PSTPRC, and D_TOLIST implemented.  In the tools area, T_MKDIR implemented.  T_TREE has a new keyword where the directory can be entered.  T_SEPARA implemented.  This routine can be used to test if a separator (under VMS, UNIX, or WIN32) is present in a string.  Could be useful.
01/02/94	A crude format checker implemented in D_WINSER.  D_NEWENT bombed out when modifying some header entries.  I got some strange behaviour from the output of the WHERE function on the DEC Alpha with this program.  The output from WHERE when no match is found should be -1.  On printing, the output I found -1.  On assuming the output to be a vector and printing the first element of the output I got 0.  This is not normal behaviour and I was unable to reproduce it interactively. I used the COUNT parameter to get around this.  Bug fix on T_LAGR.  All system routines checked on PC under IDL 3.1 and 3.5.1.

03/02/94	Version 1.1 released.

03/02/94	Bug fix on T_LAGR (again!).  Change to T_IMAGE to prevent the widget slider crashing if the image is completely flat.
07/02/94	Inclusion of T_COLROW and T_HEXINT.  D_SHEAD has been given two extra keywords so that you can now direct the output to a string array without generating any other form of output.  T_IMAGE has received its long awaited PostScript output!!  C_COLORS.INC has been placed in the common directory.  D_WINSER has been modified to use the new D_SHEAD.  D_ISRSFT, the prototype of a new widget driven interface for DISRSOFT has been installed.  This program remains preliminary and cannot write anything away yet.  Same applies to S_FALSE.  This routine has been put in the simulation area for testing purposes but is not fully operational yet.  Inclusion of D_SETCOD and modification of D_SETID to allow you to determine the data set name and id from the last character of the filename.
28/02/94	Inclusion of the D_PARSE sub-routine in many system programs.  New keyword to D_WRITE for the case where a data set contains no pixels.  The startup procedure has been completely re-vamped.  D_START now works in IDL line mode using the @ sign from the prompt.  The startup procedure then searches for databases and presents a simple menu.  The D_CHGSYS routine has been implemented to allow changes to the path when changing from the default system.  The whole system now sits below a directory called CAL_SOFT in which all databases reside.  Changes to IR header entries included.
04/03/94	S_FALSE routine now seems to work.  It puts a lot of rubbish into the header but it is consistent rubbish for each data set.  Fix of error in D_HOLDER.DOC structure on header entries 124 and 125.  Two new common blocks entered into the system (C_CCD.INC and C_DISPL.INC).  These are not used by DISRSOFT and contain nothing.  They are used by HMC_SOFT.
07/03/94	Small modifications to S_FALSE and D_PSTPRC routines.  Bug fix on T_TREE.  Implementation of D_CHKSET, D_LMPTIM, and D_SHTTIM in verification area.  D_ISRSFT can now write.  D_WSHEAD implemented in system area.  Better "sticky" path implemented in D_WREAD.
15/03/94	S_CTESIM now with improved accuracy for final shift.  S_FALSE now fully running.  D_PSTPRC upgrading and working with S_FALSE.  New lower level routines for verification implemented (D_DSRTIM).  Implementation of S_CTE_HV.

17/03/94	Version 1.2 released.

18/03/94	T_COLROW column/row toggle now with no release on button widget call.  D_WREAD and D_READ now sense which database is being used before making a check on whether H_SET_ID is defined.  This is a more elegant way of determining how the data file should be read.
11/04/94	T_TVSURR put in toolbox.
18/04/94	T_CORREL and T_SUBMAX put in toolbox.  Change to D_CAT to allow you to click on a header entry and automatically update the catalogue list.
28/04/94	Changes to allow support of Mac and Sun operating systems.  This remains untested!!!!
18/05/94	Post-processor de-bugging performed.  H_MISSION_TIME with extended default format.  D_IRWRIT modified to allow the region and reading data from the geometry section to be vectors.  D_MKLIST errors removed.  D_TOLIST status reporting bugs fixed.  D_PSTPRC bugs for IR fixed.

20/05/94	Version 1.3 released.

06/06/94	D_APPROC bug fixed which inserted an extra space. Bug fix on D_TOLIST with the separator control.  LED tells me that PICKFILE and T_GETFIL misbehave with the filter='*.*' keyword is used.  Eliminated this keyword from D_WREAD and D_WWRIT.
04/07/94	Change of D_TEMPL to give a hard space in all entries even if empty to avoid memory problems. Modifications of D_IRWRIT and D_START for Mac operating systems.  D_PSTPRC replaced with version for MMC following tests with Lyn. T_COLROW no release on widget button put in place to avoid curious exclusive widget behaviour. D_ALLSET put into the system directory. FITS output added. T_IMAGE has a rotate capability added. D_NEWENT delete entry capability added.
05/07/94	D_LOOK implemented as a DISRSOFT image browser.

12/07/94	Version 1.5 released.

14/07/94	Lyn modified t_getfil to fix UNIX bug.  Entered into system.
29/07/94	Bug fix on T_COLROW. Improvements to T_CUTPST.  T_DIALOG dialogue box widget included. T_WEXTRA, T_MULFIT, and T_SUBSFT included in tools.
08/08/94	T_TRACER routine included in tools.  Dark and response matrices put in directories for DISR.
12/09/94	Inclusion of T_LOMMEL, T_MINNAE, and T_UNIVEC.  Modification of H_NUM_ROT entry to give a better definition. Modification of the anomaly checker after Laura Ellen.
16/10/94	D_LOOK can now read TIFF, BMP, and FITS format. D_START modified for the peculiar behaviour of the path under VMS.  D_START also modified to change the prompt depending on the system. D_CHGLCL implemented.
19/10/94	Inclusion of T_SYMBOL and D_DRKCAL.  Modification to T_MKDIR.
19/11/94	DISRSOFT headers extended to include calibration log file. Modifications to D_CAT for sub-directories. Bug fixes for D_NEWENT, D_INSERT, D_WHELP, D_SHEAD and D_WSHEAD for extended headers.  Inclusion of prototype of D_CCDSEG for CCD viewing.  D_INCCAL and D_RDCAL included in verification area for calibration log file.  T_MARK and T_GETFIL fixed for Mac.  Improvements to T_IMAGE (including new rotation capabilities), T_WPROFI, T_COLROW and T_TIMMJD.  Inclusion of first versions of T_PSSET (tools) and D_CO_FIL (system).
23/11/94	Implementation of PWD and T_SLWBOX routines. Modification to T_WEXTRA and T_IMAGE to use T_SLWBOX. Modifications to T_SIGMA to deal with the errors associated with staying in single precission. D_START modified to use EXPAND_PATH and now accesses ALL directories under the selected database.
28/11/94	Implementation of T_MOSAIC, T_ADDIMS, T_ZOOM, T_APLPSF, and T_MOVBOX. T_IMAGE modified to access T_ZOOM instead of old zoom routine.
09/12/94	Implementation of D_RDOGSE. Ported to OSF for DEC Alpha machines.
13/12/94	Modification of C_SYSTEM common block to include a flag to determine whether the system is a UNIX variant (C_UNIX) plus the short name of the current system (DISR, HMC, SNR, or IMP). Modifications to D_CCDSEG and D_CO_FIL. Inclusion of README documentation area.
18/12/94	Inclusion of entries 222 and 223 in DISRSOFT (mail from LED). Minor modification to C_SYSTEM.PRO. Improvements to handling of exclusive widget buttons in several routines.  Exclusive widget button events seem to be generated by all buttons when you click on just one in the Windows implementation. 

18/12/94	Version 1.6 released.

D_HOLDER.DOC is the important file in DISRSOFT.  It is a data file which defines the entire header system.  Messing about with it will cause (probably terminal) problems.  So how do you use it properly?  Below you can see a section of D_HOLDER.DOC.  The entries at each position in the row are

Char    Function
0		Entry number
5		Entry name
30		Single, Multiple, or Pointer entry code
32		Number of entries if a multiple entry, 1 if a single entry, 0 if a pointer
36		The default datatype of the entry according to the IDL definition
41		The default format of the entry
52 on	The crosses here indicate which DISR data set the header entry is generated by.  The crosses are in the order specified by the DATASETS.DOC

0    H_TYPE                   S 1   7    A1        xxxxxxxxxxxxxxxxxxxxxxxxx
1    H_DIRECTORY              S 1   7    A         xxxxxxxxxxxxxxxxxxxxxxxxx
2    H_FILENAME               S 1   7    A         xxxxxxxxxxxxxxxxxxxxxxxxx
3    H_FILETIME               S 1   7    A20       
4    H_LENGTH                 S 1   2    I         xxxxxxxxxxxxxxxxxxxxxxxxxx
5    H_DIMENSION              S 1   2    I1        xxxxxxxxxxxxxxxxxxxxxxxxxx
6    H_XSIZE                  S 1   2    I         xxxxxxxxxxxxxxxxxxxxxxxxxx
7    H_YSIZE                  S 1   2    I         xxxxxxxxxxxxxxxxxxxxxxxxxx
8    H_ZSIZE                  S 1   2    I         
9    H_DATATYPE               S 1   2    I1        xxxxxxxxxxxxxxxxxxxxxxxxxx
10   H_EXTENSION              P 0   2    I4        xxxxxxxxxxxxxxxxxxxxxxxxxx
11   H_EXTRA                  P 0   2    I4        xxxxxxxxxxxxxxxxxxxxxxxxxx
12   H_PROCESS                P 0   2    I4        xxxxxxxxxxxxxxxxxxxxxxxxxx
13   H_PURPOSE                S 1   7    A         xxxxxxxxxxxxxxxxxxxxxxxxxx

The EGSE generates most of the first few elements of the DISR header for every data set.  The following section of D_HOLDER.DOC shows that this is not always the case.

86   H_SET_ID                 S 1   2    I         xxxxxxxxxxxxxxxxxxxxxxxxx
87   H_SET_NUMBER             S 1   2    I         xxxxxxxxxxxxxxxxxxxxxxxxx
88   H_MISSION_TIME           S 1   5    F14.4     x  xxxxxxxxxxxxxxxxxx   x
89   H_CYCLE_NUMBER           S 1   2    I5             xxxxxxxxxx
90   H_CYCLE_TYPE             S 1   1    I2             x
91   H_SCEN_STEP              S 1   1    I2             x
92   H_SPM_FLAG               S 1   1    I2             x
93   H_CCD_MEAS               S 1   1    I2             xx
94   H_IR_MEAS                S 1   1    I2             xx
95   H_VIOLET_MEAS            S 1   1    I2             xx
96   H_MEAS_TYPE              S 1   1    I2               xxxxxxxx
97   H_AZIMUTH                S 1   4    F10.4          x
98   H_ALTITUDE               S 1   4    F11.4          x
99   H_SPIN                   S 1   4    F11.4          x

The system routine, D_TRANSL, translates the information in D_HOLDER.DOC and shoves it into common blocks defining default formats, default datatypes, and other stuff that nobody wants to know during the DISRSOFT system startup.  D_TRANSL uses string manipulations to extract the information from D_HOLDER.DOC, converts it into the correct format and then call C_SYSTEM.PRO and C_HEADER.PRO from the COMMON directory to initialise the common blocks.

D_HOLD.DOC is important because it is read by D_SHEAD to show what each entry in the header means.  It must therefore be complete and show exactly what each entry should mean.  DISRHEAD.DOC is used by the D_WHELP to provide a longer description of each header entry.  This text can be up to 55 characters while the description in D_HOLD.DOC must be short (otherwise the text gets truncated by D_SHEAD!!). 

The C_SYSTEM common block is initialised by the start-up procedure. The common block looks like this......

COMMON C_SYSTEM,C_OS,C_MAINDIR,C_VERSION,C_NAMES,C_POINTERS,$
C_MULTIPLES,C_DEFAULT,C_NUMMULTS,C_DISK,C_DEFDATA,C_PASSWORD,$
C_UNIX,C_DISRSYS

It includes the operating system (C_OS), the directory (C_MAINDIR) in which the current system exists (e.g. SNR_SOFT), the version number of the software (e.g. V1.6), the names of the default header entries, which are pointers, which are multiple entries (C_NUMMULTS), the disk in which C_MAINDIR sits (e.g. C:\CAL_SOFT), the default data formats for each header entry, the current system password, a flag which indicates whether the system is a UNIX variant or not (C_UNIX) and finally, the name of the system (e.g. DISR or IMP).  You may wish to use these variables to control your programs.  They should NOT however be modified during a session.

0    H_TYPE              HeaderType (H=HMC, D=DISR, I=IMP)
1    H_DIRECTORY         Directory where DataFile is located
2    H_FILENAME          FileName on Disk
3    H_FILETIME          Time File was last written by D_WRITE
4    H_LENGTH            Length of HeaderStringArray
5    H_DIMENSION         Number of Dimensions in Data
6    H_XSIZE             Number of Columns
7    H_YSIZE             Number of Rows
8    H_ZSIZE             Number of Images
9    H_DATATYPE          Type of Data [Byte,Int,LongInt,Float,Double,Complex...]
10   H_EXTENSION         Position in Header where ExtensionArea starts
11   H_EXTRA             Position in Header where ContourArea starts
12   H_PROCESS           Position in Header where ProcessingArea starts
13   H_PROJECT           Project
14   H_QUALITY           Imaging Quality
15   H_TITLE             Title
16   H_PURPOSE           Purpose of Obervation
17   H_SITE              Recording Site
18   H_DATE              Date & Time
19   H_ENGINEER          Test Engineer
20   H_TAPE              Tape on which Data were originally recorded
21   H_RECORD            Source Record Number
22   H_CAMERA            Camera Configuration
23   H_CCD               SeriesNumber of CCD
24   H_READOUT           Readout Configuration
25   H_VACUUM            Vacuum [yes/no]
26   H_TEMPERATURE       ambient Temp. [C]
27   H_LI_SOURCE         Light Source
28   H_LI_DIFF           Light Diffraction
29   H_LI_FILTER         Light Source Filter
30   H_LI_LEVEL          Light Level [W/m^2]
31   H_IMAGING           Imaging Mode
32   H_SENSOR            Sensor [A,B / C / D / E]
33   H_FILTER            HMC Filter
34   H_TIME              TDI (ECP) [micro sec.]
35   H_SUPERPIXEL        Super Pixel Control
36   H_CCD_GAINSW        CCD GainSwitch
37   H_SUNREF_TIME       Time Sun ReferencePulse [s]
38   H_STOPCLOCK         Time of StopClock [s]
39   H_SPINPERIOD        Spin Period [s]
40   H_AVER_PHASE        average PhaseReference [s]
41   H_ENC_TIME          Time to Encounter [s]
42   H_SEP_ANGLE         predicted SeparationAngle [deg]
43   H_SPINPHASE         SpinPhase [deg]
44   H_NUTRADIUS1        NutationRadius 1 [deg]
45   H_NUTRADIUS2        NutationRadius 2 [deg]
46   H_NUTPERIOD         NutationPeriod [s]
47   H_NUTPHASE1         NutationPhase 1 [deg]
48   H_NUTPHASE2         NutationPhase 2 [deg]
49   H_ZP_Y              ZP Y  [deg]
50   H_ZP_Z              ZP Z  [deg]
51   H_YBIN              Y Bin  (#‑1)
52   H_ZBIN              Z Bin  (#‑1)
53   H_CCD_THRES         CCD Threshold [DN]
54   H_RET_THRES         Reticon Threshold [DN]
55   H_IMAGE_ID          Image ID
56   H_COL_CODE          Colour Code
57   H_ALL_SENSORS       all active Sensors [see H_SENSOR]
58   H_ALL_SPC           all SuperPixel Control [original SuperPixel Format]
59   H_TM_CN_B_LRY       LowerRight Y for Sensor A,B
60   H_TM_CN_B_LRZ       LowerRight Z for Sensor A,B
61   H_TM_CN_B_ULY       UpperLeft  Y for Sensor A,B
62   H_TM_CN_B_ULZ       UpperLeft  Z for Sensor A,B
63   H_TM_CN_C_LRY       LowerRight Y for Sensor C
64   H_TM_CN_C_LRZ       LowerRight Z for Sensor C
65   H_TM_CN_C_ULY       UpperLeft  Y for Sensor C
66   H_TM_CN_C_ULZ       UpperLeft  Z for Sensor C
67   H_TM_CN_D_LRY       LowerRight Y for Sensor D
68   H_TM_CN_D_LRZ       LowerRight Z for Sensor D
69   H_TM_CN_D_ULY       UpperLeft  Y for Sensor D
70   H_TM_CN_D_ULZ       UpperLeft  Z for Sensor D
71   H_TM_CN_E_LRY       LowerRight Y for Sensor E
72   H_TM_CN_E_LRZ       LowerRight Z for Sensor E
73   H_TM_CN_E_ULY       UpperLeft  Y for Sensor E
74   H_TM_CN_E_ULZ       UpperLeft  Z for Sensor E
75   H_HK_COUNTER        HK FrameCounter
76   H_MEM_LOAD          MemoryLoad Commands
77   H_PULSE_CMD         Pulse Command
78   H_TM_STATUS         TM Status
79   H_DPU_TEST          DPU SelfTest
80   H_DET_STATUS        Detector Status
81   H_ROT_MECH          RotationMechanics Status
82   H_MIRR_FILTER       Mirror & Filter Status
83   H_EXP_STATUS        Experiment Status (word 73)
84   H_EXP_MODE          Experiment ImagingMode (word 74)
85   H_MODE_ACTUAL       Experiment Mode actual
86   H_MODE_ECP          Experiment Mode (ECP)
87   H_ACT_FILTER        actual Filter for Sensor C
88   H_NOM_FILTER        nominal Filter
89   H_NOMPOS_ROT        nominal Position of RotationMechanics
90   H_ACTPOS_ROT        actual  Position of RotationMechanics
91   H_ACT_START         actual  StartPosition of Mirror
92   H_NOM_START         nominal StartPosition of Mirror
93   H_ACT_STOP          actual  StopPosition of Mirror
94   H_NOM_STOP          nominal StopPosition of Mirror
95   H_SEN_AVAIL         Sensors available
96   H_MEM_AVAIL         Memory available
97   H_DRV_AVAIL         Drives available
98   H_0V                actual Value of  +0 V
99   H_M15V              actual Value of ‑15 V
100  H_15V               actual Value of +15 V
101  H_5V                actual Value of  +5.3 V
102  H_10V               actual Value of +10 V
103  H_M5V               actual Value of  ‑5 V
104  H_20V               actual Value of +20 V
105  H_TEMP_CCD1         Temperature of CCD1 [C]
106  H_TEMP_ROT          Temperature of RotationMechanics [C]
107  H_TEMP_EBOX         Temperature of E‑Box [C]
108  H_RET_PHAS_1        Reticon Phase 1
109  H_RET_PHAS_2        Reticon Phase 2
110  H_RET_PHAS_3        Reticon Phase 3
111  H_RET_PHAS_4        Reticon Phase 4
112  H_CCD_DAT_PB        CCD Phi PB
113  H_CCD_DAT_PC        CCD Phi PC
114  H_CCD_DAT_PD        CCD Phi PD
115  H_CCD_DAT_PE        CCD Phi PE
116  H_CCD_DT_SBC        CCD Phi SBC
117  H_CCD_DT_SDE        CCD Phi SDE
118  H_CCD_DT_RBC        CCD Phi RBC
119  H_CCD_DT_RDE        CCD Phi RDE
120  H_RET_INTENS        Reticon Intensity (#‑1)
121  H_RET_PIXEL         Reticon PixelAddress (#‑1)
122  H_RET_LINE          Reticon LineAddress (#‑1)
123  H_FP0               FP 0 (#‑1)
124  H_FP1               FP 1 (#‑1)
125  H_FP2               FP 2 (#‑1)
126  H_FP3               FP 3 (#‑1)
127  H_FP4               FP 4 (#‑1)
128  H_FP5               FP 5 (#‑1)
129  H_IM_CODE           ImageCode
130  H_TRACK_FILTER      TrackingFilter
131  H_SPOT_REJECT       single Spot Rejection /fast
132  H_RET_GAIN          Reticon Gain
133  H_TDI_SPU           TDI (SPU)
134  H_GRAVITY_Y         Centre of Gravity in Y (#‑1)
135  H_GRAVITY_Z         Centre of Gravity in Z (#‑1)
136  H_AREA_Y            SubArea Y  (#‑1)
137  H_AREA_Z            SubArea Z  (#‑1)
138  H_BRIGHTEST         Brightest Bin (#‑1)
139  H_YBIN_SPU          Y Bin (SPU)
140  H_ZBIN_SPU          Z Bin (SPU)
141  H_THRESHOLD         TrackingThreshold SPU
142  H_SEQ_ERROR         Sequencing Error (#‑1)
143  H_AREA_Y_SPU        SubArea Y (SPU)
144  H_AREA_Z_SPU        SubArea Z (SPU)
145  H_FP6               FP 6
146  H_FP7               FP 7
147  H_FP8               FP 8
148  H_FP9               FP 9
149  H_FP10              FP 10 (#‑1)
150  H_FP11              FP 11 (#‑1)
151  H_FP12              FP 12 (#‑1)
152  H_FP13              FP 13 (#‑1)
153  H_FP14              FP 14 (#‑1)
154  H_FP15              FP 15 (#‑1)
155  H_FP16              FP 16 (#‑1)
156  H_FLAGS             Flags
157  H_G_FLAGS           G‑Flags
158  H_T_FLAGS           T‑Flags
159  H_H_FLAGS           H‑Flags
160  H_HK_T_A            HK Thermistors [C]
161  H_HK_T_B            HK Thermistors [C]
162  H_HK_T_C            HK Thermistors [C]
163  H_ESTEC_HK          ESTEC HK Samples
164  H_TM_HEADER         original TM Header
165  H_COORD_XL          first ImageColumn
166  H_COORD_YL          first ImageLine (row)
167  H_COORD_XU          last  ImageColumn
168  H_COORD_YU          last  ImageLine (row)
169  H_USEFULL_XL        useful first ImageColumn
170  H_USEFULL_YL        useful first ImageLine (row)
171  H_USEFULL_XU        useful last  ImageColumn
172  H_USEFULL_YU        useful last  ImageLine (row)
173  H_STAT_AVE          mean PixelValue
174  H_STAT_VAR          Pixel Variance
175  H_STAT_MIN          Pixel Minimum
176  H_STAT_MAX          Pixel Maximum
177  H_EXPO_AVE          mean Value of exposed Area
178  H_EXPO_VAR          Variance of exposed Area
179  H_EXPO_MIN          Minimum of exposed Area
180  H_EXPO_MAX          Maximum of exposed Area
181  H_MASK_AVE          mean Value of masked Area
182  H_MASK_VAR          Variance of masked Area
183  H_MASK_MIN          Minimum of masked Area
184  H_MASK_MAX          Maximum of masked Area
185  H_UNEX_AVE          mean Value of unexposed Area
186  H_UNEX_VAR          Variance of unexposed Area
187  H_UNEX_MIN          Minimum of unexposed Area
188  H_UNEX_MAX          Maximum of unexposed Area
189  H_HISTOGRAM         ImageHistogram
190  H_TOTAL_TDI         TDI * WindowHeight
191  H_SCALE             ScaleFactor
192  H_MISS_DIST         MissionDistance [km]
193  H_ABS_FACTOR        absolute CalibrationFactor
194  H_SHOW_FACTOR       DisplayFactor
195  H_ATTITUDE_A        Azimuth   of the Sun
196  H_ATTITUDE_E        Elevation of the Sun                
197  H_ATTITUDE_3        xxx3
198  H_ATTITUDE_4        xxx4
199  H_ATTITUDE_5        xxx5
200  H_ATTITUDE_6        xxx6
201  H_ENC_TIM_IM        Time to Encounter at MidExposure [s]
202  H_TDI_SHOULD        nominal TDI [ms]
203  H_TDI_CROSS         TDI CrossingTime
204                      spare
205                      spare
206                      spare
207                      spare
208                      spare
209                      spare
210                      spare
211                      spare
212                      spare
213                      spare
214                      spare
215                      spare
216                      spare
217                      spare
218                      spare
219                      spare
220                      spare
221                      spare
222                      spare
223                      spare
224                      spare
225                      spare
226                      spare
227                      spare
228                      spare
229                      spare
230                      spare
231                      spare
232                      spare
233                      spare
234                      spare
235                      spare
236                      spare
237                      spare
238                      spare
239                      spare
240                      spare
241                      spare
242                      spare
243                      spare
244                      spare
245                      spare
246                      spare
247                      spare
248                      spare
249                      spare
250                      spare
251                      spare
252                      spare
253                      spare
254                      spare
255                      spare

This is the current IMP_SOFT d_hold.doc.

0    H_TYPE              Header type
1    H_DIRECTORY         Directory
2    H_FILENAME          Filename
3    H_FILETIME          Time file written
4    H_LENGTH            Length of header
5    H_DIMENSION         Number of dims
6    H_XSIZE             Number of columns
7    H_YSIZE             Number of rows
8    H_ZSIZE             Number of images
9    H_DATATYPE          Type of data
10   H_EXTENSION         extension area
11   H_EXTRA             extra area
12   H_PROCESS           processing area
13   H_PURPOSE           purpose of obs.
14   H_SUBJECT           subject of obs.
15   H_DATE              date obs. made
16   H_ENGINEER          engineer
17   H_SITE              site of obs.
18   H_SET_NAME          data set (text)
19
20   H_EXPOSURE_COUN     Multi exposure count
21   H_OPTICS_TEMP       edr OPTICS_TEMPERATU
22   H_CCDTEMP           CCD temperature [K]
23   H_REF_TEMP          CCD ref temp
24   H_ELEVATION_R0      obs. camera elev. ct
25   H_FRAME             CCD frame number
26   H_EXPOSURE_TYPE     CCD exposure type
27   H_AUTO_DATA_CUT     AutoExp cutoff pixl
28   H_AUTO_PERCENT      AutoExp target %
29   H_AUTO_DFLT_TIM     AutoExp initial time
30   H_DETECTOR          detector type
31   H_SENSOR_ID         sensor id number
32   H_COL_MIN           1st col of subframe
33   H_COL_MAX           last col of subframe
34   H_ROW_MIN           top row of subframe
35   H_ROW_MAX           last row of subframe
36   H_EXPTIME           exposure time [ms]
37   H_IMAGE_TIME        start time
38   H_ABSCAL            abs. cal. factor
39   H_LOCAL_TIME        edr LOCAL TIME
40   H_COMP_RATE         comprs bits/pixel
41   H_COMP_TYPE         compression type
42   H_COMP_QUALITY      compression quality
43   H_COMP_RATIO        compression ratio
44   H_Q_TABLE           compression Q table
45   H_AC_TABLE          Huffman AC table
46   H_DC_TABLE          Huffman DC table
47   H_SQRT_COMPRESS     Sqrt compression typ
48
49   H_CCD_SIDE          CCD side exposed ima
50   H_COORD_XL          coord (lower x)
51   H_COORD_YL          coord (lower y)
52   H_COORD_XU          coord (upper x)
53   H_COORD_YU          coord (upper y)
54   H_FILTER            filter number
55   H_GAIN              gain factor
56   H_DC_OFFSET         DC offset
57   H_FILTER_NAME       filter description
58
59
60   H_TIMING_GEN        timing gen
61   H_CAMERA            BB/EM/FM model
62   H_VACUUM            vacuum
63   H_OPTICS            optics
64   H_TESTLAMP          ext test lamp
65   H_SHUT_TIME         CCD shutter time
66   H_LED_TIME          LED on time
67
68
69
70   H_DARK_CORRECT      dark correction flag
71   H_FLAT_CORRECT      flat field correct f
72   H_BADPIX_CORREC     badpix correct flag
73   H_SHUTTER_CORRE     shutter correction f
74   H_IMAGE_MIN         image min value
75   H_IMAGE_MAX         max value on image
76   H_RICE_BLOCK        rice block size
77   H_RICE_OPTION       rice start option
78   H_RICE_NUMBER       rice number of optio
79   H_SYNC_INTERVAL     sync interval
80   H_GSE_REV           GSE revision
81   H_CONFIG_FILE       config file
82   H_TEST_LOG          test log
83   H_REC_BEG           first test log rec.
84   H_REC_END           last test log rec.
85   H_PIXEL_UNITS       units of pixels
86   H_SET_ID            data set id
87   H_SET_NUMBER        sequential number
88   H_MISSION_TIME      mission time
89   H_CYCLE_NUMBER      cycle number
90   H_CYCLE_TYPE        cycle type
91   H_SOLAR_AZIMUTH     sun azimuth (degrees
92   H_SOLAR_ELEV        solar elevation (deg
93   H_NORTH_AZIMUTH     north azimuth angle
94   H_IR_MEAS           IR sets req.
95   H_VIOLET_MEAS       violet sets req.
96   H_AZIMUTH           camera azimuth (deg)
97   H_ELEVATION         camera elevation (de
98   H_AZIMUTH_FOV       azimuth fov (degrees
99   H_ELEVATION_FOV     elevation fov (degre
100  H_FOCAL_LENGTH      focal length (mm)
101  H_PIXEL_HEIGHT      pixel height (micron
102  H_PIXEL_WIDTH       pixel width (microns
103
104
105  H_PACKET_ID         telemetry packet id
106  H_PACKETS_SENT      # packets expected
107  H_PACKETS_RCVD      # packets received
108
109  H_PARAMETER_TBL     parameter table #
110  H_FLAT_FIELD_ID     flat field #
111  H_BADPIXEL_TBL      badpixel table #
112  H_DARKCURRENT_I     darkcurrent image #
113
114
115
116  H_MOSAIC_LINE       mosaic reference lin
117  H_MOSAIC_SAMPLE     mosaic reference pix
118  H_MOSAIC_AZIMUT     mosaic ref azimuth
119  H_MOSAIC_ELEV       mosaic reference ele
120  H_PROJECTION        projection type
121  H_ORIENTATION       mosaic orientation
122  H_RESOLUTION        mosaic pixel resolut
123  H_RADIAL_RES        mosaic radial resolu
124  H_FIRST_AZIMUTH     left edge azimuth
125  H_ZERO_ELEV         line at 0 elevation
126  H_NADIR_LINE        nadir line #
127  H_NADIR_SAMPLE      nadir pixel
128  H_CAL_TMP_SORS      cal. source voltage
129  H_CCDLUG_TEMP       CCD lug temp [K]
130  H_COORD_TYPE        camera coordinate syst
131  H_DIRECTION_VEC     pointing direction vec
132  H_DIR_Y             "
133  H_DIR_Z             "
134
135
136  H_AUX_BRD_VOLT      divided 12V [V]
137  H_CPU_BRD_VOLT      divided 5V [V]
138  H_ADC_OFFSET        0V input; ADC offset
139  H_ADC_GAIN          2.5 input; ADC gain
140  H_TEST_TYPE         calibration test typ
141  H_TARGET_DISTAN     cm to target
142  H_SERIES            LSF/MSF series
143  H_ENV_CHAMBER       environmental chambe
144  H_CAL_CCD_TEMP      ccd temperature [K]
145  H_BASEPLATE_TMP     baseplate temp. [K]
146  H_PRESSURE          pressure (Torr)
147  H_STAGE_POSITN      linear stage postn (
148  H_STAGE_ROT         stage rotation (deg)
149  H_TARGET_TYPE       target type
150  H_MONO_WAVELEN      monochrometer wvl (n
151  H_MONO_BANDWID      monochrometer bndw (
152  H_STD_DETECTOR      standard detector
153  H_POLARIZATION      polarization (deg)
154  H_SLIT_WIDTH        slit width (mm)
155  H_CAL_LAMP_REP      cal. lamp repetition
156  H_NUM_BINS          IR bins for data
157  H_SURF_LAMP_REP     surface lamp rep.
158  H_SUN_LAMP_REP      sun sensor LED rep.
159  H_CAL1_VOLT1        volt cal. lamp 1
160  H_QUATERNION        camera orientation qua
161  H_Q_Y               "
162  H_Q_Z               "
163  H_Q_W               "
164  H_FOCAL_VECTOR      camera focal ctr. posn
165  H_F_Y               "
166  H_F_Z               "
167  H_HORIZONTAL_V      image plane horizontal
168  H_H_Y               "
169  H_H_Z               "
170  H_VERTICAL_VEC      image plane vertical v
171  H_V_Y               "
172  H_V_Z               "
173  H_NUM_HEAT          heaters tested
174  H_NUM_TRIPLET       sun triplets in set
175  H_NUM_TIME_PAIRS    time data pairs
176  H_DUMP_START        first word in dump
177  H_DUMP_LEN          words in dump set
178  H_DUMP_FLAG         packing flag
179  H_MESSAGE           message type code
180  H_MESSAGE_ID        more info code
181  H_NUM_BAD           bad ranges RAM/EEPRO
182  H_LOTS_BAD          flag bad RAM/EEPROM
183  H_CCDTEMP_R         Raw CCD temp
184  H_EXPTIME_R         Raw exposure time
185  H_MISSION_TIME_R    Raw mission time
186  H_AZIMUTH_R         Raw azimuth
187  H_ELEVATION_R       raw elevation counts
188  H_SPIN_R            Raw spin rate
189  H_TARGET_AZ_R       Raw target azimuth
190  H_ACTUAL_AZ_R       Raw actual azimuth
191  H_IR_CHP_TMPB_R     Raw IR temp start
192  H_IR_CHP_TMPE_R     Raw IR temp end
193  H_PRECHARGE_R       Raw av. precharge
194  H_IR_COL_TIME_R     Raw IR col time
195  H_CAL_TMP_SORS_R    Raw cal. source volt
196  H_CCDLUG_TEMP_R     Raw CCD lug temp
197  H_STRAP_TEMP_R      Raw strap temp
198  H_OPTICS_TEMP_R     Raw conduit temp
199  H_VIOLET_TEMP_R     Raw violet temp
200  H_SH_AUX_TEMP_R     Raw aux board temp
201  H_SH_BOX_TEMP_R     Raw box temp
202  H_EA_BOX_TEMP_R     Raw EA box temp
203  H_AUX_BRD_VOLT_R    Raw divided 12V
204  H_CPU_BRD_VOLT_R    Raw divided 5V
205  H_ADC_OFFSET_R      Raw 0V input
206  H_ADC_GAIN_R        Raw 2.5V input
207  H_CAL1_VOLT1_R      Raw lamp 1 volt
208  H_CAL1_VOLT2_R      Raw lamp 1 volt
209  H_CAL2_VOLT1_R      Raw lamp 2 volt
210  H_CAL2_VOLT2_R      Raw lamp 2 volt
211  H_CAL3_VOLT1_R      Raw lamp 3 volt
212  H_CAL3_VOLT2_R      Raw lamp 3 volt
213  H_SURF_VOLT1_R      Raw surf lamp volt
214  H_SURF_VOLT2_R      Raw surf lamp volt
215  H_SUN_LED_VLT1_R    Raw sun sensor LED
216  H_SUN_LED_VLT2_R    Raw sun sensor LED
217  H_OBJECTIVE         Objective of test
218  H_DUMMY             Dummy detector flag
219  H_MODEL             DISR model
220  H_DCOFFSETU_R       ULIS raw ADC
221  H_DCOFFSETD_R       DLIS raw ADC
222
223
224
225  H_SUN_SOURCE        source of spin data
226  H_OGSE_STATUS       status of OGSE
227  H_OGSE_MSG          last msg from EGSE
228  H_OGSE_LAMP         lamp current
229  H_OGSE_SUNFILE1     path of sun pulse fi
230  H_OGSE_SUNFILE2     path of sun pulse fi
231  H_OGSE_SAMP         sun ampli current
232  H_OGSE_SUNTABLE     sun table
233  H_OGSE_RPM          sun pulse RPM
234  H_OGSE_SPAN         sun pulse spam
235  H_OGSE_SIDEC        Si detector ref.
236  H_OGSE_GEDEC        Ge detector ref.
237  H_OGSE_EXTDEC       external det. ref.
238  H_OGSE_5V           5V ref.
239  H_OGSE_TEMP         int. temp.
240  H_OGSE_SSS_TEMP     sun sensor stim. tem
241  H_OGSE_GN           analog ground noise
242
243
244
245
246
247
248
249
250
251
252

This is the current SNR_SOFT disrhead.doc.

0    H_TYPE              header type
1    H_DIRECTORY         directory when last written
2    H_FILENAME          filename when last written
3    H_FILETIME          filetime when last written
4    H_LENGTH            header elements
5    H_DIMENSION         dimensions of following image
6    H_XSIZE             x size
7    H_YSIZE             y size
8    H_ZSIZE             z size
9    H_DATATYPE          datatype
10   H_EXTENSION         extension area (P)
11   H_EXTRA             extra area (P)
12   H_PROCESS           processing area (P)
13   H_PURPOSE           purpose of observation
14   H_SUBJECT           subject of observation
15   H_DATE              date observation made
16   H_ENGINEER          engineer completing observation
17   H_SITE              site where observation obtained
18   H_INSTRUMENT        instrument used
19   H_GRATING           Grating number or description for spectra
20   H_ORDER             The echelle order for spectra
21
22   H_CCDTEMP           CCD temp for observation
23   H_TECTEMP           TEC cold junction temperatures
24
25
26
27
28
29   H_ABS_CAL           absolute calibration factor
30   H_DETECTOR          detector used
31   H_SENSOR_ID         sensor identification number
32   H_CHIP_NO           chip numbers (WF: 1‑4, PC: 5‑8)
33
34
35
36   H_EXPTIME           exposure time [s]
37
38
39
40
41
42
43
44
45
46
47
48
49
50   H_COORD_XL          coord (lower x)
51   H_COORD_YL          coord (lower y)
52   H_COORD_XU          coord (upper x)
53   H_COORD_YU          coord (upper y)
54   H_FILTER            filter used
55   H_FILTER2           2nd filter used
56   H_SUPER_X           superpixel binning in x
57   H_SUPER_Y           superpixel binning in y
58   H_START_TIME        start time [s] from 00:00 UT
59   H_FINISH_TIME       finish time [s] from 00:00 UT
60   H_PIXX              pixel size in x [m]
61   H_PIXY              in y [m]
62   H_PIX_SIZE_X        Pixel size for imaging in arcsec per pixel
63   H_PIX_SIZE_Y        Pixel size for imaging in arcsec per pixel
64
65
66
67
68   H_ZENITHDIST        zenith distance
69   H_EXTINCTION        extinction value
70   H_AIRMASS           airmass
71   H_SLIT_LEN          slit length [mm]
72   H_SLIT_WID          slit width [mm]
73   H_RA                ra [deg]
74   H_DEC               dec [deg]
75   H_EPOCH             A and DEC
76   H_POS_ANGLE         position angle
77   H_CENTRAL           The central wavelength of spectra in Angstroms
78
79
80   H_GAIN              detector gain
81   H_UTTIME            UT time of end of measurement
82   H_FILTERNR          filter wheel no.
83   H_FILETRNR2         2nd filter wheel no.
84   H_PRE_FILTER1       preflash filter 2 (always=1)
85   H_PRE_FILTER2       preflash filter 2 (WF=47, PC=35)
86
87
88
89
90
91
92
93
94   H_PIXEL_UNITS       units of following image
95   H_OVERS_M           oversampled margin
96   H_OVERS_MSTD        overs. margin, standard dev.
97   H_WAVE_L0           start wavelength in [A]
98   H_WAVE_DL           wavelength increment [A]
99   H_X_START           spatial start position
100  H_X_DX              increment in  patial direction
101
102
103  H_W_RESOL           wavelength resolution [A]
104  H_W_RESID           dispersion residual  of wavelength calibration
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180  H_REFPX_RA          RAs of reference pixels
181  H_REFPX_DEC         DECs of reference pixels
182  H_REFPX_X           X coordinates of reference pixels
183  H_REFPX_Y           Y coordinates of reference pixels
184  H_DRA_DX            partials of RA w/respect to x
185  H_DRA_DY            partials of RA w/respect to y
186  H_DDEC_DX           partials of DEC w/respect to x
187  H_DDEC_DY           partials of DEC w/respect to y
188  H_ORIENTAT          north w/respect to chips 'up'
189  H_MIR_REVD          images mirror reversed (YES/NO)?
190  H_GOOD_MIN          minimum values of good pixels
191  H_GOOD_MAX          maximum values of good pixels
192  H_GOOD_MEAN         mean values of good pixels
193  H_GOOD_PIX          numbers of good pixels
194  H_BAD_PIX           numbers of bad pixels
195  H_DATA_MIN          minimum data values (incl. bad pixels)
196  H_DATA_MAX          maximum data values (incl. bad pixels)
197  H_SATURATE          value assigned to saturated pixels
198  H_X_TYPE            sky coordinate system & projection
199  H_Y_TYPE            sky coordinate system & projection
200  H_PHOT_TAB          name of photometry calibration table
201  H_PHOT_MODE         photometry modes
202  H_PHOT_ISENS        inverse sensitivities (erg/s/cm2/A for 1 DN/s)
203  H_PHOT_WLEN         pivot wavelengths (A)
204  H_PHOT_ZERO         photometric zeropoint magnitudes
205  H_PHOT_WIDTH        rms filter bandwidths (A)
206  H_WSCALE            scale factor for output image
207  H_WZERO             zero point for output image
208  H_BIAS_EVEN         bias level for even CCD rows
209  H_BIAS_ODD          bias level for odd CCD rows
210  H_PODP_FLAG         PODP fill present (0=no, 1=yes)?
211  H_PODP_FILL         PODP bad data fill pattern
212  H_STDC_FLAG         ST‑DCF fill present (0=no, 1=yes)?
213  H_STDC_FILL         ST‑DCF bad data fill pattern
214
215
216
217
218
219
220  H_SUN_RA            RA of the sun (deg)
221  H_SUN_DEC           DEC of sun
222  H_SUN_EQNX          equinox of the sun
223  H_SUN_ANGLE         angle between sun and V1 axis
224  H_SUN_ALT           altitude of the sun above earth's limb (deg)
225  H_MOON_ANGLE        angle between moon and V1 axis
226
227
228
229
230  H_PROP_ID           PEP proposal identifier
231  H_IMAGETYPE         dark/bias/intflat/kspots/external/earth‑calib
232  H_MOV_TARG          moving target flag (YES/NO)
233  H_KSPOTS            status of K spot lamp (ON/OFF)
234  H_MODE              instrument mode (FULL=full res., AREA=2x2 sum)
235  H_EXPFLAG           exposure interruption indicator
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

In the following pages, the documentation templates for all routines currently available are shown.  They appear alphabetically by directory beginning with procedures in the BATCH directory.

 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_ALLSET.PRO

;
; NAME:
;	D_ALLSET
; PURPOSE:
;	To make a table of data set IDs and their names. 
; CATEGORY:
;	Data set identification.
; CALLING SEQUENCE:
;	D_ALLSET , SET_IDS, SET_NAMES, SET_CODES [,STATUS]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	SET_IDS and SET_NAMES are the set ids and data set names for
;	DISR data sets.
;	SET_CODES gives the code which identifies the data set in the filename
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report.
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	c_system.inc
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	DISRSOFT only.
; EXAMPLE:
;	d_allset, ids, names
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	28‑05‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_ANOM.PRO

;
; NAME:
;        D_ANOM
; PURPOSE:
;        To determine anomalies in the disr data sets during verification pass
; CATEGORY:
;        Verification
; CALLING SEQUENCE:
;        D_ANOM,FILELIST [,FILENAME=FILENAME] [,STATUS]
; INPUTS:
;        FILELIST = the names of the files to be interrogated as string array.
; OPTIONAL INPUT PARAMETERS:
;        NONE
; OUTPUTS:
;        To screen unless the FILENAME keyword is set.
; OPTIONAL OUTPUT PARAMETERS:
;        STATUS = standard status report
; KEYWORDS:
;        FILENAME = the name of a file to which the output can be directed.
;        STRICT = a switch to apply the strict constraints to header entries
;        SOFT = a switch to apply soft constraints to header entries (default)
; COMMON BLOCKS:
;        C_SYSTEM and C_HEADER blocks needed.
; SIDE EFFECTS:
;        NONE
; RESTRICTIONS:
;        NONE
; PROCEDURE:
;        Pick up the anomalies table.
;        Read the header of each entry in the filelist.
;        Test whether it is a good header.
;        Test the value.  Report.
; MODIFICATION HISTORY:
;        13‑01‑1994  NT  Prototype
;	 21‑01‑1994  NT  Bug fix on header error.
;	 27‑02‑1994  NT  Inclusion of D_PARSE sub‑routine.
;	 16‑03‑1994  NT  Removal of spurious print statement. 
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_APPROC.PRO

;
; NAME:
;	D_APPROC
; PURPOSE:
;	Append processing history to a header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_APPROC,HEADER_IN,HEADER_OUT,PROCESS,VERS [,STATUS] [,TEXT=TEXT]
; INPUTS:
;	HEADER_IN = input header
;	PROCESS = the process undergone or the text needed for input
;	VERSION = the version number of the process in the form 'V1.0'
;		If straight text is input, this parameter is ignored.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT = the output header with process appended
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	TEXT ‑ if this keyword is set the full text input as PROCESS is placed
;		in the processing history.  Thus instead of entering
;		a process name the image has undergone, you can type in
;		a long comment.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The process name will be truncated to 32 characters in the
;	event of being longer and is converted to upper case.
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; EXAMPLE:
;	D_APPROC,H,H1,'D_REPAIR','V1.0'  makes a note in header H that D_REPAIR
;		has been used on the corresponding image.
;
;	D_APPROC,H,H1,'I was pissed out of my head when I processed this '+$
;		'image so I bare no responsibility for its contents!',/TEXT
;	The above shows an example of a text comment.  The date is appended
;	to the entry so you can keep a track of the dates when you got
;	pissed!
;	
; MODIFICATION HISTORY:
;	31‑MAY‑1991  NT
;	14‑1‑1992  nt removal of DISR specfic lines
;	15‑1‑1993  NT  Revision to allow same variable
;			to be both input and output
;	27‑11‑1993 NT  Inclusion of the text mode
;	10‑12‑1993 NT  Use of D_EXIST implemented
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_CAT.PRO

;
; NAME:
;	D_CAT
; PURPOSE:
;	A procedure to scan all headers in a directory for specific
;	header entries and put them into a catalogue.
; CATEGORY:
;	Database study.
; CALLING SEQUENCE:
;	D_CAT, [ENTRIES=ENTRIES] [,DIRECTORY=DIRECTORY] [,FILTER=FILTER]
;			[,/SUB] [,STATUS]
;	This is a prototype program for making a catalogue of DISRSOFT
;	headers.
;
;	Select the files you wish to study using the file and directory
;	filters.  These are adapted from the IDL pickfile.
;
;	You can then enter the names of header entries in the 12 text
;	editable text widgets in the column marked "ENTRIES".  The entry
;	number and format will be updated as soon as you type <return>.
;	The format however is also EDITABLE!!!  There are currently no
;	error checks on the format so this can crash the program when you
;	ask the program to catalogue if you put stupid formats in there.
;	But this can help you format your catalogue correctly.  The available
;	header entries are on the right.  Note that I DO check for stupid
;	entries!!  You may also click on an entry in the listing.  The header
;	entry is then included in the ENTRIES column at the highest available
;	position.
;
;	You may enter a first line.  This might be the header for the columns
;	for example.  Something like that.
;
;	When you are happy, click on the button widget Catalogue and the
;	program will make the table.  Once this is completed you can exit,
;	repeat it or write it away to file by clicking on Write.  This will
;	prompt you for a file name.  If the write fails, the computer will
;	beep at you (an error message is also written to the error box).
;
;	You can set a switch when entering D_CAT to allow you to access
;	all sub‑directories if you wish.
;
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	A file can be output from inside the program containing the
;	current contents of the catalogue.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	DIRECTORY = a specification of which directory to use for
;		the search.  Default is current.
;	FILTER = a file filter.  Default is '*.*'
;	ENTRIES = an integer vector of up to 12 elements
;		containing the entry numbers in the header you wish
;		to have in the catalogue at start‑up 
;	SUB = a switch which if set catalogues all
;			files in sub‑directories corresponding to required
;			filter.
; COMMON BLOCKS:
;	C_CAT = internal common block
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Although the routine is fairly robust if you include a file which is NOT
;	a disrsoft file in your file list, I have found some files which cause
;	IDL to crash completely when you try to access them through this routine
;	particularly on the HP.  You can guard against this using the file filter.
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	12‑8‑1993  nt PROTOTYPE
;	27‑11‑1993 NT Modification of PICKFILE call because of the
;			difference in the structure of the output between
;			windows and other operating systems.
;	07‑01‑1994 NT correction for IDL v3.5 for change in TAG_NAMES of widget_
;			text
;	26‑02‑1994 NT use of new D_PARSE routine
;	18‑04‑1994 NT Inclusion of sub‑directory option and use of header
;			entry list to fill which entries you need to catalogue
;	28‑04‑1994 NT Inclusion of MacOS separator definition to allow use on
;			Mac.
;	08‑11‑1994 NT Scroll bar on output included and error box put in.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_CCDSEG.PRO

; 
; NAME: 
;       D_CCDSEG 
; PURPOSE: 
;       To show which segment of the CCD a DISRSOFT CCD image has come 
;       from. 
; CATEGORY: 
;       Display 
; CALLING SEQUENCE: 
;       D_CCDSEG,HEADER_IN,PIXELS_IN [,status] 
; INPUTS: 
;        None 
; OPTIONAL INPUT PARAMETERS: 
;       HEADER_IN,PIXELS_IN = a DISRSOFT header and pixels from DISR for default. 
; OUTPUTS: 
;       A widget or a file. 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report. 
; KEYWORDS: 
;       None 
; COMMON BLOCKS: 
;       c_header.inc and c_system.inc 
; SIDE EFFECTS: 
;       The widget allows you to read another header and pixels from inside 
;       the routine.  The last header and pixels read is output as header and 
;       pixels. 
; RESTRICTIONS: 
;       None 
; EXAMPLE: 
;       D_CCDSEG 
; PROCEDURE: 
;       Based on values given by Lyn, LED, and Diane communications from 
;       Oct 14 1994 and Nov. 9 1994. 
; MODIFICATION HISTORY: 
;       09‑12‑1994 NT 
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\STARTUP\D_CHGLCL.PRO

;    
; NAME:    
;      D_CHGLCL    
; PURPOSE:    
;      To change the disrsoft path to point to a local directory with
;	a name other than local. 
;      
; CATEGORY:    
;      System software     
; CALLING SEQUENCE:    
;      D_CHGLCL , LOCAL_NAME [,STATUS]     
; INPUTS:    
;      LOCAL_NAME = the name of the new local directory under the current 
;		DISRSOFT system.
; OPTIONAL INPUT PARAMETERS:    
;      NONE     
; OUTPUTS:    
;      NONE     
; OPTIONAL OUTPUT PARAMETERS:    
;      STATUS = standard status report     
; KEYWORDS:    
;      NONE     
; COMMON BLOCKS:    
;      NONE     
; SIDE EFFECTS:    
;      The path is affected.     
; RESTRICTIONS:    
;      NONE     
; EXAMPLE:    
;      D_CHGLCL , 'special', STATUS     
; PROCEDURE:    
;      Search the path under all operating systems.  Eliminate entries     
;      referring to the 'local' directory name.  Insert the name of the
;	new directory in the path.   
; MODIFICATION HISTORY:    
;	15‑10‑1994 NT
;    
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\STARTUP\D_CHGSYS.PRO

;    
; NAME:    
;      D_CHGSYS    
; PURPOSE:    
;      To change the DISRSOFT system startup from one system to another   
;      before running the D_START procedure.    
; CATEGORY:    
;      System software     
; CALLING SEQUENCE:    
;      D_CHGSYS , SYSTEM [,STATUS]     
; INPUTS:    
;      SYSTEM = the name of the new system    
;          Possible values are   
;                   'DISRSOFT'   
;                   'SNR_SOFT'   
;                   'IMP_SOFT'   
;                   'DISRTEST'   
;                   'HMC_SOFT'   
;   
; OPTIONAL INPUT PARAMETERS:    
;      NONE     
; OUTPUTS:    
;      NONE     
; OPTIONAL OUTPUT PARAMETERS:    
;      STATUS = standard status report     
; KEYWORDS:    
;      NONE     
; COMMON BLOCKS:    
;      NONE     
; SIDE EFFECTS:    
;      The path is affected.     
; RESTRICTIONS:    
;      NONE     
; EXAMPLE:    
;      D_CHGSYS , 'DISRSOFT', STATUS     
; PROCEDURE:    
;      Search the path under all operating systems.  Eliminate entries     
;      referring to the old system.  Insert the name of the new common   
;      block in the path.   
; MODIFICATION HISTORY:    
;      25‑02‑1994 NT     
;      08‑10‑1994 NT Modified to account for case sensitive behaviour on 
;                       text libraries in the IDL path. 
;    
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_CHKSET.PRO

;
; NAME:
;	D_CHKSET
; PURPOSE:
;	To determine how many files there are of a certain data set.
; CATEGORY:
;	Post‑processor
; CALLING SEQUENCE:
;	OUTPUT=D_CHKSET(DATA_SETS,DIRECTORY,FILENAMES [,READ=READ,STATUS])
; INPUTS:
;	DATA_SETS = the names of the data sets to be searched for
;			This can be a scalar string or a vector string.
;	DIRECTORY = the path below which the search will be performed
;			NOTE that sub‑directories are also searched!!
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	FILENAMES = the full names of the files found
;	OUTPUT = the number of files found
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	READ = if set the procedure reads all the headers found to verify
;		that they are DISRSOFT files.
; COMMON BLOCKS:
;	c_system and c_header blocks
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The procedure checks the last letter of the filename to establish
;	which data set it is.  If there are files in the directory structure
;	which are NOT disrsoft files then these may also be returned if the
;	last letter of the filename agrees with the data set requested.
;	This program makes no difference between DISRSOFT files and other
;	file types.  This is good in that this routine is fast but is
;	obviously not a fool proof method.  To be full‑proof, you must
;	read the files and check the data set id.  This is MUCH slower
;	but is performed by setting the READ keyword.
;
; EXAMPLE:
;	PRINT,D_CHKSET(['BAD RAM','IMAGE'],'C:\CAL_SOFT\DISRSOFT'
;			,FILENAMES,/READ)
;		25
;
; PROCEDURE:
;	Determine whether DATA_SETS is a scalar or a vector.
;	Loop or otherwise through T_TREE
;
; MODIFICATION HISTORY:
;	06‑03‑1994  NT  Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_CO_FIL.PRO

;
; NAME:
;	D_CO_FIL
; PURPOSE:
;	To fill the correct detector coordinates into the header depending
;	upon the data set type.
; CATEGORY:
;	Header manipulation.
; CALLING SEQUENCE:
;	D_CO_FIL,HEADER_IN,HEADER_OUT[,STATUS]
; INPUTS:
;	HEADER_IN = the input header
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT = the output header
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	c_header
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Looks at h_set_id to find the set id for determination of values
; EXAMPLE:
;	d_co_fil,h,h1
; PROCEDURE:
;	Trivial.  Find the set id.  Use a look up table.
;
; MODIFICATION HISTORY:
;	09‑12‑1994  NT	
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\STARTUP\D_DEFKEY.PRO

;
; NAME:
;	D_DEFKEY
; PURPOSE:
;	To define the function keys for standard DISRSOFT routines
; CATEGORY:
;	Screwing around
; CALLING SEQUENCE:
;	D_DEFKEY
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	REMOVE = if set removes the DISRSOFT function keys
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The function keys are set to put strings on the command line
;	for quick start.
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Trivial.  Use DEFINE_KEY.
;
; MODIFICATION HISTORY:
;	21‑01‑1994 NT  Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_DELIM.PRO

;
; NAME:
;	D_DELIM
; PURPOSE:
;	To delete a DISR file.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_DELIM, FILENAME [, STATUS]
; INPUTS:
;	FILENAME = name of the file to be deleted
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	1‑Jun‑1991  NT
;	18‑May‑1993  NT revision
;	27‑Jul‑1993 NT Inclusion of STATUS check.  Note that if the STATUS
;		parameter is set then the user is NOT PROMPTED to ensure
;		the file is deleted!!  This is new.
;	28‑04‑1994 NT Adapted for Sun and Mac.  Now uses !version.os rather
;			than C_OS. 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\RADIO\D_DRKCAL.PRO

;   
; NAME:   
;       D_DRKCAL   
; PURPOSE:   
;       To produce a dark matrix for the specified temperature   
;       and exposure time for the CCD.   
; CATEGORY:   
;       Calibration   
; CALLING SEQUENCE:   
;       D_DRKCAL,HEADER,PIXELS,TEMPERATURE,EXPOSURE_TIME$   
;       [,/SPECTROMETER] [,CCD_NO=CCD_NO] [,STATUS]   
; INPUTS:   
;       TEMPERATURE = the temperature of the CCD [K]   
;       EXPOSURE_TIME = the required exposure time [ms]   
; OPTIONAL INPUT PARAMETERS:   
;       NONE   
; OUTPUTS:   
;       HEADER,PIXELS = header and pixels of the computed dark   
;       matrix.   
; OPTIONAL OUTPUT PARAMETERS:   
;       STATUS = standard status report   
; KEYWORDS:   
;       SPECTROMETER = if set, computes the dark matrix for the   
;               spectrometer observations.   
;       CCD_NO = CCD number in MPAE nomenclature (default=64)   
; COMMON BLOCKS:   
;       C_HEADER   
; SIDE EFFECTS:   
;       NONE   
; RESTRICTIONS:   
;       Must be within the operating temperature of the CCD   
;       (between 193 K and 303 K).
;
;      The accuravy of this routine has been assessed by comparison with
;      lab. data.  Using a spectrometer section image at 288 K with 
;      5000 ms exposure time, an error in the background level of 0.125 DN
;      was found.  The standard deviation of the difference was 0.556 DN.
;      A large contribution to these values comes from hot spots which
;      could be clearly seen in the difference image.
;
;      nt  19/10/1994
;
; EXAMPLE:   
;       D_DRKCAL,H,P,256.,500.,/SPECTROMETER   
; PROCEDURE:   
;       Determine which four matrices are needed by finding   
;       the nearest neighbours.   
;       Read in the 0 ms images.   
;       Interpolate.   
;       Read in the 32000 ms exposures.   
;       Subtract the 0 ms exposures.   
;       Interpolate logarithmically for the dark current.   
;       Multiply by the ratio of the exposure times.   
;       Add to the zero second exposure.   
; MODIFICATION HISTORY:   
;       18‑10‑1994  NT   Prototype   
;   
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\RADIO\D_DRKSUB.PRO

;
; NAME:
;	D_DRKSUB
; PURPOSE:
;	To subtract a dark matrix from a specified image.
; CATEGORY:
;	Calibration.
; CALLING SEQUENCE:
;	D_DRKSUB,HEADER_IN,PIXELS_IN,HEADER_OUT,PIXELS_OUT [,STATUS]
;			[,CCD_NO=CCD_NO]
; INPUTS:
;	HEADER_IN,PIXELS_IN =the header and pixels of the input image
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT,PIXELS_OUT = the dark current corrected image
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	CCD_NO = the number of the CCD (default = 64)
; COMMON BLOCKS:
;	c_system
;	c_header
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	D_DRKSUB,H,P,H1,P1,CCD_NO=62
; PROCEDURE:
;	Extract the exposure time and CCD temperature from the image.
;	Determine if the coordinates have been filled.
;	If not then fill them.
;	Extract coordinates.
;	Spectrometer or image?
;	Complete subtraction.
; MODIFICATION HISTORY:
;	07‑11‑1994 NT  Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\RADIO\D_DRKVAL.PRO

;
; NAME:
;	D_DRKVAL
; PURPOSE:
;	To determine the generation of dark current on the
;	DISR CCDs in the individual areas of the chips
; CATEGORY:
;	Dark current analysis
; CALLING SEQUENCE:
;	D_DRKVAL,FILE1,FILE2,OUTPUT  [,STATUS]
; INPUTS:
;	FILE1 = the name of a file obtained using 0 secs exposure
;		time.
;	FILE2 = the name of a file taken with a finite exposure time
;		AT THE SAME TEMPERATURE as FILE 1!
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = a vector containing the following elements
;		0 ‑ the rate of dark current generation in the serial register
;		1 ‑ the rate of dark current generation in the memory area
;		2 ‑ the rate of dark current generation in the memory area
;			below the masked pixels but on lower section
;		3 ‑ the rate of dark current generation in the memory area
;			below the masked pixels on UPPER section
;		4 ‑ the "rate of dark current generation" in the extra pixels
;		5 ‑ the rate of dark current generation in the image section
;		6 ‑ the rate of dark current generation in the masked pixel
;			area
;		7 ‑ CCD temperature
;		8 ‑ device number
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The routine checks for the temperature using H_CCDTEMP.  If the
;	two temperatures are different by > 1 C, the routine aborts.
;	No check is made on the contents of the frame  i.e. the program
;	assumes you know which frames you are playing with.
;	A check will be made on the exposure times to ensure they are
;	OK.
; PROCEDURE:
;	Error check.  Read the files.  Check the temperatures.  Check
;	the exposure times.  Take the zero second exposure file. 
;	Determine the slope in the x and equate this to the clocking
;	speed.  Determine the slope in the y.  Equate this to the
;	clocking speed in the y.  Do the same for the masked area.
;	Remove these influences from the high exposure time image
;	and compute the mean dark current in the image area
;	and the masked area.  Finally, investigate changes in the
;	extra pixels.
;
; MODIFICATION HISTORY:
;	11‑11‑1993  nt
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_DSRTIM.PRO

;
; NAME:
;	D_DSRTIM
; PURPOSE:
;	To determine how long DISR has been switched
; 	on for.
; CATEGORY:
;	Post‑processor
; CALLING SEQUENCE:
;	D_DSRTIM,FILELIST,DISR_ON_TIME,ANALYSE=ANALYSE,STATUS
; INPUTS:
;	FILELIST = a list of DISR images
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	DISR_ON_TIME = a scalar floating point number
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	ANALYSE = a keyword which if present forces D_DSRTIM to use
;		the second more complex algorithm.
; COMMON BLOCKS:
;	C_HEADER is used to access the relevant header entries
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Plenty.  See procedure.
; EXAMPLE:
;	D_DSRTIM,FILELIST,DISR_ON_TIME,/ANALYSE, STATUS1
; PROCEDURE:
;	It is assumed that you have produced a list of filenames from
;	one log run of the DISR.  This would normally be a complete
;	list of TIME data sets (although the program checks to determine
;	if the set id is correct for a TIME data set).
;	
;	OPTION 1 ‑‑‑ If a valid time data set
;	is found then the total is incremented by 40 seconds
;	(the time between consecutive time data sets).
;
;	OPTION 2 ‑‑‑ All time data sets are read in full.  The first
;	element of each array is read.  The DISR_ON_TIME is then computed
;	as the difference between the low number and the highest number
;	+ 40 s.
; MODIFICATION HISTORY:
;	15‑03‑1994  NT
;	16‑03‑1994  NT  Option to use the mission time data from the
;			data set itself to work out the time.
;			
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_EXIST.PRO

;
; NAME:
;	D_EXIST
; PURPOSE:
;	A function to verify whether input header and pixels exist
;	and conform to the DISRSOFT size and format for headers.
; CATEGORY:
;	System checking
; CALLING SEQUENCE:
;	OUTPUT = D_EXIST(INPUT [,ERROR_MESS] [,/HEADER] [,/PIXELS] [,STATUS])
; INPUTS:
;	INPUT = either a header or a set of pixels for verification
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	if the /HEADER keyword is set then OUTPUT = 1 if INPUT
;	is a uni‑dimensional string array of more than 255 elements,
;	otherwise OUTPUT = 0
;
;	if the /PIXELS keyword is set then OUTPUT = 1 if INPUT
;	exists, has less than 4 dimensions, and is not a string
;	or a structure, otherwise OUTPUT = 0
;
;	OUTPUT is set to ‑1 if there is a crash
;
; OPTIONAL OUTPUT PARAMETERS:
;	ERROR_MESS = a message concerning the error found by D_EXIST
;	STATUS = standard status report
; KEYWORDS:
;	HEADER, if set tells the program to test if INPUT is a header
;		(default)
;	PIXELS, if set tells the program to test if INPUT is a set of
;		pixels 
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Use the SIZE function to verify the data structure.
;	For DISRSOFT headers check that the length matches correctly
;	and that the pointers are integers within bounds.
; MODIFICATION HISTORY:
;	10‑12‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\ENHANCE\D_FILTER.PRO

; NAME:
;	D_FILTER
; PURPOSE:
;	The routine enhances a given image by a standard filter method
; CATEGORY:
;	ENHANCEMENT
; CALLING SEQUENCE:
;	D_FILTER, HEADER_IN, PIXELS_IN, HEADER_OUT, $
;		PIXELS_OUT [, MODE = mode [, D0 = d0 [, ND1 = nd1 [, STATUS ]]]]
;
; INPUTS:
;	HEADER_IN, contains the header information of the input image,
;		string array
;	PIXELS_IN, contains the pixel data of the input image, two
;		dimensional array of any type except string, undefined 
;		or complex
; KEYWORDS:
;	MODE, selects the filter function, string with two characters.
;		The MODE parameters are:
;
;		'IL' ‑‑> Ideal lowpass filter (ILPF)
;			          [ 1 	for D(u,v) <= D0
;		         H(u,v) = [
;				  [ 0	for D(u,v) >  D0
;               ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'IH' ‑‑> Ideal highpass filter (IHPF)
;				  [ 0   for D(u,v) <= D0
;			 H(u,v) = [
;				  [ 1   for D(u,v) >  D0
;               ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'BL' ‑‑> Butterworth lowpass filter (BLPF)
;			          [
;			 H(u,v) = [ 1/(1 + (D(u,v)/D0)^(2*ND1))
;				  [
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'BH' ‑‑> Butterworth highpass filter (BHPF)
;				  [
;			 H(u,v) = [ 1/(1 + (D0/D(u,v))^(2*ND1))
;			          [
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'EL' ‑‑> Exponential lowpass filter (ELPF)
;			 	  [
;			 H(u,v) = [ exp(‑(D(u,v)/D0)^ND1)
;				  [
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'EH' ‑‑> Exponential highpass filter (EHPF)
;				  [
;			 H(u,v) = [ exp(‑(D0/D(u,v))^ND1)
;				  [
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'TL' ‑‑> Trapezodial lowpass filter (TLPF)
;				  [ 1	for D(u,v) < D0
;			 H(u,v) = [ (D(u,v) ‑ ND1)/(D0 ‑ ND1) 
;				  [ for D0 <= D(u,v) <= ND1
;				  [ 0   for D(u,v) > ND1
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		'TH' ‑‑> Trapezodial highpass filter (THPF)
;				  [ 0   for D(u,v) < ND1
;			 H(u,v) = [ (D(u,v) ‑ ND1)/(D0 ‑ ND1) 
;				  [ for ND1 <= D(u,v) <= D0
;				  [ 1   for D(u,v) > D0
;		‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
;		The default mode is 'IL'.
;		The distance function is defined as:
;
;		sample_x = 13.75E‑6
;		sample_y = 13.75E‑6
;		Delta_u = pi / ((x_size/2) * sample_x)
;		Delta_v = pi / ((y_size/2) * sample_y)
;
;		D(u,v) = ((u*delta_u)^2 + (v*delta_v)^2)^0.5 for all 
;		points (u,v) of the image.
;
;		D(0,0) is in the centre of the image.
;
;	D0, floating point number, contains the filter cutoff frequency,
;		D0 = 2*PI*frequency
;		(default D0 = 1.0E5 [1/s])
;	ND1, floating point number, contains for
;		‑ the Ideal filters (not used)
;		‑ the Butterworth filters the order of the filter function
;		  (default ND1 = 2.0)
;		‑ the Exponential filters the order of the filter function
;		  (default ND1 = 2.0)
;		‑ the Trapezodial filters the zero‑crossing frequency.
;		  (default ND1 = D0*2.0 for TLPF and
;			   ND1 = D0/2.0 for THPF)
;
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS: 
;	HEADER_OUT, contains the header_information of the output image, 
;		string array
;	PIXELS_OUT, contains the pixel data of the output image, two 
;		dimensional array, same type as PIXELS_IN
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS: 
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;
; PROCEDURE: For a description of the algorithm see
;		Gonzalez, R. Wintz, P.: Digital Image Processing
;		chapter 4.3, pp 139‑166
;
; MODIFICATION HISTORY:
;	July 1986	DFVLR OBERPFAFFENHOFEN
;	Oct 1993  NT Adapted for DISRSOFT IDL v3.1
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\BATCH\D_GETPRC.PRO

;   
; NAME:   
;       D_GETPRC   
; PURPOSE:   
;       To extract the documentation headers from all DISRSOFT programs   
;       and place them in an output file.    
; CATEGORY:   
;       Documentation   
; CALLING SEQUENCE:   
;       D_GETPRC,OUTFILE [,STATUS]   
; INPUTS:   
;       OUTFILE = the name of an output file where the documentation   
;               will be placed.   
; OPTIONAL INPUT PARAMETERS:   
;       NONE   
; OUTPUTS:   
;       To disk   
; OPTIONAL OUTPUT PARAMETERS:   
;       STATUS = standard status report   
; KEYWORDS:   
;       NONE   
; COMMON BLOCKS:   
;       NONE   
; SIDE EFFECTS:   
;       NONE   
; RESTRICTIONS:   
;       Should only be used on the PC at present but may be upgraded in   
;       future if required.   
; PROCEDURE:   
;       Trivial   
;   
; MODIFICATION HISTORY:   
;       24‑11‑1993 NT   
;       15‑09‑1994 NT Modified to sort by filename.  
;   
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_HCONT.PRO

;
; NAME:
;       D_HCONT
; PURPOSE:
;       To read a vector of files and extract 2 header entries
; CATEGORY:
;       Database evaluation
; CALLING SEQUENCE:
;	D_HCONT, NAMETABLE, ENTRY1, ENTRY2, HEADER_VAL1, HEADER_VAL2 [, STATUS]
; INPUTS:
;       NAMETABLE = a string vector containing the filenames of DISR files
;       ENTRY1,ENTRY2 = the header entries to be extracted from the headers.
; OPTIONAL INPUT PARAMETERS:
;       NONE
; OUTPUTS:
;       HEADER_VAL1,HEADER_VAL2 = the values contained in the header entries
; OPTIONAL OUTPUT PARAMETERS:
;       STATUS = standard status report
; KEYWORDS:
;       NONE
; COMMON BLOCKS:
;       C_SYSTEM
;       C_HEADER
; SIDE EFFECTS:
;       NONE
; RESTRICTIONS:
;       NONE
; PROCEDURE:
;       Check the nametable size.
;	       Check the format and set the vector size and datatype.
;       Read the headers and fill up the arrays.
; EXAMPLE:
;	D_HCONT,NAMETABLE,H_MISSION_TIME,H_FILETIME,MISS_TIME,FILETIME
;		In this example, the logical assignments to H_MISSION_TIME
;		and H_FILETIME are used to indicate which entries are to be
;		processed.  Each element of NAMETABLE is read and the
;		header contents loaded into MISS_TIME and FILETIME.
;		Note that if the entry is missing, no error is reported!!
;		That entry in the header values vectors would be set to ‑1.
;
;
; MODIFICATION HISTORY:
;       27‑Oct‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_HLINE.PRO

;
; NAME:
;	D_HLINE
; PURPOSE:
;	To produce a headerline for a header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	OUTPUT = D_HLINE(GOOD,ENTRY,NUM_ENT,DATATYPE,RESERVED,
;		PARAMETER,FORMAT,STATUS)
; INPUTS:
;	GOOD = a goodness criterion.  One letter.
;                G = from GSE
;                C = from calibrator file
;                P = from post‑processor
;                H = human intervention
;                V = control parameters in header or a validated entry
;                N = from configuration file
;		 R = raw data read‑only
;	ENTRY = the entry type parameter.
;                P = pointer
;                M = multiple entry
;                S = single entry
;	NUM_ENT = the number of entries in the header value
;		 values up to 999 can be accepted
;	DATATYPE = the IDL code for the data type of the entry
;                1 = byte
;                2 = integers
;                3 = long integers
;                4 = floating point
;                5 = double precission
;                6 = complex
;                7 = string
;                8 = structure
;	RESERVED = the value for the reserved column
;	PARAMETER = the data parameter
;	FORMAT = the FORTRAN code for the format required.  If this
;		parameter is set to an undefined variable then default
;		IDL settings are used
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the output header line for the DISR header
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	LEADING AND TRAILING BLANKS ARE REMOVED FROM THE PARAMETER ENTRY BEFORE
;	INCLUSION IN THE HEADERLINE.
; RESTRICTIONS:
;	NOTE THAT THE DATA TYPE OF THE ENTRY IN THE HEADER MAY BE CHANGED
;	IF THE REQUESTED FORMAT DIFFERS FROM THE DATA TYPE.  THIS COULD
;	CAUSE TROUBLE IF THE D_HLINE PROCEDURE IS NOT USED CORRECTLY.
; PROCEDURE:
;
;
; MODIFICATION HISTORY:
;	26‑MAY‑1991  NT
;	18‑May‑1993  NT  Inclusion of new status line
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_INCCAL.PRO

;
; NAME:
;	D_INCCAL
; PURPOSE:
;	To include the calibration file data into the DISRSOFT headers
; CATEGORY:
;	Verification
; CALLING SEQUENCE:
;	D_INCCAL,CAL_STRUCT,HEADER_IN,HEADER_OUT [,STATUS] [,/NOCHECK]
; INPUTS:
;	CAL_STRUCT =an array containing the calibration file data (see 
;			D_RDCAL)
;	HEADER_IN = the DISRSOFT header to be updated
;
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT = the updated header
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NOCHECK = if set the data are inserted directly into the header without
;		error checking.
; COMMON BLOCKS:
;	C_HEADER.INC
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The calibration file times MUST be close to the header times.
; EXAMPLE:
;	
; PROCEDURE:
;	Use the time value in the array to interpolate the correct values
;	for the header.
;
; MODIFICATION HISTORY:
;	06‑11‑1994 NT    Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_INSERT.PRO

;
; NAME:
;	D_INSERT
; PURPOSE:
;	To insert a header entry into an input header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_INSERT,HEADER_IN,HEADER_OUT,PARAMETER,ENTRY_NUM,
;		GOODNESS,FORMAT[,/OVERRIDE] [,STATUS]
; INPUTS:
;	HEADER_IN = the input header
;	ENTRY_NUM = the number of the entry to be updated or inserted
;	PARAMETER = the parameter to be inserted.  Note that for
;			multiple entries this parameter should be a vector
;			of the same length as the number of entries
;	GOODNESS = the goodness criterion
; OPTIONAL INPUT PARAMETERS:
;	FORMAT = the format of the entry
; OUTPUTS:
;	HEADER_OUT = the output header with entry inserted
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;       OVERRIDE = a switch which can be used to override a read‑only entry.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Single or multiple entries cannot be extended or contracted as
;	a matter of policy.  It would technically be possible to assign
;	a logical name to each entry to allow expansion or contraction of
;	of entries but this could be counter productive in practise because
;	of the possibilities for errors.
; PROCEDURE:
;	The routine contains a series of tables which are used to verify
;	the entry type and structure.
; MODIFICATION HISTORY:
;	26‑MAY‑1991
;	16‑11‑1992  NT  Pointers and multiple entries determined from a
;		Common block.
;	18‑May‑1993 NT  Inclusion of read‑only and append processing of
;		modified parameter (now testing).
;       27‑Jul‑1993 NT Change so that errors are NOT reported if 
;		STATUS is included.
;	10‑12‑1993 NT Use of D_EXIST implemented.
;       14‑01‑1994 NT Implementation of override switch for read‑only entries
;                      and incorporation of new goodness criteria.
;       15‑02‑1994 JAS BugFix in GOODNES‑checking for MultipleEntries (V1.2)
;	25‑02‑1994 NT  VMS bug fix on directory where D_HOLDER.DOC can be
;			found
;	12‑09‑1994 NT  Better error trap on bad entry number included.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_IRREAD.PRO

;
; NAME:
;	D_IRREAD
; PURPOSE:
;	To read a header and pixels specifically for the IR data set
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_IRREAD,FILENAME,HEADER_OUT,PIXELS_OUT,GEOM_DATA,STATUS
; INPUTS:
;	FILENAME = the file to be read
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT,PIXELS_OUT = the header and pixels to be restored
;		Note that if the header is valid but there are no
;		pixels/data with the header then PIXELS_OUT is returned
;		as undefined.
;	GEOM_DATA = the geometry data for the IR image.  This is a structure
;               containing three tags named REGIONS, READING and BINS. The
;               sizes of each are set by data from the header.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The header length parameter is stored in a header variable.  If
;	this value is incorrect then you have trouble!
; PROCEDURE:
;	Open the file, read the first elements of header.  Find the
;	dimensions of the header and the pixels.  Read them in in the
;	correct format.  Then get the IR data at the end of the file.
;	Make a check to ensure the correct procedure is used.
; MODIFICATION HISTORY:
;	27‑MAY‑1991  NT
;	24‑NOV‑1992  NT ‑ modification to reduce storage area required
;				when saving 2‑byte integers in XDR
;	18‑05‑1993  NT  ‑ changes to ensure no crash when pixels dont
;			exist
;	19‑05‑1993  NT Modification of D_READ for the IR data set type
;	18‑06‑1993 NT Modification for SET_NAME to SET_NUMBER plus a change
;		in way in which the IR table is written.  Changed to byte write.
;	23‑11‑1993 NT Modification to names of header entries for MMC
;	09‑12‑1993 NT Only for DISR headers with D at header entry 0
;	10‑12‑1993 NT Bug fix on error in input parameters
;       13‑01‑1994 NT Converted to new definition received from Graham today.
;	21‑01‑1994 NT Array containing START changed to a long integer.
;	15‑02‑1994 NT Modified for new definition of IR geometry data sets.
;       26‑05‑1994 LD Modified all geometry data to be long integers
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_IRWRIT.PRO

;
; NAME:
;	D_IRWRIT
; PURPOSE:
;	To write away an IR DISR image.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_IRWRIT,FILENAME,HEADER_IN,PIXELS_IN,GEOM_DATA [,STATUS]
; INPUTS:
;	FILENAME = the name of the output file
;	HEADER_IN,PIXELS_IN = the input DISR header and pixels
;			to be written away
;	GEOM_DATA = the geometry data for the IR observations.  NOTE that this
;                  is now a structure following modifications by MMC
;                  with three tags  (REGIONS, READING, and BINS).
;                  Each corresponds to a size specified by
;                  REGIONS     5 x H_NUM_REGIONS
;                  READING     6 x (H_NUM_ROT)
;                  BINS        6 x H_NUM_BINS
;
;			READING is a long array, the other two are int arrays
;
;
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To disk.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	Header values for the directory, filename and contents are updated.
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;
;
; MODIFICATION HISTORY:
;	27‑MAY‑1991  NT
;	18‑MAY‑1993  NT  Modified to deal with undefined scalars
;			and undefined pixels.  Also changed so that D_INSERT
;			is NOT used for inserting write parameters.
;	19‑MAY‑1993  NT  Modified from D_WRITE
;	18‑06‑1993 NT  Modified SET_NAME to SET_NUMBER and change in way the IR
;		table is written and read.
;	23‑11‑1993  NT  Modification of IR header names for MMC
;	10‑12‑1993  NT  Now determines if header in is a DISR header
;			and exits if not.
;       13‑01‑1994  NT  Modification for new structure given by MMC today.
;	21‑01‑1994  NT  Change of READING  to long integer.
;	15‑02‑1994  NT  Modification for new IR structure.
;	18‑05‑1994  NT   In some cases the readings, regions, and bin arrays
;				can be vectors.  This caused D_IRWRIT to
;				crash.  This has been modified.  Error checks
;				are no longer so rigorous however!!
;	04‑07‑1994  NT  Check of long integers for all geometry data and
;			inclusion of Sun and Mac operating systems.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_ISRSFT.PRO

;
; NAME:
;	D_ISRSFT
; PURPOSE:
;	To set up a widget interface for DISRSOFT.
; CATEGORY:
;	Widget‑driven DISRSOFT system.
; CALLING SEQUENCE:
;	D_ISRSFT
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	c_system and c_header
; SIDE EFFECTS:
;	Widget‑driven interface put on the screen.
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	D_ISRSFT
; PROCEDURE:
;	Widget.  Set up the widget.  Then perform a series of operations
;	on the header and pixels controlled by the widget routines already
;	provided.  i.e. use D_WREAD, D_WWRIT, D_WINSER etc. to manipulate
;	and display data in widgets.
; MODIFICATION HISTORY:
;	30‑01‑1994 NT  Prototype.
;	05‑02‑1994 NT  First runs.  Looks OK.  No real error checking at
;			present.  Needs to use /MODAL keyword in most
;			calls because of delays during widget execution.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_LMPTIM.PRO

;
; NAME:
;	D_LMPTIM
; PURPOSE:
;	To determine how long each calibration light has been switched
; 	on for.
; CATEGORY:
;	Post‑processor
; CALLING SEQUENCE:
;	D_LMPTIM,FILELIST,LAMP_TIMES,STATUS
; INPUTS:
;	FILELIST = a list of DISR images
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	LAMP_TIMES is a four element vector which contains the lengths of
;	time the lamps have been operational for based on the input
;	files. (Order is CAL_LAMP1, CAL_LAMP2, CAL_LAMP3, SURF_LAMP)
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	C_HEADER is used to access the relevant header entries
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Plenty.  See procedure.
; EXAMPLE:
;	
; PROCEDURE:
;	It is assumed that you have produced a list of filenames from
;	one log run of the DISR.  This would normally be a complete
;	list of LAMP data sets (although the program checks to determine
;	if the set id is correct for a lamp data set).  For each lamp
;	data set I read the header parameter H_LAMP_STATE.  This gives
;	a logical display of which lamps were switched on.  If a lamp
;	was switched on then its total is incremented by 5 seconds
;	(the time between consecutive lamp data sets).  The values for
;	each lamp are then returned.
; MODIFICATION HISTORY:
;	05‑03‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_LOOK.PRO

;       
; NAME:       
;       D_LOOK       
; PURPOSE:       
;       A routine to take a directory listing of DISRSOFT images and       
;       allow you to click and display.        
; CATEGORY:       
;       Image viewing.       
; CALLING SEQUENCE:       
;       D_LOOK,HEADER,PIXELS,DIRECTORY=DIRECTORY,FILTER=FILTER,STATUS       
; INPUTS:       
;       NONE       
; OPTIONAL INPUT PARAMETERS:       
;       NONE       
; OUTPUTS:       
;       HEADER, PIXELS are the last correct header and pixels read.       
; OPTIONAL OUTPUT PARAMETERS:       
;       STATUS = standard status report       
; KEYWORDS:       
;       DIRECTORY = setting of a default directory (default is current)       
;       FILTER = setting of default file specification (default is *.*)       
; COMMON BLOCKS:       
;       c_header       
; SIDE EFFECTS:       
;       NONE       
; RESTRICTIONS:       
;       NONE       
; EXAMPLE:       
;              
; PROCEDURE:       
;       Set up a widget with the directory functions and a draw widget       
;       to allow you to see the pixels when displayed.       
; MODIFICATION HISTORY:       
;       05‑07‑1994  NT   Prototype       
;       15‑10‑1994  NT  Inclusion of new formats.   
;       
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_MKCOMM.PRO

;
; NAME:
;	D_MKCOMM
; PURPOSE:
;	To produce new header common blocks and control procedures
;	from the D_HOLDER.DOC file.
; CATEGORY:
;	Database system
; CALLING SEQUENCE:
;	D_MKCOMM [,STATUS]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	New files are created in the doc area.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	PASSWORD = a password code that must be set to allow the
;		procedure to run.  This is not strictly a security
;		device but to indicate that use of this procedure
;		is very dangerous.
; COMMON BLOCKS:
;	C_SYSTEM
; SIDE EFFECTS:
;	DISRSOFT header common blocks are overwritten!!
; RESTRICTIONS:
;	This procedure should not be used unless there is a change in the
;	database header common block definitions.
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	23‑11‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_MKLIST.PRO

; 
; NAME: 
;         D_MKLIST 
; PURPOSE: 
;         A catalogue type program to run from the command line which
;	  catalogues only the specified data set. 
; CATEGORY: 
;         Catalogues 
; CALLING SEQUENCE: 
;         D_MKLIST,FILELIST,ENTRIES,SET_ID=SET_ID,FORMATS=FORMATS, 
;                   [FILENAME=FILENAME,/NOCHECK,STATUS] 
; INPUTS: 
;         FILELIST = a list of DISRSOFT files to be investigated 
;         ENTRIES = a list of header entries which you need in the catalogue 
; OPTIONAL INPUT PARAMETERS: 
;         NONE 
; OUTPUTS: 
;         To screen unless the FILENAME keyword is set. 
; OPTIONAL OUTPUT PARAMETERS: 
;         STATUS = the standard status report 
; KEYWORDS: 
;         FORMATS , if set, must be a vector of FORTRAN formatting strings 
;         the same length as ENTRIES.  This formatting will be used to 
;         format your catalogue. 
;
;         FILENAME redirects the output to an output file. 
;
;         SET_ID = the value of H_SET_ID in the DISR system which you need to 
;         catalogue.  If this is not set then all files are analysed. 
;         A vector of set ids can be entered. 
;
;	  NOCHECK = a switch which turns off features which you may have
;		pre‑determined.  If NOCHECK is not set, the program reads
;		all the headers in order to find which data sets are
;		the ones you want according to the SET_ID switch. The 
;		program then orders everything by MISSION_TIME and only
;		then is the list created.  If NOCHECK is set then the program
;		assumes that all files passed to it are to be analysed
;		and that the files are already ordered in the way you
;		want them.  This has the effect of speeding up the routine
;		because the headers are not read twice.
; COMMON BLOCKS: 
;         C_SYSTEM and C_HEADER 
; SIDE EFFECTS: 
;         NONE 
; RESTRICTIONS: 
;         NONE 
; PROCEDURE: 
;         Error check. 
;         Pick up the default formats etc that are needed. 
;         Determine which files conform to the set_id. 
;         Go back and extract data and write it. 
; MODIFICATION HISTORY: 
;         13‑1‑1994  NT Prototype. 
;         27‑1‑1994  NT Modification to generalise the program by making 
;                       the SET_ID a keyword rather than an input parameter. 
;	  16‑03‑1994  NT  Bug fix on unit of print out.
;	  18‑05‑1994  NT  Bug fix on the creation of a list.  Program now
;				exits gracefully when the list according to
;				set id is a null string. 
; 	  28‑05‑1994  NT  Addition of NOCHECK keyword.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_NEWENT.PRO

;
; NAME:
;	D_NEWENT
; PURPOSE:
;	To allow the user to input a new single entry into the database system
;	header system.
; CATEGORY:
;	System control
; CALLING SEQUENCE:
;	D_NEWENT, PASSWORD=PASSWORD [,RESTORE=RESTORE] 
;			[,DEL_BACK=DEL_BACK] [,EXTRA=EXTRA] [,STATUS]
; INPUTS:
;	None
; OPTIONAL INPUT PARAMETERS:
;	None
; OUTPUTS:
;	None
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	PASSWORD = the system password which must be present
;	EXTRA = this keyword must be set if you wish to extend the number
;		of entries in the header beyond the current number in the
;		system.  The DISRSOFT initial default is 252 although
;		by no means all of these entries are filled.  To extend
;		beyond 252, this keyword must be set.  Setting EXTRA to
;		an integer value will give that many additional spaces
;		in the header.  This number should not be very large
;		or negative.  A checker limts you to values between
;		1 and 100.
;	RESTORE = if set, the old system is restored unless the backup files
;		have been deleted
;	DEL_BACK = if set, deletes the backup versions from the system
;
;	When the DEL_BACK or RESTORE  keywords are used, no widget is
;	generated.
;
; COMMON BLOCKS:
;	C_SYSTEM and C_HEADER common blocks
; SIDE EFFECTS:
;	This program is designed for automatic modification of the
;	DISRSOFT header system via a widget interface.  This routine
;	must be used with extreme caution because errors may cause
;	the complete failure of the system.  Extensive error checks
;	are performed but ....
;
;	The following files are modified :‑
;		C_HEADER.PRO
;		C_HEADER.INC
;		D_HOLD.DOC
;		D_HOLDER.DOC
;		DISRHEAD.DOC
;
;	No modification is made to the documentation files.  The files
;	will be backed‑up first by copying them to the files :‑
;		O_HEADER.PRO
;		O_HEADER.INC
;		O_HOLD.DOC
;		O_HOLDER.DOC
;		OISRHEAD.DOC
;
; RESTRICTIONS:
;	The user is only allowed to enter "single" entries.  Pointers
;	and "multiple" entries are not supported.  You are also
;	not allowed to touch or modify entries in the region 0‑12
;	as these entries are reserved for the system to control
;	data reading, writing and the pointer system.
; PROCEDURE:
;	A widget interface is set up so that changes can be verified in
;	real time.  A switch is used to restore the old system or delete the
;	backup.  If the keywords are not present then the widget is
;	generated and control passed to the XMANAGER.  You may add entries
;	to the system beyond the number currently present using the EXTRA
;	keyword.  The EVENT control is based on editable text widgets
;	for modifications.  The algorithm cannot determine whether you
;	are entering info in a field by error or by design.  Thus the error
;	checks during data entry are minimal.  A switch (VERIFIED) is used 
;	to force the user to check the consistency of new header entries
;	before the program allows the new system to be written away.
;	A error report is generated in a text widget.  Only when no errors
;	are present will the program allow the system files to be overwritten.
;
;
;
;
; MODIFICATION HISTORY:
;	22‑01‑1994 NT  Prototype.
;	27‑06‑1994 NT  Deletion of entry now allowed.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_PARSE.PRO

; 
; NAME: 
;       D_PARSE 
; PURPOSE: 
;       To allow the input of a DISRSOFT sub‑directory and file name 
;       and return the full file specification on the present 
;       operating system. 
; CATEGORY: 
;       Operating system interface 
; CALLING SEQUENCE: 
;       OUTPUT = D_PARSE(DISR_DIRECTORY, DISR_FILENAME [,STATUS]) 
; INPUTS: 
;       DISR_DIRECTORY = the disrsoft source directory for the file. 
;                       This could be 'DOC' or 'SYSTEM' for example. 
;       DISR_FILENAME = the filename  e.g. d_holder.doc 
; 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       OUTPUT = a string indicating the directory specification 
;                       e.g.  C:\CAL_SOFT\HMC_SOFT\DOC\D_HOLDER.DOC 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report  
; KEYWORDS: 
;       NONE 
; COMMON BLOCKS: 
;       c_system need for the c_disk and c_maindir blocks 
; SIDE EFFECTS: 
;       The output is returned in lower case to be UNIX compatible. 
; RESTRICTIONS: 
;       This is a low level DISRSOFT routine to reduce code size and 
;       limited changes when DISRSOFT is ported to a new operating 
;       system. 
; EXAMPLE: 
;       PRINT, D_PARSE('doc','d_holder.doc') 
;               /disr01fw1/cal_soft/disrsoft/doc/d_holder.doc 
; 
; PROCEDURE: 
;       Use a case statement together with the C_DISK and C_MAINDIR 
;       common block variables. 
; 
; MODIFICATION HISTORY: 
;       26‑02‑1994  NT  
;       28‑04‑1994  NT  Modified for Sun and Mac. 
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_PSTDIR.PRO

;
; NAME:
;	D_PSTDIR
; PURPOSE:
;	To create a directory structure under NEW_DIRECTORY corresponding
;	to the requirements of the post‑processor.
; CATEGORY:
;	Verification
; CALLING SEQUENCE:
;	D_PSTDIR,NEW_DIRECTORY,SUB_DIRS [,STATUS]
; INPUTS:
;	NEW_DIRECTORY = the directory under which the new directory
;		tree will be set up
;	SUB_DIRS = the sub‑directories
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	A new directory tree is created.
; RESTRICTIONS:
;	The sub‑directories have to be very accurately specified by the
;	D_PSTPRC program so that there is correct correspondence between
;	the old directory structure and the new one.
; EXAMPLE:
;	D_PSTDIR,'C:\DISRSOFT\DATA\T940130A',['ir','image','timelist'],STATUS
; PROCEDURE:
;	I first check if NEW_DIRECTORY exists.  If it doesnt then I create
;	it.  If this fails then there is something screwy and I exit.  Then
;	I branch according to the operating system and create the sub‑
;	directories.  If any of these directories exist already then I
;	exit.
; MODIFICATION HISTORY:
;	30‑01‑1994 NT
;	15‑03‑1994 NT  Inclusion of SUB_DIRS parameter.
;	04‑07‑1994 NT  Inclusion of Mac and Sun parameters.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_PSTPRC.PRO

;
; NAME:
;	D_PSTPRC
; PURPOSE:
;	The DISRSOFT post‑processor.
; CATEGORY:
;	Verification
; CALLING SEQUENCE:
;	D_PSTPRC,OLD_DIRECTORY,NEW_DIRECTORY [,/NOANOM]
;			[,/NORESOURCE] [,/NOLISTS] [,STATUS]
; INPUTS:
;	OLD_DIRECTORY = the directory name of the directory which
;			contains the sub‑directories with raw data in.
;	NEW_DIRECTORY = the directory name of the directory which you wish
;			to be the root for the post‑processed data.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	The raw data are copied with updated headers into the new
;	directories.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report.
; KEYWORDS:
;	NOANOM which if set stops the routine entering the anomaly checking
;		routine.
;	NORESOURCE which if set stops the routine entering the resource tracking
;		routine.
;	NOLISTS which if set stops the generation of time ordered lists
; COMMON BLOCKS:
;	c_system and c_header are required.
; SIDE EFFECTS:
;	Directories are checked.  An anomaly report is generated and placed
;	in NEW_DIRECTORY.
; RESTRICTIONS:
;	No idea at present.
; EXAMPLE:
;	D_PSTPRC,'/disrsoft/data/t941008a','/disrsoft/data/t941008b',status
; PROCEDURE:
;	First I verify that there is data to process.
;	Second I verify that I can create the sub‑directories.
;	Third I check how many bad ram and bad eeprom sets there are.
;	Fourth I run the anomaly checker.
;	Fifth I run the resource checker.
;	Then ......
;
; MODIFICATION HISTORY:
;	30‑01‑1994 NT  Prototype.
;	14‑03‑1994 NT  Inclusion of data set checker, lamp, and
;			shutter cycle resource checker.
;	16‑03‑1994 NT  Bugs fixed using false data generator to analyse.
;		       Inclusion of the time data set pixels analyser
;			to determine the experiment on time.
;	30‑05‑1994 NT  Inclusion of switches to turn off some functions
;			and more verbosity.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_RDCAL.PRO

; 
; NAME: 
;       D_RDCAL 
; PURPOSE: 
;       To read the calibration file data into a structure 
; CATEGORY: 
;       Verification 
; CALLING SEQUENCE: 
;       D_RDCAL,CAL_FILE,CAL_STRUCT  [,STATUS]  
; INPUTS: 
;       CAL_FILE = the name of the calibration file 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       CAL_STRUCT =a series of arrays containing the calibration file data  
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; KEYWORDS: 
;       NONE 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       The calibration file MUST be reasonably correct. 
; EXAMPLE: 
;        
; PROCEDURE: 
;       Read the thing with a readf command and shove the stuff into an array 
;       of structures. 
; 
; MODIFICATION HISTORY: 
;       06‑11‑1994 NT    Prototype 
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_RDOGSE.PRO

;  
; NAME:  
;       D_RDOGSE  
; PURPOSE:  
;       To read the OGSE log file  
; CATEGORY:  
;       Verification  
; CALLING SEQUENCE:  
;       D_RDOGSE,OGSE_FILE,OGSE_STRUCT,STATUS  
; INPUTS:  
;       OGSE_FILE = the name of the OGSE log file  
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       OGSE_STRUCT = a structure containing the data from the OGSE log  
; OPTIONAL OUTPUT PARAMETERS:  
;       STATUS = standard status report  
; KEYWORDS:  
;       NONE  
; COMMON BLOCKS:  
;       NONE  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;       Should only be run on a valid OGSE file  
; EXAMPLE:  
;         
; PROCEDURE:  
;       Search for keywords and load contents into various arrays  
;  
; MODIFICATION HISTORY:  
;       09‑12‑1994 NT  
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_READ.PRO

; 
; NAME: 
;       D_READ 
; PURPOSE: 
;       To read a header and pixels. 
; CATEGORY: 
;       Database manipulation 
; CALLING SEQUENCE: 
;       D_READ,FILENAME,HEADER_OUT,PIXELS_OUT,STATUS 
; INPUTS: 
;       FILENAME = the file to be read 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       HEADER_OUT,PIXELS_OUT = the header and pixels to be restored 
;               Note that if the header is valid but there are no 
;               pixels/data with the header then PIXELS_OUT is returned 
;               as undefined. 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       The header length parameter is stored in a header variable.  If 
;       this value is incorrect then you have trouble! 
; PROCEDURE: 
;       Open the file, read the first elements of header.  Find the 
;       dimensions of the header and the pixels.  Read them in in the 
;       correct format. 
; MODIFICATION HISTORY: 
;       27‑MAY‑1991  NT 
;       24‑NOV‑1992  NT ‑ modification to reduce storage area required 
;                               when saving 2‑byte integers in XDR 
;       18‑05‑1993  NT  ‑ changes to ensure no crash when pixels dont 
;                       exist 
;       18‑06‑1993 NT  SET_NAME modified to SET_NUMBER 
;       23‑11‑1993 NT  SET_NAME modified to SET_ID 
;       09‑12‑1993 NT Check on H_TYPE to determine if DISRSOFT and only then 
;                       make a check on H_SET_ID 
;	17‑03‑1994 NT Check changed to check whether H_SET_ID is defined.
;			If so, then DISRSOFT is running so that IR reads are
;			possible.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\RADIO\D_REPAIR.PRO

;
; NAME:
;	D_REPAIR
; PURPOSE:
;	To repair a CCD dark image.
; CATEGORY:
;	Dark current analysis.
; CALLING SEQUENCE:
;	D_REPAIR, H,P, HH,PP, STATUS
; INPUTS:
;	H,P = header and pixels of input image
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HH,PP = header and pixels of repaired data
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Unknown
;
; MODIFICATION HISTORY:
; REPAIR.PRO  by  R. KRAMM  11‑DEC‑1992
; =====================================
; 	11‑11‑1993 NT Adapted to DISRSOFT style. 
;
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_RESTAB.PRO

;
; NAME:
;	D_RESTAB
; PURPOSE:
;	To generate the DISR resource tables.
; CATEGORY:
;	Verification ‑ resource tracking
; CALLING SEQUENCE:
;	D_RESTAB,NEW_DIR_TEMP,LAMP_TIMES,SHUTTER_CYCLES,DISR_ON_TIME,STATUS
; INPUTS:
;	NEW_DIR_TEMP = the main level directory into which the verified
;			files will be put.
;	LAMP_TIMES = a four‑element vector giving the on times of the
;			calibration and surface lamps for the current
;			operation.
;	SHUTTER_CYCLES = the number of shutter cycles performed during the
;			current operation
;	DISR_ON_TIME = the length of time DISR has been on during the
;			current operation 
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To disk.  There are two output files.  The first file simply
;	writes away the information contained in LAMP_TIMES,
;	SHUTTER_CYCLES and DISR_ON_TIME in a reasonable format into the
;	directory NEW_DIR_TEMP.
;	The program then writes a second file which is a log of the
;	total times/cycles run for the experiment.  This is only logged
;	by the post‑processor, therefore if you fail to run the post‑
;	processor the information cannot be updated!!
;
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	c_system and c_header
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The routine will normally only be called from D_PSTPRC.
; EXAMPLE:
;	D_RESTAB,NEW_DIR_TEMP,[25.,5.,0.,125.],340.,1200.,STATUS
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	15‑03‑1994 NT  Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_RHEAD.PRO

;
; NAME:
;	D_RHEAD
; PURPOSE:
;	To read a DISR header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_RHEAD,FILENAME,HEADER_OUT,STATUS
; INPUTS:
;	FILENAME = the file to be read
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER_OUT = the header to be restored
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The header length parameter is stored in a header variable.  If
;	this value is incorrect then you have trouble!
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	27‑MAY‑1991  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_RNAME.PRO

;
; NAME:
;	D_RNAME
; PURPOSE:
;	To read a nametable from a file and load it into an array. 
; CATEGORY:
;	File manipulation
; CALLING SEQUENCE:
;	NAMETABLE = D_RNAME (FILENAME [,STATUS])
; INPUTS:
;	FILENAME = the name of the file containing the nametable.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NAMETABLE = a string array containing the names of the files
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The array elements have leading and trailing blanks removed.
;	On error the output nametable is left as a null string.
; RESTRICTIONS:
;	This procedure is very loose and can be used to read any text
;	file into a header array of the correct length.
; PROCEDURE:
;	Open the file.  Read it line by line and load into a string array.
;
; MODIFICATION HISTORY:
;	13‑10‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SEARCH.PRO

;
; NAME:
;	D_SEARCH
; PURPOSE:
;	A procedure to scan all headers in a directory for specific
;	keywords or values.
; CATEGORY:
;	Database study.
; CALLING SEQUENCE:
;	FILEOUT = D_SEARCH( [NOINTERACTIVE=NOINTERACTIVE] [,DIRECTORY=DIRECTORY]
;		 [,FILTER=FILTER] [,SEARCHPARS=SEARCHPARS] 
;		 [,ANDSEARCH=ANDSEARCH] [,ORSEARCH=ORSEARCH] [,ASCII=ASCII]
;		 [,DISRSOFT=DISRSOFT] [,SUBDIRECTORIES=SUBDIRECTORIES],
;			STATUS)
;
;
;		In interactive mode, a widget interface is constructed. 
;
;		Use the filter and directory widgets to control
;		which files will be opened during the search.
;
;		Select whether you wish to search ascii files or
;		DISRSOFT headers.
;
;		Enter strings into the search string text widgets
;
;		Decide whether you wish search for every occurrence of
;		each string in your selected search strings (INCLUSIVE)
;		or whether you wish to search only for files which
;		contain ALL your selected strings (EXCLUSIVE)
;
;		Then DO IT.
;
;
;		If the NOINTERACTIVE keyword is set then other keywords
;		must be set to establish the words to be searched for
;		whether you want to search ASCII or DISRSOFT files,
;		whether the search is an AND search or an OR search,
;		and whether you wish to search all sub‑directories.
;
;
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	FILEOUT = a list of files which gave a positive result in the last
;		search carried out before exiting the program.  If no matches
;		were found a null string is returned as the only element
;		of a 1‑D string array
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NOINTERACTIVE = if set the program goes into a non‑interactive mode
;			when no widget is generated.  The search parameters
;			MUST then be set using keywords.
;	DIRECTORY = a specification of which directory to use for
;		the search.  Default is current.
;	FILTER = a file filter.  Default is '*.*'
;	ASCII = if set forces D_SEARCH to perform an ASCII search rather
;		than a DISRSOFT header search.
;	DISRSOFT = if set D_SEARCH will perform a search on DISRSOFT
;		headers.  Note that this is default except when ASCII is
;		set.
;	SEARCHPARS = a vector of up to three strings.  This forms the
;		search template.
;	ANDSEARCH = if set this keyword forces the program to look for
;		SEARCHPARS and only report files which contain ALL
;		elements of SEARCHPARS
;	ORSEARCH = if set D_SEARCH will search for any occurrence of any of
;		the search parameters.  Note that this is default except
;		when ANDSEARCH is set.
;	SUBDIRECTORIES = if set this forces D_SEARCH to search all
;		subdirectories as well as the current.
; COMMON BLOCKS:
;	C_SEARCH = internal common block
;	C_SEARCH1 = a second internal common block inserted for
;		non‑interactive section of code.
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Use the basic elements of the IDL pickfile procedure to select the
;	filelist.  Note that a special section of code was needed for
;	Windows.
;	The rest is easy.
;
; MODIFICATION HISTORY:
;	23‑7‑1993  nt  PROTOTYPE
;	12‑8‑1993  nt  IDL v3.1 ‑ IDL bug now gone.  Make function and output
;			a file list.
;	12‑10‑1993 NT  Bug fix on UNIX output separator between CURR_DIR
;			and the file name.
;	05‑11‑1993 NT  Inclusion of sub‑directories.
;	07‑11‑1993 NT  Continuing inclusion of sub‑directories and use
;			of keywords for non‑interactive use.
;	07‑01‑1994 NT  Correction for change in TAG_NAME of widget_text
;	21‑01‑1994 NT  By clicking on the same exclusive widget button twice
;			you could de‑select it and get the other widget
;                       button.  This has now been fixed.  If you click a
;                       button it stays clicked!!  The calls to widget_control
;                       are necessary as the PC tool box doesnt seem to be
;                       able to handle this correctly.
;	31‑01‑1994 NT  Directory checker installed before widget creation
;			occurs to avoid crash.
;	28‑04‑1994 NT  Inclusion of MacOS and SunOS capability.
;	19‑09‑1994 NT  Bug fix on the exclusive widgets.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SETCOD.PRO

;
; NAME:
;	D_SETCOD
; PURPOSE:
;	To determine the data set id and its name from the code letter
;	at the end of the filename.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	SET_ID = D_SETCOD(CODE [,SET_NAME=SET_NAME ,STATUS])
; INPUTS:
;	CODE = a one character string containing the 8th character of a
;		filename.  This character contains a code from which the
;		data set type can be determined.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	SET_ID = the data set id corresponding to the code.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	SET_NAME optionally gives the name of the data set.
; COMMON BLOCKS:
;	c_system
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	PRINT, D_SETCOD('W',SET_NAME=SET_NAME)
; PROCEDURE:
;	Trivial.  Read DATASETS.DOC, split up the string and use a where
;	function.
;
; MODIFICATION HISTORY:
;	07‑02‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SETID.PRO

;
; NAME:
;	D_SETID
; PURPOSE:
;	To determine the data set id from its name.
; CATEGORY:
;	DISR specific tools
; CALLING SEQUENCE:
;	OUTPUT=D_SETID(SET_NAME [,CODE=CODE ,STATUS])
; INPUTS:
;	SET_NAME = the data set name e.g. 'message' or 'TIME'
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT is the numerical code for that data set
;	OUTPUT is set to ‑1 on failure.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	CODE  contains the character which is set by the GSE as the 8th
;		character of the filename.  This is different for each data
;		set and can be used as part of a file filter to isolate
;		particular data sets.
; COMMON BLOCKS:
;	c_system common block needed to find the look‑up table
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	DISR specific code.
; PROCEDURE:
;	Go to the documentation area, pick‑up the file, search for the name.
;	Return the number.
; MODIFICATION HISTORY:
;	27‑01‑1994 NT
;	07‑02‑1994 NT Inclusion of the CODE keyword.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SHEAD.PRO

;
; NAME:
;	D_SHEAD
; PURPOSE:
;	To show a header on the screen or on file.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_SHEAD,HEADER_IN [,OUTFILE,STATUS,OUTPUT=OUTPUT,$
;		VAR_ONLY=VAR_ONLY]
; INPUTS:
;	HEADER_IN = standard input file
; OPTIONAL INPUT PARAMETERS:
;	OUTFILE = name of the output ascii file for header data
; OUTPUTS:
;	To file or screen.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	OUTPUT = puts the output into a variable
;	VAR_ONLY = if this keyword is set
;		what would normally be directed to the output
;		file or screen is actually returned only as in
;		the variable. No file or screen output is performed.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	2‑JUN‑1991  NT
;	15‑1‑1992 nt modified to work with different databases
;	18‑May‑1993 NT inclusion of new status line
;	10‑12‑1993 NT Use of D_EXIST implemented
;	10‑12‑1993 NT Bug fixed on input parameters
;	05‑02‑1994 NT Inclusion of VAR_ONLY keyword.
;	26‑02‑1994 NT Use of the D_PARSE routine implemented.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_SHTTIM.PRO

;
; NAME:
;	D_SHTTIM
; PURPOSE:
;	To determine the number of IR shutter cycles used during a run.
; CATEGORY:
;	Post‑processor
; CALLING SEQUENCE:
;	D_SHTTIM,FILELIST,SHUTTER_CYCLES [,STATUS]
; INPUTS:
;	FILELIST = a list of DISRSOFT files which are assumed to be
;			IR data sets or IR SHUTTER sets.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	SHUTTER_CYCLES = the number of shutter cycles executed
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	C_HEADER the standard header common block
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Plenty.  See procedure.
; EXAMPLE:
;	
; PROCEDURE:
;	It is assumed that you have produced a list of filenames from
;	one log run of the DISR.  This would normally be a complete
;	list of IR and IR shutter data sets (the program checks to see
;	if the set id is for a correct data set).  For each IR
;	data set I read the GEOM_DATA.READIN array.  The collection
;	duration and the shutter period give the number of cycles.
;	In fact the number of cycles is the collection duration divided
;	by the shutter period.  For each IR shutter test data set, the
;	number of single shutter tests is multiplied by 2 to give the
;	number of shutter cycles executed.
;	
;
; MODIFICATION HISTORY:
;	04‑03‑1994  NT
;	14‑03‑1994  NT  Change to number of shutter cycles used.
;	16‑03‑1994  NT  De‑bug.  Seems to be working.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SORT.PRO

;
; NAME:
;	D_SORT
; PURPOSE:
;	To sort a nametable of DISRSOFT headers based on the contents of
;	a single entry.
; CATEGORY:
;	File manipulation
; CALLING SEQUENCE:
;	OUTPUT = D_SORT (NAMETABLE, HEADER_ENTRY [,STATUS])
; INPUTS:
;	NAMETABLE = a nametable of DISRSOFT images
;	HEADER_ENTRY = the name of the header entry you wish to sort
; OPTIONAL INPUT PARAMETERS:
;	None
; OUTPUTS:
;	OUTPUT = the sorted nametable.  Note that if the selected entry
;	 	is missing then the file will be excluded from OUTPUT
;		Therefore, the length of OUTPUT may be different from
;		NAMETABLE.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	None
; COMMON BLOCKS:
;	C_SYSTEM and C_HEADER common blocks are required and must
;		be included in calling procedures
; SIDE EFFECTS:
;	None
; RESTRICTIONS:
;	Note that the output nametable excludes all files for which there
;	is no value for the header entry on which you wish to sort.
;	The output name table may therefore be smaller than the input.
;	Also, if no entries are found in any of the files requested then
;	an error state results.  
; PROCEDURE:
;	Read the headers of the files.  Use D_VALUE to determine the
;	entry.  Then sort.
; MODIFICATION HISTORY:
;	06‑11‑1993  NT
;	30‑01‑1994  NT  Inclusion of error message when no correct entries
;				found.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_SPROC.PRO

;
; NAME:
;	D_SPROC
; PURPOSE:
;	To show the processing history of a DISR header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_SPROC,HEADER_IN,STATUS
; INPUTS:
;	HEADER_IN = the input header
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To screen
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;	
; MODIFICATION HISTORY:
;	1‑JUN‑1991  NT
;	18‑May‑1993 NT inclusion of new status line
;	28‑11‑1993 NT Elimination of error report if filename not existing.
;	10‑12‑1993 NT Inclusion of D_EXIST header checker
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\STARTUP\D_START.PRO

;          
; NAME:          
;       D_START          
; PURPOSE:          
;       The DISR start‑up procedure.           
; CATEGORY:          
;       System operations          
; CALLING SEQUENCE:          
;       @d_start          
; INPUTS:          
;       NONE          
; OPTIONAL INPUT PARAMETERS:          
;       NONE          
; OUTPUTS:          
;       NONE          
; OPTIONAL OUTPUT PARAMETERS:          
;       NONE          
; COMMON BLOCKS:          
;       C_SYSTEM  = a common block designed to hold system          
;                       information          
;       C_HEADER = a common block which provides a translation table          
;                       for header entries          
; SIDE EFFECTS:          
;       Initializes common blocks and modifies path parameters          
;       to allow access to the DISRSOFT system and data.          
;          
;       I now offer a menu to allow access to DISRSOFT, HMC_SOFT, or          
;       IMP_SOFT.          
;          
;          
; RESTRICTIONS:          
;       NONE          
; PROCEDURE:          
;       TRIVIAL          
;                 
; MODIFICATION HISTORY:          
;       19‑11‑92  nt.  Version 0.01          
;       14‑01‑93  nt.  Version 0.02  Inclusion of D_UPIM          
;       02‑02‑93  nt.  Version 0.03  Upgraded to IDL V3.0.  Some differences          
;                       found between IDL 2.4 and 3.0.  Corrected.          
;       18‑05‑1993 NT  Version 0.1   Incorporation of MMC header definitions          
;       22‑09‑1993 NT  Version 0.3   Directory checker on path implemented.          
;       10‑11‑1993 NT  Removal of call to widget_control in valid_dir          
;                       routine.  Renamed.          
;       13‑12‑1993 NT  Put SIMULATE in the path.          
;       21‑01‑1994 NT  Key definitions for PC included.          
;       25‑02‑1994 NT  Modified to run in interactive line mode to allow          
;                       a choice between which database system you want          
;                       to use.          
;       28‑05‑1994 NT  Modified for SunOS and MacOS          
;       30‑05‑1994 NT  Test for use of + symbol in path control.         
;       04‑07‑1994 NT  Verification of stuff for MAC        
;       06‑07‑1994 NT  Initial compilation of several commonly used      
;                      routines to speed things up has been prepared    
;                      but not implemented.     
;       08‑10‑1994 NT  IDL 3.6 contains a new path structure which is CASE    
;                       sensitive on the VAX!!!    
;       15‑10‑1994 NT  Inclusion of local directory.    
;       23‑11‑1994 NT  Inclusion of EXPAND_PATH routine.   
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_TEMPL.PRO

;
; NAME:
;	D_TEMPL
; PURPOSE:
;	To create a header template.
; CATEGORY:
;	Database system
; CALLING SEQUENCE:
;	D_TEMPL,TYPE,HEADER [,STATUS]
; INPUTS:
;	TYPE = a single character corresponding to the header type
;		this hould normally be 'D' for DISR.  It is converted
;		to uppercase and single character.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER = a header template for DISR data.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;
; MODIFICATION HISTORY:
;	20‑4‑1991  NT
;	14‑1‑1992  NT  Inclusion of type parameter.
;	30‑6‑1994  NT  Inclusion of space to prevent memory useage problems
;			with post‑processor.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\VERIFY\D_TOLIST.PRO

;
; NAME:
;	D_TOLIST
; PURPOSE:
;	To create time ordered lists from DISR generated data and store
;	them in a specified directory.
; CATEGORY:
;	Data catalogues
; CALLING SEQUENCE:
;	D_TOLIST , FILENAMES, DIRECTORY [,STATUS]
; INPUTS:
;	FILENAMES = the filenames of all the data files to be studied
;	DIRECTORY = the directory into which the time ordered lists are to
;			be stored
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To disk.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report.
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The directory has to be allocated.
; PROCEDURE:
;	Create the time ordered lists using the D_MKLIST procedure in the
;	system directory.  Write away as ASCII in the appropriate directory.
; MODIFICATION HISTORY:
;	27‑01‑94  NT
;	18‑05‑94  NT  Now runs on Mac and Suns.
;	28‑05‑94  NT  Modifications to improve efficiency.
;	30‑05‑94  NT  Implementation of list 4
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_TRANSL.PRO

;
; NAME:
;	D_TRANSL
; PURPOSE:
;	To open the file which holds the DISRSOFT default entry formats
;	and output the data in arrays which can be included in the SYSTEM
;	files for maintaining the SYSTEM.
; CATEGORY:
;	SYSTEM
; CALLING SEQUENCE:
;	D_TRANSL,FILENAME, NAMES,POINTERS,MULTIPLES,NUM_MULTS,$
;		DEFDATA,FORMAT [,STATUS]
; INPUTS:
;	FILENAME = the name of the file containing the system information
;		Set to a null string for the default.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NAMES = the names of the header variables
;	POINTERS = a vector which indicates where pointers are to be found in
; 			the header
;	MULTIPLES = the elements in the header where multiple entries are
;			expected
;	NUM_MULTS = the number of elements in each multiple entry
;	DEFDATA = default data type for each element in the header
;	FORMAT = the default data format for each element in the header.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	C_SYSTEM = the system common block
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Plenty.  The file must be accessible otherwise we crash.
; PROCEDURE:
;	Open the file.  Read the data in.  No problem.
;
; MODIFICATION HISTORY:
;	16‑11‑1992 NT
;	15‑01‑1993 NT Modification for improved formatting
;	10‑12‑1993 NT More modifications for VAX compatibility
;	27‑02‑1994 NT Inclusion of D_PARSE scheme
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_UPIM.PRO

;
; NAME:
;	D_UPIM
; PURPOSE:
;	To update an image.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_UPIM,FILENAME,HEADER_IN,PIXELS_IN [,STATUS]
; INPUTS:
;	FILENAME = the name of the output file
;	HEADER_IN,PIXELS_IN = the input DISR header and pixels
;			to be written away
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To disk.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	Header values for the directory, filename and contents are updated.
;	Caution must be displayed with this program.  It is very powerful!
; RESTRICTIONS:
;	For D_UPIM to work there must be an image to update!!
;	This is the only way to check for error.
; PROCEDURE:
;
;
; MODIFICATION HISTORY:
;	14‑01‑1993  NT  D_UPIM modified from D_WRITE
;	18‑May‑1993 NT  Inclusion of extra status line, removal of D_INSERT
;			calls.
;	10‑12‑1993 NT Inclusion of D_EXIST
;	28‑04‑1994 NT Adapated for Mac and Suns.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_VALUE.PRO

;
; NAME:
;	D_VALUE
; PURPOSE:
;	To extract a value from a header.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	PARAMETER = D_VALUE (HEADER_IN,ENTRY_NUM [,GOODNESS [,STATUS]])
; INPUTS:
;	HEADER_IN = input header
;	ENTRY_NUM = the number of the entry required
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	PARAMETER = the output value (or values if multiple entry)
; OPTIONAL OUTPUT PARAMETERS:
;	GOODNESS = the goodness parameters
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	30‑MAY‑1991  NT
;	18‑May‑1993  NT inclusion of new status entry
;	10‑12‑1993 NT Inclusion of D_EXIST error checker.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WHELP.PRO

;
; NAME:
;	D_WHELP
; PURPOSE:
;	An on‑line help facility for the DISRSOFT programs
; CATEGORY:
;	Documentation
; CALLING SEQUENCE:
;	D_WHELP
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To screen using widgets
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS= standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	C_HEADER = the header common block
;	C_SYSTEM = the system common block
;	C_WHELP = the internal common block required to pass parameters
;		through the XMANAGER
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	?
; PROCEDURE:
;
;
; MODIFICATION HISTORY:
;	24‑May‑1993  NT
;	23‑11‑1993 NT  Modified for new data set definition from MMC
;	10‑12‑1993 NT More VAX compatibility problems with '['
;	27‑02‑1994 NT Inclusion of D_PARSE
;	28‑04‑1994 NT Adapted for Mac and Sun.
;       06‑11‑1994 NT Inclusion of local directory and change to size of
;			widget.
;	19‑11‑1994 NT Modification for new header entries.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WINSER.PRO

;
; NAME:
;        D_WINSER
; PURPOSE:
;        A widget driven program to insert elements into the header.
; CATEGORY:
;        Widget applications
; CALLING SEQUENCE:
;        D_WINSER, HEADER_IN, HEADER_OUT [,STATUS]
; INPUTS:
;        HEADER_IN = an input header
; OPTIONAL INPUT PARAMETERS:
;        NONE
; OUTPUTS:
;        HEADER_OUT = the result after your manipulations
; OPTIONAL OUTPUT PARAMETERS:
;        STATUS = standard status report
; KEYWORDS:
;        NONE
; COMMON BLOCKS:
;        C_HEADER common block
; SIDE EFFECTS:
;        NONE
; RESTRICTIONS:
;        NONE
; PROCEDURE:
;        Set up a widget to display the current header line and where a replacement
;        can be constructed.  You need an error box and the ability to show
;        the rest of the header.
; MODIFICATION HISTORY:
;        21‑01‑1994 NT  Prototype
;	 05‑02‑1994 NT  The original DISPHEAD sub‑routine has been replaced by
;			D_SHEAD using the new keyword to this routine.
;			Use of MODAL keyword on XMANAGER
; 	 27‑02‑1994 NT  Inclusion of D_PARSE procedure. 
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WNAME.PRO

;
; NAME:
;	 D_WNAME
; PURPOSE:
;        To write away a nametable (output from D_SEARCH)
; CATEGORY:
;        File manipulation
; CALLING SEQUENCE:
;        D_WNAME , FILENAME, NAMETABLE [,STATUS]
; INPUTS:
;        FILENAME = the name of the file to be written
;	        NAMETABLE = a vector of strings to be written away
; OPTIONAL INPUT PARAMETERS:
;	        NONE
; OUTPUTS:
;        To disk
; OPTIONAL OUTPUT PARAMETERS:
;        STATUS = standard status report
; KEYWORDS:
;        NONE
; COMMON BLOCKS:
;        NONE
; SIDE EFFECTS:
;        NONE
; RESTRICTIONS:
;        Must be a string vector
; PROCEDURE:
;        Trivial.  Check size and vector contents.  Write away.
;
; MODIFICATION HISTORY:
;        22‑Oct‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\ENHANCE\D_WRAP.PRO

; NAME:
;	D_WRAP
; PURPOSE:
;	The procedure adds or removes edges around PIXELS_IN
; CATEGORY:
;	RESTORATION
; CALLING SEQUENCE:
;	D_WRAP, PIXELS_IN, PIXELS_OUT [, MODE = mode [, STATUS]]
; INPUTS:
;	PIXELS_IN, contains the pixel information of the input array, two
;		dimensional array of any type except undefined, string, or
;		complex
; KEYWORDS:
;	MODE, contains the mode parameter, possible values are
;		+1 ‑‑> add edges (default)
;		‑1 ‑‑> remove edges
;
; OPTIONAL INPUT PARAMETERS: 
;	NONE
; OUTPUTS:
;	PIXELS_OUT, contains the pixel information of the output array, two
;		dimensional array with the same type as PIXELS_IN
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS: 
;	NONE
; SIDE EFFECTS: 
;
; RESTRICTIONS:
;	The procedure uses the SPLINE‑routine in the IDL$LIBRARY
; PROCEDURE:
;
; MODIFICATION HISTORY:
;	July 1986	DFVLR OBERPFAFFENHOFEN
;	October 1993  NT  Modified for V3.1 IDL
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WREAD.PRO

; 
; NAME: 
;       D_WREAD 
; PURPOSE: 
;       A widget‑driven reader for DISRSOFT. 
; CATEGORY: 
;       I/O 
; CALLING SEQUENCE: 
;       D_WREAD,HEADER,PIXELS [,STATUS] [,IRDATA=IRDATA] [,/HEADONLY]  
;               [,DIRECTORY=DIRECTORY] 
; INPUTS: 
;       NONE 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       HEADER and PIXELS are output header and pixels from a file 
;               selected using the widget menu 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = the standard status report on the execution 
; KEYWORDS: 
;       IRDATA = the IR data accompanying the IR data set 
;       HEADONLY = if set, only the header is read (using D_RHEAD) 
;               this could be used to speed things up for example. 
;       DIRECTORY= default setting for directory (default is current) 
; COMMON BLOCKS: 
;       C_SYSTEM and C_HEADER blocks 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; PROCEDURE: 
;       Use PICKFILE to identify a file and then read depending upon 
;       condition of HEADONLY using D_IRREAD, D_READ, or D_RHEAD. 
;       Note that if only two parameters are entered, DISRSOFT will not 
;       allow you to read an IR image with D_WREAD and will return an 
;       error message. 
; MODIFICATION HISTORY: 
;       21‑7‑1993 NT 
;       21‑9‑1993 NT  Allow read of IR data set data but with check on number 
;                       of parameters supplied in call. 
;       09‑12‑1993 NT Bug fixed in directory default setting.  Current 
;                       directory restored after operation. 
;       13‑1‑1994 NT  Bug fix on status calls to other routines. 
;       14‑01‑1994 NT  Change of the IRDATA to a keyword so that the program can 
;                      set to read either normal or IR files and still include 
;                      the status.  Also set output to dummy values if the read 
;                      fails. 
;       06‑03‑1994 NT  Use of GET_PATH in PICKFILE to produce a  
;                       sticky path. 
;       17‑03‑1994 NT Inclusion of H_SET_ID validity checker.
;	28‑04‑1994 NT Inclusion of SunOS and MacOS capability.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WRITE.PRO

;
; NAME:
;	D_WRITE
; PURPOSE:
;	To write away a image.
; CATEGORY:
;	Database manipulation
; CALLING SEQUENCE:
;	D_WRITE,FILENAME,HEADER_IN,PIXELS_IN [,STATUS,/HEADONLY]
; INPUTS:
;	FILENAME = the name of the output file
;	HEADER_IN,PIXELS_IN = the input DISR header and pixels
;			to be written away
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To disk.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	HEADONLY is a keyword which, if set, writes away the header only.
;		This is particularly useful for DISR data sets which contain
;		no pixels (e.g. message or housekeeping).
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	Header values for the directory, filename and contents are updated.
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;
;
; MODIFICATION HISTORY:
;	27‑MAY‑1991  NT
;	18‑MAY‑1993  NT  Modified to deal with undefined scalars
;			and undefined pixels.  Also changed so that D_INSERT
;			is NOT used for inserting write parameters.
;	18‑JUN‑1993  NT  SET_NAME modified to SET_NUMBER
;	23‑11‑1993 NT SET_NUMBER modified to SET_ID for MMC
;	10‑12‑1993 NT Implementation of D_EXIST
;	27‑02‑1994 NT Inclusion of HEADONLY keyword.
;	28‑04‑1994 NT Adaption for SunOS and MacOS.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WSHEAD.PRO

;
; NAME:
;        D_WSHEAD
; PURPOSE:
;        A widget routine for D_SHEAD to allow you to scroll.
; CATEGORY:
;        Widget applications
; CALLING SEQUENCE:
;        D_WSHEAD, HEADER_IN [,STATUS]
; INPUTS:
;        HEADER_IN = an input header
; OPTIONAL INPUT PARAMETERS:
;        NONE
; OUTPUTS:
;	 NONE
; OPTIONAL OUTPUT PARAMETERS:
;        STATUS = standard status report
; KEYWORDS:
;        NONE
; COMMON BLOCKS:
;        C_HEADER common block
; SIDE EFFECTS:
;        NONE
; RESTRICTIONS:
;        NONE
; PROCEDURE:
;        Set up a widget to display the current header.
; MODIFICATION HISTORY:
;        04‑03‑1994 NT  Prototype
;	 09‑11‑1994 NT  Hourglass cursor eliminated.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SYSTEM\D_WWRIT.PRO

;
; NAME:
;	D_WWRIT
; PURPOSE:
;	A widget‑driven writer for DISRSOFT.
; CATEGORY:
;	I/O
; CALLING SEQUENCE:
;	D_WWRIT,HEADER,PIXELS [,STATUS][,IRDATA=IRDATA] 
;		[,DIRECTORY=DIRECTORY]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	HEADER and PIXELS are output header and pixels from a file
;		selected using the widget menu
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = the standard status report on the execution
; KEYWORDS:
;	IRDATA = the IR data accompanying the IR data set
;	DIRECTORY= default setting for directory (default is current)
; COMMON BLOCKS:
;	C_SYSTEM and C_HEADER blocks
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Use PICKFILE to identify a file and then using D_IRWRIT, or D_WRITE.
;	Note that if only two parameters are entered, DISRSOFT will not
;	allow you to write an IR image with D_WWRIT and will return an
;	error message.
; MODIFICATION HISTORY:
;       14‑1‑1994 NT  Prototype
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_A_PAR.PRO

;
; NAME:
;    F_A_Par
; PURPOSE:
;    Add or modify a Parameter in a FITS‑HeaderArray.
; CALLING SEQUENCE:
;    F_A_Par, Header, Name, Value, [Format, Comment, Status, BEFORE= , AFTER= ]
; INPUTS:
;    Header = StringArray containing FITS‑Header. Max StringLength must be 
;             equal to 80. If not defined, then F_A_Par will create an
;             empty FITS‑HeaderArray.
;             !!! This Array is changed in place !!!
;
;    Name = Name of Parameter. If Name is already in the Header the Value 
;           and possibly Comment fields are modified. Otherwise a new Record 
;           is added to the Header. If Name = 'HISTORY' then the Value will 
;           be added to the Record without replacement. In this Case the 
;           comment parameter is ignored.
;
;   Value = Value for Parameter. The ValueExpression must be of the correct 
;           Type, e.g. Integer, Floating or String.  StringValues of 'T'
;	    or 'F' are considered LogicalValues.
;
; OPTIONAL INPUT PARAMETERS
;   Format = FORTRAN‑Style OutputFormat for ParameterValue.
;            If not supplied, default Formats apply (see F_hLine)
;
;   Comment = String. The '/' is added by F_hLine.  Added  startin in
;             Position 31. If not supplied, no comment is written.
;
; OPTIONAL OUTPUT PARAMETERS
;   Status = Standard DISR‑Soft StatusStringArray.
;
; OPTIONAL INPUT KEYWORDS:
;	BEFORE	= KeywordStringName. The Parameter will be placed before the
;		  Location of this Keyword. For example, if BEFORE='HISTORY'
;		  then the Parameter will be placed before the first History
;		  Location. This applies only when adding a new Keyword;
;		  Keywords already in the Header are kept in the same Position.
;
;	AFTER	= Same as BEFORE, but the parameter will be placed after the
;		  Location of this Keyword.  This Keyword takes precedence over
;		  BEFORE.
;
; OUTPUTS:
;	Header = updated FITS‑HeaderArray.
; RESTRICTIONS:
;	Warning ‑‑ Parameters and names are not checked
;		against valid FITS‑ParameterNames, Values and Types.
; MODIFICATION HISTORY:
;	DMS, RSI, July, 1983.
;	D. Lindler Oct. 86  Added longer string value capability
;	Converted to NEWIDL  D. Lindler April 90
;       Added Format keyword, J. Isensee, July, 1990
;       Added keywords BEFORE and AFTER. K. Venkatakrishna, May '92
;       Adapted to DISR‑Soft @ MPAE by J.A.St\"uwe, May '94
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_HCONV.PRO

;
; NAME: F_hConv
;
; PURPOSE: Convert a FITS‑Header to an (DISR‑like) HMC‑Header
;
; CATEGORY: FITS
;
; CALLING SEQUENCE: F_hConv,HeaderFITS,HeaderHMC,pSize[,Status]
;
; INPUTS: HeaderFITS ‑ a FITS‑compatible Header‑StringArray
;
; OPTIONAL INPUT PARAMETERS: None
;
; OUTPUTS: HeaderHMC ‑ the HMC‑DataBase Header (DISR‑like)
;          pSize     ‑ simulates the Result of a SIZE‑Function on the PixelArray
;
; OPTIONAL OUTPUT PARAMETERS: Status
;
; KEYWORDS: DeBug    ‑ if set => print DeBugInfo
;
; COMMON BLOCKS: C_HEADER, C_SYSTEM
;
; SIDE EFFECTS:
;
; RESTRICTIONS: None
;
; PROCEDURE: Construct an HMC‑Header from the FITS‑Header
;
; MODIFICATION HISTORY:
;    Written by Joachim A. St\"uwe @ MPAE, Version 1.0 :  09‑May‑1994
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_HEADER.PRO

;
; NAME: MonDigit
;
; PURPOSE: Convert MonthString to corresponding MonthDigits
;
; CALLING SEQUENCE: DigitStrng=MonDigit(MonStrng,Status)
;
; INPUTS: MonStrng ‑ (ususally 3‑character) String with the Month (f.e. Jan)
;
; OUTPUTS: DigitStrng ‑ TwoCharacter‑String with corresponding Digits (f.e. 01)
;
; OPTIONAL OUTPUTS: Status
;
; MDIFICATION: Written by J. A. St\"uwe, MPAE, 16‑Mar‑1994
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_HLINE.PRO

;
; NAME: F_hLine
;
; PURPOSE: Construct a FITS‑HeaderLine
;
; CATEGORY: FITS
;
; CALLING SEQUENCE: HeaderLine=F_hLine(fKeyWrd,kValue,Form,Comment[,Status])
;
; INPUTS:  fKeyWrd ‑ String with Name of the FITS‑KeyWord
;          kValue  ‑ Value of the FITS‑KeyWord
;          Form    ‑ FORTRAN‑Style Format for the Entry of the Value
;          Comment ‑ indicating the Purpose of the Entry
;
; OPTIONAL INPUT PARAMETERS: None
;
; OUTPUTS: HeaderLine ‑ a FITS‑HeaderLine of exactly 80 Characters
;
; OPTIONAL OUTPUT PARAMETERS: Status ‑ the StatusParameter (DISR‑Standard)
;
; KEYWORDS:
;
; COMMON BLOCKS:
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;
; PROCEDURE: see Literature on FITS‑Standard
;
;
; MODIFICATION HISTORY:
;
;              Written by Joachim A. St\"uwe, MPAE, 04‑Mar‑1994
;
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_MIDAS.PRO

;
; NAME: F_MIDAS
;
; PURPOSE: Convert a FITS‑Header to an (DISR‑like) HMC‑Header
;
; CATEGORY: FITS
;
; CALLING SEQUENCE: F_MIDAS,HeaderFITS,HeaderHMC,iStart,iEnd[,Status]
;
; INPUTS: HeaderFITS ‑ a FITS‑compatible Header‑StringArray
;         iStart = i ‑ the Index# where ESO‑Descriptors start in HeaderFITS
;
; OPTIONAL INPUT PARAMETERS: None
;
; OUTPUTS: HeaderHMC ‑ the HMC‑DataBase Header (DISR‑like)
;
; OPTIONAL OUTPUT PARAMETERS: Status
;
; KEYWORDS:DeBug ‑ if set => print DeBugInfo
;
; COMMON BLOCKS: C_HEADER, C_SYSTEM
;
; SIDE EFFECTS: Index to MIDAS‑SectionStart will be incremented,
;    so that calling Routine can continue where this one ends.
;
; RESTRICTIONS: None
;
; PROCEDURE: Decode the ESO‑MIDAS‑DescriptorSection of a FITS‑Header
;    written by ESO‑MIDAS and write it in the ProcessSection of a
;    DISR‑like Header or if it fits into DISR‑Header => put it there
;
; MODIFICATION HISTORY:
;    Written by Joachim A. St\"uwe @ MPAE, Version 1.0 :  10‑May‑1994
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_READ.PRO

;
; NAME: F_Read
;
; PURPOSE: Read a FITS‑File (from Disk) and make it DISR‑like
;
; CATEGORY: FITS
;
; CALLING SEQUENCE: F_Read, FileName, Header, Pixels [,Status]
;
; INPUTS: FileName = scalar String with the Name of the FITS‑File
;
; OPTIONAL INPUT PARAMETERS: None
;
; OUTPUTS: Header ‑ the HMC‑DataBase Header (DISR‑like)
;          Pixels ‑ the PixelArray
;
; OPTIONAL OUTPUT PARAMETERS: Status
;
; KEYWORDS: DEBUG = if set => print DeBugInfo
;
; COMMON BLOCKS: C_HEADER, C_SYSTEM
;
; SIDE EFFECTS:
;
; RESTRICTIONS: None
;
; PROCEDURE: use "Goddard"‑Procedures to read in FITS, then convert FITS‑Header
;
; MODIFICATION HISTORY:
;    Written by Joachim A. St\"uwe @ MPAE, Version 1.0 :  10‑May‑1994
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_READ_F.PRO

;
; NAME:
;    F_READ_F (former READFITS from GSFC‑Library)
; PURPOSE:
;    Read a FITS file into IDL‑Data and optionally Header Variables.
; CALLING SEQUENCE:
;    Result = F_Read_F( FileName,[ Header, Status, /NOSCALE, $
;                       EXTEN_NO = , /DEBUG, NaN_VALUE = , $
;                       STARTROW = , NUMROW = ] )
; INPUTS:
;    FileName = String containing the Name of the File to be read
; OUTPUTS:
;    Result = PixelArray constructed from designated record
; OPTIONAL OUTPUT:
;    Header = StringArray containing the FITS‑Header
;    Status = StringArray with the standard DISR‑StatusValues
; OPTIONAL KEYWORDS:
;    NOSCALE    ‑ If present and non‑Zero, then the OutputData will not be
;                 scaled using the optional BSCALE and BZERO Keywords in the 
;                 FITS‑Header.   Default is to scale.
;    DEBUG      ‑ Normally, F_Read_F will not display the Size of the Array at
;                 the Terminal.  The DEBUG Keyword will cause this Output.
;    NaN_VALUE  ‑ This Scalar is only needed on VaxArchitectures. It 
;                 specifies the Value to translate any IEEE ``not a number''
;                 values in the FITS‑DataArray. It is needed because
;                 the Vax does not recognize the ``not a number'' convention.
;    EXTEN_NO   ‑ Scalar Integer to specify the FITS‑Extension# to read. For
;                 Example, specify EXTEN = 1 or /EXTEN to read the first 
;                 FITS‑Extension. Extensions are read using recursive
;                 calls to F_Read_F.
;    POINT_LUN  ‑ Position (in bytes) in the FITS‑File at which to start
;                 reading. Useful if F_Read_F is called by another procedure
;                 which needs to directly read a FITS extension. Should 
;                 always be a Multiple of 2880.
;    STARTROW   ‑ This Keyword only applies when reading a FITS‑Extension
;                 It specifies the Row (Scalar Integer) of the ExtensionTable
;                 at which to begin reading. Useful when one does not want to
;                 read the entire Table.
;    NUMROW     ‑ This keyword only applies when reading a FITS‑Extension. 
;                 If specifies the Number of Rows (Scalar Integer) of the 
;                 ExtensionTable to read. Useful when one does not want to
;                 read the entire Table.
; EXAMPLE:
;	Read a FITS‑File TEST.FITS into an IDL‑ImageArray, IM and FITS‑
;       HeaderArray, H. Do not scale the Data with BSCALE and BZERO.
;              IDL> IM = F_Read_F( 'TEST.FITS', H, /NOSCALE)
;       If the file contain a FITS‑Extension, it could be read with
;              IDL> tab = F_Read_F( 'TEST.FITS', htab, /EXTEN )
;       To read only rows 100‑149 of the FITS extension,
;              IDL> tab = F_Read_F( 'TEST.FITS', htab, /EXTEN, 
;                                    STARTR=100, NUMR = 50 )
; RESTRICTIONS:
;     (1):     Cannot handle random group FITS
;     (2):     Users with versions of IDL before 2.2.1 should remove the
;               call to the TEMPORARY function near the end of the program
; PROCEDURES USED:
;       F_X_Par, T_IEEE_H, T_W_NAN
; MODIFICATION HISTORY:
;       MODIFIED, Wayne Landsman  October, 1991
;                Reset BSCALE and BZERO after using them
;       Added call to TEMPORARY function to speed processing     Feb‑92
;       Added a check for fixed record length file  under VMS    Jun‑92
;       Added STARTROW and NUMROW keywords for FITS tables       Jul‑92
;       Close LogicalUnit if EOF encountered
;       Adapted to DISR‑Soft @ MPAE by J. A. St\"uwe             May‑94
;       Added ON_IOERROR, J. A. St\"uwe @ MPAE                   Dec‑94
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_WRITE.PRO

;
; NAME: F_Write
;
; PURPOSE: Write FITS‑coded ImageData
;
; CATEGORY: FITS
;
; CALLING SEQUENCE: F_Write,HeaderIn,PixelsIn,OutDev[,Status] $
;                           [,BLCK=BlockingFactor][,/BASIC][,/MIDAS]
;
; INPUTS: HeaderIn ‑ the HMC‑DataBase Header
;         PixelsIn ‑ the PixelValues of the HMC‑Image 
;
; OPTIONAL INPUT PARAMETERS: None
;
; OUTPUTS: OutDev ‑ a String defining where to put the FITS‑Data
;
; OPTIONAL OUTPUT PARAMETERS: Status
;
; KEYWORDS: BlockingFactor ‑ the FITS‑BlockingFactor, defaulted to 10
;           Basic          ‑ Flag for basic FITS‑Formats only: BITPIX = 8,16,32
;
; COMMON BLOCKS: C_DISPL, C_HEADER, C_SYSTEM
;
; SIDE EFFECTS: uses TV_SCAL(2) for FITS "BLANK"‑Value
;
; RESTRICTIONS: Works for HMC‑DataBase Images only,
;
; PROCEDURE: Construct a FITS‑Header from the HMC‑Header and write the Data
;            depending on the String "OutDev"
;
;
; MODIFICATION HISTORY: 02‑Mar‑1994 Written by Joachim A. St\"uwe @ MPAE
;                  JAS: 11‑Mar‑1994 perform Host‑>Network ‑ Conversion
;                  JAS: 13‑Mar‑1994 allow BITPIX = ‑32,‑64
;
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\F_X_PAR.PRO

;
; NAME:
;    F_X_Par
; PURPOSE:
;    Obtain the Value of a Parameter in a FITS‑Header
; CALLING SEQUENCE:
;    Result = F_X_Par( Hdr, Name,[ Status, COUNT= ])   
; INPUTS:
;    Hdr  = FITS‑HeaderArray, (e.g. as returned by F_Read_F)  
;           StringArray, each Element should have a Length of 80 Characters
;    Name = String, Name of the Parameter to return.   If Name is of 
;           the form 'Keyword*' then an Array is returned containing 
;           Values of KeywordN where N is an Integer.  The Value
;	    of KeywordN will be placed in Result(N‑1).  The DataType 
;           of Result will be the Type of the first valid match of KeywordN 
;           found.
; KEYWORDS:
;       COUNT ‑ Optional Keyword to return a Value equal to the Number of 
;               Parameters found by F_X_Par, IntegerScalar
; OUTPUTS:
;       FunctionValue = Value of Parameter in Header.
;          If parameter is DoublePrecision, Floating, Long or String,
;          the Result is of that Type.  Apostrophes are stripped
;          from Strings.  If the Parameter is Logical, 1 is
;          returned for T, and 0 is returned for F.
;          If Name was of Form 'Keyword*' then a Vector of Values
;          are returned.
; OPTIONAL OUTPUTS:
;       Status ‑ The standard DISR‑StatusStringArray
; SIDE EFFECTS:
;       Keyword COUNT returns the Number of Parameters found.
;       Result is set to ‑1 if Parameter not found. If a Vector is returned
;
;       If a keyword occurs more than once in a header, a warning is given,
;       and the first occurence is used.
;
; EXAMPLES:
;        Given a FITS header, H, return the values of all the NAXISi values
;        into a vector. Then place the HistoryRecords into a StringVector.
;
;         IDL> nAxisi  = F_X_Par(H,'NAXIS*',Status)	; Extract NAXISi Values
;         IDL> History = F_X_Par(H,'HISTORY',Status)	; Extract HISTORY‑Recs.
; PROCEDURE:
;	The first 8 Chacters of each Element of Hdr are searched for a 
;       match to Name. The Value from the last 20 Characters is returned.  
;       An Error occurs if there is no Parameter with the given Name.
;       
;       If a numeric Value has no DecimalPoint it is returned as Type
;       LONG.   If it contains more than 8 Numerals, or contains the 
;       Character 'D', then it is returned as Type DOUBLE.  Otherwise
;       it is returned as Type FLOAT
; MODIFICATION HISTORY:
;   DMS, May, 1983, Written.
;   J. Isensee Jul,90 added COUNT keyword
;   W. Thompson, Feb. 1992, added support for FITS complex values.
;   W. Thompson, May 1992, corrected Problem with HISTORY/COMMENT/BLANK
;                          Keywords, and ComplexValueErrorCorrection.
;   J. A. St\"uwe, May 1994 @ MPAE, adapted to DISR‑SOFT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\PWD.PRO

;
; NAME:
;	PWD
; PURPOSE:
;	To emulate the UNIX print path (pwd) command.
; CATEGORY:
;	Screwing around 
; CALLING SEQUENCE:
;	PWD
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	
; PROCEDURE:
;	Use the CD command.
;
; MODIFICATION HISTORY:
;	20‑11‑1994 NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_COISIM.PRO

;
; NAME:
;	S_COISIM
; PURPOSE:
;	Coherent noise simulator
; CATEGORY:
;	Simulation
; CALLING SEQUENCE:
;	S_COISIM,PIXELS_IN,PIXELS_OUT,NOISE_POINTS,AMPLITUDE,STATUS
; INPUTS:
;	PIXELS_IN = the input pixels
;	NOISE_POINTS = a 2 x * element array containing the x and y
;		coordinates of the noise frequencies in the FFT array
;		to be added to the image.
;	AMPLITUDE = the peak‑to‑peak amplitude of each parasitic
;		frequency
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	PIXELS_OUT = output array
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	PIXELS_IN must be two dimensional
; PROCEDURE:
;	For each frequency an array is created and the position
;	assigned in the FFT before back transform.
;	
; MODIFICATION HISTORY:
;	20‑4‑1993 nt
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_CTESIM.PRO

; 
; NAME: 
;       S_CTESIM 
; PURPOSE: 
;       Simulation of charge transfer efficiency effect 
; CATEGORY: 
;       Simulation 
; CALLING SEQUENCE: 
;       S_CTESIM,PIXELS_IN,PIXELS_OUT,CTE,STATUS 
; INPUTS: 
;       PIXELS_IN = input pixels 
;       CTE = charge transfer efficiency   
;       if CTE is a scalar quantity (e.g. 0.9998) then this CTE is 
;       applied to the entire frame.  If CTE is a vector then it MUST 
;       the same size as the x‑dimension and specifies the CTE for 
;       each individual column. 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       PIXELS_OUT = output after smearing 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; KEYWORDS: 
;       NONE 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; PROCEDURE: 
;       I make some error checks.  Then I force the CTE to be a vector.
;	I make an array slightly bigger than the original and complete
;	a shift and add.  At each clock the new value is the sum of
;	what's left behind and what is shifted into the new pixel.
;	This is NOT true for the last shift!!  Here it is assumed that the
;	serial register is completely cleared before the transfer into it. 
;        
; MODIFICATION HISTORY: 
;       20‑4‑1993  nt 
;       15‑03‑1994 NT Fixed bug in the way the program treats the serial
;			register (the last line).
;	16‑03‑1994 NT Additional error checking and added documentation.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_CTE_HV.PRO

;   
; NAME:   
;       S_CTE_HV   
; PURPOSE:   
;       To simulate the effect of horizontal and vertical CTE  
;       on an image.   
; CATEGORY:   
;       Simulation   
; CALLING SEQUENCE:   
;       S_CTE_HV,IMAGE_IN,IMAGE_OUT,VERT_CTE,HORIZ_CTE,STATUS  
; INPUTS:   
;       IMAGE_IN = a 2‑d image  
;       VERT_CTE = the CTE along the CCD columns.  This can be  
;                  a vector.  
;       HORIZ_CTE = the CTE in the serial register.  This must be  
;                  a scalar.  
;   
; OPTIONAL INPUT PARAMETERS:   
;       NONE   
; OUTPUTS:   
;       IMAGE_OUT = the output image after the calculation  
; OPTIONAL OUTPUT PARAMETERS:   
;       STATUS = standard status report   
; KEYWORDS:   
;       NONE   
; COMMON BLOCKS:   
;       NONE   
; SIDE EFFECTS:   
;       NONE   
; RESTRICTIONS:   
;       NONE   
; EXAMPLE:   
;       S_CTE_HV,IMAGE_IN,IMAGE_OUT,0.9998,0.998,STATUS   
; PROCEDURE:   
;       Call S_CTESIM for the vertical CTE.  
;       Rotate the image and call S_CTESIM again for the horizontal CTE   
;       Rotate back again and exit.  
; MODIFICATION HISTORY:   
;       16‑03‑1994 NT   
;   
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_FALSE.PRO

;  
; NAME:  
;       S_FALSE  
; PURPOSE:  
;       A program to generate false DISR data.  
; CATEGORY:  
;       Data simulation.  
; CALLING SEQUENCE:  
;       S_FALSE,DIRECTORY,NUM_DATA_SETS [,STATUS]  
; INPUTS:  
;       DIRECTORY = the main level directory into which the false data  
;               will get shunted.  
;       NUM_DATA_SETS = the total number of data sets required  
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       To disk.  
; OPTIONAL OUTPUT PARAMETERS:  
;       STATUS = standard status report  
; KEYWORDS:  
;       NONE  
; COMMON BLOCKS:  
;       c_system and c_header  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;       D_HOLDER.DOC must be available.  
; EXAMPLE:  
;       S_FALSE,'f:\idl\disrdata',100,STATUS  
; PROCEDURE:  
;       Read in D_HOLDER.DOC, DATASETS.DOC  
;       Randomize on the data set number  
;       Fill header entries with rhubarb depending on the C_DEFDATA  
;       common block entry.  
;       Branch for each data set and generate pixels.  
;       Write away in separate sub‑directory.  
; MODIFICATION HISTORY:  
;       06‑02‑1994 NT  Prototype.  
;       21‑02‑1994 NT  Further work on the pixel output.  Still not ready  
;                       for first compilation!!  
;       27‑02‑1994 NT  Inclusion of D_PARSE subroutine.  
;       04‑03‑1994 NT  Inclusion of pixel sizes etc.  Ready to compile!  
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_NOISIM.PRO

;
; NAME:
;	S_NOISIM
; PURPOSE:
;	To add simulated noise to an image.
; CATEGORY:
;	Simulation
; CALLING SEQUENCE:
;	S_NOISIM,PIXELS_IN,PIXELS_OUT,STANDARD_DEV,STATUS
; INPUTS:
;	PIXELS_IN = input array
;	STANDARD_DEV = the standard deviation of the noise
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	PIXELS_OUT = output array with added noise
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report 	
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;	
; MODIFICATION HISTORY:
;	20‑4‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\SIMULATE\S_SHTSIM.PRO

;
; NAME:
;	S_SHTSIM
; PURPOSE:
;	To model the effect of an electronic shutter on an image
; CATEGORY:
;	Simulation
; CALLING SEQUENCE:
;	S_SHTSIM,PIXELS_IN,PIXELS_OUT,CONSTANT [,STATUS]
; INPUTS:
;	PIXELS_IN = the input image or vector to be smeared
;	CONSTANT = the constant factor used to complete the smear
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	PIXELS_OUT = the output (smeared) image or vector
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The computation is performed with the data types implied by
;	the input parameters.
; RESTRICTIONS:
;	Operates on vectors or arrays.  Note that for arrays the smearing
;	is assumed to be along the columns.
; PROCEDURE:
;	An electronic shutter effect is used where no mechanical shutter for
;	an image is available.  The constant describes the ratio of the
;	line transfer time to the exposure time.
; MODIFICATION HISTORY:
;	7‑MAY‑1991 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\DOC\TEMPLAT.PRO

;
; NAME:
;	
; PURPOSE:
;	
; CATEGORY:
;	
; CALLING SEQUENCE:
;	
; INPUTS:
;	
; OPTIONAL INPUT PARAMETERS:
;	
; OUTPUTS:
;	
; OPTIONAL OUTPUT PARAMETERS:
;	
; KEYWORDS:
;	
; COMMON BLOCKS:
;	
; SIDE EFFECTS:
;	
; RESTRICTIONS:
;	
; EXAMPLE:
;	
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ADDIMS.PRO

; 
; NAME: 
;       T_ADDIMS 
; PURPOSE: 
;       To add two images (which are shifted with respect to each 
;       other), maintaining all pixels in the output array by expanding 
;       it if necessary. 
; CATEGORY: 
;       Image processing. 
; CALLING SEQUENCE: 
;       T_ADDIMS,IMAGE1,IMAGE2,IMAGE_OUT,DX,DY [,STATUS] [,/SUBTRACT] 
;                    [,/AVERAGE] [,MISSING=MISSING] [,/SUB_PIX] 
; INPUTS: 
;       IMAGE1 and IMAGE2 are the input images. 
; 
;       DX and DY gives the distance (in pixels) that IMAGE2 must be
;             shifted in order to bring it into alignment.  This is
;             in the same sense as the SHIFT routine in IDL.
;             i.e.
;         A=[1,2,3,4,5,6]
;         B=SHIFT(A,2)
;         PRINT,B
;               [5,6,1,2,3,4]   
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       IMAGE_OUT = the output added image 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; KEYWORDS: 
;       AVERAGE if set requires the program to average points 
;               where the images over‑lap. 
;       SUBTRACT if set subtracts IMAGE2 from IMAGE1 rather than adds 
;               Note that if both AVERAGE and SUBTRACT are set 
;               AVERAGE takes precedence. 
;       MISSING if set equal to a number requires the program to set all 
;               points in the output array containing no data to the 
;               specified value.  Note that pixels set to this value 
;               in the original arrays will be assumed to be missed also! 
;               and not included in adding or averaging calculations.  
;       SUB_PIX if set performs a sub‑pixel translation on IMAGE2 
;               if DX and DY require it before addition. 
; 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       Doesn't work for double precision. 
; EXAMPLE: 
;       A=RANDOMN(S,20,20) 
;       B=SHIFT(A,3,3) 
;       T_ADDIMS,A,B,B,‑3,‑3,/AVERAGE,MISSING=‑32768. 
;        
;       This should result in a central section of the array 
;       being identical to the contents of A because you 
;       have superimposed the two images taking into account 
;       the shift. The image will be shifted with respect to A by 
;       3 pixels in each direction because the array has been expanded 
;       to take account of elements of B which are are to the bottom 
;       of the contents of A. 
; PROCEDURE: 
;       Trivial 
; 
; MODIFICATION HISTORY: 
;       20‑11‑1994  NT 
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ANGVEC.PRO

;
; NAME:
;	T_ANGVEC
; PURPOSE:
;	To calculate the angle between two vectors.
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	ANGLE= T_ANGVEC,X1,Y1,Z1,X2,Y2,Z2
; INPUTS:
;	x1,y1,z1 = one vector
;	x2,y2,z2 = other vector
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	ANGLE = output angle in degrees
; OPTIONAL OUTPUT PARAMETERS:
;	none
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	Returns ‑1 on error.
; RESTRICTIONS:
;	none
; PROCEDURE:
;	trivial
; MODIFICATION HISTORY:
;	7‑1‑88  nt
;	08‑02‑1994 NT  Modified for DISRSOFT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_APLPSF.PRO

;  
; NAME:  
;        T_APLPSF 
; PURPOSE:  
;        To apply a Gaussian PSF to an image. 
; CATEGORY:  
;        Image simulation 
; CALLING SEQUENCE:  
;        T_APLPSF,PIXELS_IN,PIXELS_OUT,FWHM [,STATUS] 
; INPUTS:  
;        PIXELS_IN = the input pixels 
;        FWHM = the full‑width half maximum of the Gaussian 
; OPTIONAL INPUT PARAMETERS:  
;        NONE 
; OUTPUTS:  
;        PIXELS_OUT = the output pixels after convolution 
; OPTIONAL OUTPUT PARAMETERS:  
;        STATUS = standard status report 
; KEYWORDS:  
;        NONE 
; COMMON BLOCKS:  
;        NONE 
; SIDE EFFECTS:  
;        NONE 
; RESTRICTIONS:  
;        2‑D images only 
; EXAMPLE:  
;       T_APLPSF,P,P1,3. 
; PROCEDURE:  
;       Set up an array the same size as the input pixels 
;       and fill it with the Gaussian profile. 
;       Use an FFT to perform the convolution. 
;  
; MODIFICATION HISTORY:  
;       27‑11‑1994 NT        
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ARC.PRO

;
; NAME:
;	T_ARC
; PURPOSE:
;	Draws an arc on the TV screen
; CATEGORY:
;	Screen drawing
; CALLING SEQUENCE:
;	T_ARC,x0,y0,r,st,fin,device=device,normal=normal,data=data
; INPUTS:
;	x0,y0 = origin
;	r = radius
;	st = the starting angle [degs]
;	fin=the finishing angle [degs]
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	To screen
; OPTIONAL OUTPUT PARAMETERS:
;	none
; KEYWORDS:
;	DEVICE, NORMAL, DATA  = standard coordinate systems
;	DEVICE = default
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	none
; PROCEDURE:
;	Trivial.
; MODIFICATION HISTORY:
;	31‑1‑1993  nt
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ARROW.PRO

;
; NAME:
;	T_ARROW
; PURPOSE:
;	Draws a pretty arrow on the display
; CATEGORY:
;	Screen drawing
; CALLING SEQUENCE:
;	t_arrow,x,y,x1,y1 [,DEVICE=DEVICE,DATA=DATA,NORMAL=NORMAL]
; INPUTS:
;	x,y position of arrowhead
;	x1,y1 direction of arrow tail
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	To screen
; OPTIONAL OUTPUT PARAMETERS:
;	none
; KEYWORDS:
;	DATA,NORMAL, and DEVICE are the standard functions controlling the
;		coordinate system
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	none
; PROCEDURE:
;	trivial
; MODIFICATION HISTORY:
;	7‑3‑93  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_BP.PRO

; NAME:
;	T_BP
; PURPOSE:
;	To find the brightest point in a vector,image, or data cube.
; CATEGORY:
;	Image analysis.
; CALLING SEQUENCE:
;	T_BP,P,X [,Y [,Z]] [SMOOTH=SMOOTH]
; INPUTS:
;	P = array.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	X,Y,Z = co‑ordinates of brightest point.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Works for up to 3 dimensions
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	29‑Jan‑1993  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_BYTSPL.PRO

;
; NAME:
;	T_BYTSPL      (Tool BYTscl SPeciaL)
; PURPOSE:
;	To rescale an image for display (or otherwise) as integer
;	values between minimum and maximum.
; CATEGORY:
;	Image processing
; CALLING SEQUENCE:
;	T_BYTSPL,IMAGE_IN,IMAGE_OUT,MINIMUM,MAXIMUM
; INPUTS:
;	IMAGE_IN = input pixels
;	MINIMUM = the minimum value for the re‑scale
;	MAXIMUM = the maximum value for the re‑scale
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	IMAGE_OUT = output pixels (re‑scaled)
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	4‑12‑1989  NT
;	18‑2‑1993  NT  (name change and conversion to IDL V3.0)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_CARTES.PRO

;
; NAME:
;	T_CARTES
; PURPOSE:
;	To convert polar co‑ordinates into cartesians (reverse of T_POLAR)
; CATEGORY:
;	Image manipulation.
; CALLING SEQUENCE:
;	T_CARTES,IMAGE_IN,IMAGE_OUT,XC,YC,RAD1,RAD2,AZ1,AZ2,COL,LIN
; INPUTS:
;	IMAGE_IN = input image
;	XC,YC = centre of rotation
;	RAD1,RAD2 = inner and outer radius
;	AZ1,AZ2 = starting and finishing azimuth in degrees.
;	COL,LIN = the number of columns and lines in the output
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	IMAGE_OUT = output image
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NOTE THAT NO MASK IS APPLIED SO THERE WILL BE EDGE EFFECTS
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	5‑12‑89  NT
;	14‑06‑1993  NT   Version 3.0
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_CIRCLE.PRO

;
; NAME:
;	T_CIRCLE
; PURPOSE:
;	Draws a circle on the TV screen
; CATEGORY:
;	Screen drawing
; CALLING SEQUENCE:
;	T_CIRCLE,x0,y0,r,device=device,normal=normal,data=data,fill=fill
; INPUTS:
;	x0,y0 = origin
;	r = radius
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	To screen
; OPTIONAL OUTPUT PARAMETERS:
;	none
; KEYWORDS:
;	DEVICE, NORMAL, DATA  = standard coordinate systems
;	DEVICE = default
;	FILL if set fills the circle
;	COLOR= normal colour
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	none
; PROCEDURE:
;	Trivial.
; MODIFICATION HISTORY:
;	31‑1‑1993  WC
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_COLBAR.PRO

;
; NAME:
;	T_COLBAR
; PURPOSE:
;	To prvide a colour bar on the graphics device.
; CATEGORY:
;	Displays
; CALLING SEQUENCE:
;	T_COLBAR [,THICK=THICK,ROTATION=ROTATION,XPOS=XPOS,YPOS=YPOS,LENGTH=LENGTH,UPPER=UPPER,LOWER=LOWER]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	To window or to PS file.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	THICK = a factor for multiplying the thickness of the bar  (the default size is 10 pixels)
;	LENGTH =  a multiplication factor controlling the length (the default length is 256)
;	ROTATION = controls whether the colourbar lies down is vertical etc (default is lying down left to right).  
;	XPOS,YPOS = controls the position in the window (default = 0,0)
;	UPPER and LOWER specify the maximum and minimum byte values for the colour bar (in case
;		you are reserving other colours for overlays etc.) (default =255,0)
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; EXAMPLE:	
;	T_COLBAR,THICK=1.,ROTATION=1,XPOS=200,YPOS=0,LENGTH=1
;
; MODIFICATION HISTORY:
;	31‑1‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_COLROW.PRO

; 
; NAME: 
;       T_COLROW 
; PURPOSE: 
;       An interactive routine designed to make profiles on an image 
;       but only in rows and columns. 
; CATEGORY: 
;       Interactive image analysis 
; CALLING SEQUENCE: 
;       T_COLROW, IMAGE [,X ,Y ,STATUS, /MODAL] 
; INPUTS: 
;       IMAGE = a standard image 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       Plots to disk. 
; OPTIONAL OUTPUT PARAMETERS: 
;       NONE 
; KEYWORDS: 
;       X = a keyword which must be a vector the same length 
;               as the X axis of IMAGE.  This specifies the 
;               scale along the X axis 
;       Y = as X but species the scale for the Y axis 
; 
;       If either is not set the program assumes you want to 
;       plot data as a function of pixel number. 
; 
; 	MODAL = the modal keyword for the widget
; COMMON BLOCKS: 
;       Internal common block for widgets 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; PROCEDURE: 
;       Trivial 
; 
; MODIFICATION HISTORY: 
;       06‑02‑1994 NT  Prototype 
;       20‑02‑1994 NT  Inclusion of optional keywords which allow 
;                       the scaling of the axes. 
;	09‑11‑1994 NT  Inclusion of modal keyword.
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_COLSEP.PRO

; 
; NAME: 
;       T_COLSEP 
; PURPOSE: 
;       To make three separate byte‑scaled images in the colours defined 
;       by the look‑up table R,G,B from the input image. 
; CATEGORY: 
;       Catalogue ‑ display manipulation 
; CALLING SEQUENCE: 
;       T_COLSEP,R,G,B,IMAGE_IN,IMAGE_RED,IMAGE_GRE,IMAGE_BLU,STATUS 
; INPUTS: 
;       R,G,B = the colour table parameters 
;       IMAGE_IN = the input image to be converted 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       IMAGE_RED,IMAGE_GRE,IMAGE_BLU = the corresponding colour images. 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       Image must be in bytes.  Data files get too big otherwise. 
; PROCEDURE: 
;       Trivial 
; MODIFICATION HISTORY: 
;       5/9/90  nt 
;       17‑02‑1994 NT Modified for DISRSOFT toolbox. 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_CORREL.PRO

;         
; NAME:         
;       T_CORREL         
; PURPOSE:         
;       To determine the shifts required to correlate IMAGE_1 with         
;       IMAGE_2          
; CATEGORY:         
;       Tools         
; CALLING SEQUENCE:         
;       T_CORREL,IMAGE_1,IMAGE_2,DELTA_X,DELTA_Y  [,/SUB_PIX,STATUS]         
; INPUTS:         
;       IMAGE_1 and IMAGE_2 are the two images to be correlated.  They         
;       must have the same dimensions and must be 2‑D.         
; OPTIONAL INPUT PARAMETERS:         
;       NONE         
; OUTPUTS:         
;       DELTA_X and DELTA_Y are the shifts that must be applied to         
;               IMAGE_2 to provide optimum correlation in the same 
;              sense as the SHIFT routine of IDL.  
; OPTIONAL OUTPUT PARAMETERS:         
;       STATUS = standard status report         
; KEYWORDS:         
;       SUB_PIX requests a sub‑pixel correlation which uses the        
;                 T_SUBMAX routine.         
; COMMON BLOCKS:         
;       NONE         
; SIDE EFFECTS:         
;       NONE         
; RESTRICTIONS:         
;        This routine has an optimum range of operation.  The images 
;        should not be correlated to better than 1 pixel already because 
;        of the way the routine seeks the best position. Errors larger 
;        than 1/3rd the image size should also be avoided. 
; EXAMPLE:         
;       B=FINDGEN(64,64) MOD 64         
;       T_CORREL, B, SHIFT(B,3,3), DELTA_X, DELTA_Y         
; PROCEDURE:         
;       Use FFT correlation and find the maximum to determine the shift.         
;       Check for sub‑pixel accuracy then fit the maximum with a        
;       gaussian and find the maximum sub‑pixel.  This simple algorithm        
;       has to be augmented with a lot of tricks because of fitting
;       errors if the difference between the images is very small.
;
; MODIFICATION HISTORY:         
;       10‑04‑1994  NT         
;       11‑04‑1994  NT  Inclusion of sub‑pixel option.        
;       18‑04‑1994  NT  Verification of limits on routine.    
;       27‑11‑1994  NT  New more robust algorithm found and implemented     
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_COSMIC.PRO

;
; NAME:
;	T_COSMIC
; PURPOSE:
;	To remove a cosmic from a sub‑array of an image.
; CATEGORY:
;	Image processing
; CALLING SEQUENCE:
;	t_cosmic,pixels_in,pixels_out [,sigma_thres=sigma_thres,status]
; INPUTS:
;	pixels_in = the input pixels 
;		This should normally be a small sub‑array of an image.
;		The sub‑array should contain only one cosmic and should
;		have at least one column and line free from the cosmic
;		on each side of the array.
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	pixels_out = the output pixels with cosmic removed
; OPTIONAL OUTPUT PARAMETERS:
;	status = standard status report
; KEYWORDS:
;	sigma_thres = the threshold for the cosmic removal in units
;			of the standard deviation of the unaffected
;			pixels from a linear interpolation fit.  Default
;			is 4.
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	Two‑D array only.
; EXAMPLE:
;	t_cosmic,pixels_in,pixels_out,sigma_thres=3.
; PROCEDURE:
;	The edges of the input array are used to determine the standard
;	deviation of the image from a linear least squares fit along
;	columns and lines.  The edges are then used to find which pixels
;	are affected by the cosmic.  These pixels are then interpolated
;	using T_MISSING.
;
; MODIFICATION HISTORY:
;	30‑04‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_CROSS.PRO

; NAME:
;	T_CROSS
; PURPOSE:
;	To put a cross on the TV display
; CATEGORY:
;	Image display
; CALLING SEQUENCE:
;	T_CROSS,X,Y [,SIZ]
; INPUTS:
;	X,Y = position for centre of cross.
; OPTIONAL INPUT PARAMETERS:
;	SIZ = length of line (default = 5)
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	DEVICE, NORMAL, DATA = standard coordinate systems
;	COLOR = a colour code
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	29‑1‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_CUTPST.PRO

;  
; NAME:  
;       T_CUTPST  
; PURPOSE:  
;       To complete manipulative operations (such as cut and paste) on an image  
; CATEGORY:  
;       Data display  
; CALLING SEQUENCE:  
;       T_CUTPST,PIXELS_IN,PIXELS_OUT  
; INPUTS:  
;       PIXELS_IN = a byte array (should be 2‑D)  
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       PIXELS_OUT = the output array  
; OPTIONAL OUTPUT PARAMETERS:  
;       NONE  
; KEYWORDS:  
;       NONE  
; COMMON BLOCKS:  
;       C_CUTPST = a common block required to pass parameters through the  
;               XMANAGER  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;       This routine ONLY works on byte arrays at present. Note that when  
;       a cut is performed, the pixel are set to zero in the output.   
; PROCEDURE:  
;       Easy.  Use a modified version of the T_IMAGE SLOWBOX routine to get  
;       the cut.  Hold the cut section of the array in a buffer and  
;       paste it back in with one IDL command.  Pointer from T_IMAGE included  
;       for convenience.  
; MODIFICATION HISTORY:  
;       17‑02‑1994 NT  Prototype  
;       21‑07‑1994 NT Incorporation of the INSERT_TEXT and T_TVSURR capability.  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_DECDEG.PRO

;
; NAME:
;	T_DECDEG
; PURPOSE:
;	To convert a declination in degs, mins, secs into a decimal
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	ANGLE= T_DECDEG (DMS [,STATUS])
; INPUTS:
;	DMS=DEG,MINS,SECS = the standard values as given in the
;			Astronomical Almanac  th format MUST be string
; 			of the form ‑xx:yy:zz.zzz
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	ANGLE = the decimal angle  (nb. THIS TAKES THE VALUE OF
;		‑999 IF THERE IS A FAILURE). This output is double precision.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	19‑11‑1994  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_DIALOG.PRO

;
; NAME:
;	T_DIALOG
; PURPOSE:
;	A widget dialogue box for IDL data entry.
; CATEGORY:
;	Widgets
; CALLING SEQUENCE:
;	TEXT_OUT=T_DIALOG(TITLE=TITLE [ /MODAL,STATUS])
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	TEXT_OUT = the output from the one line text widget
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	TITLE = the title of the dialogue box
;	MODAL = if set prevents other widgets being pressed until this one
;		disappears.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	
; PROCEDURE:
;	Trivial.  Set up an editable text widget.
;
; MODIFICATION HISTORY:
;	19‑07‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_GAUINT.PRO

;
; NAME:
;	T_GAUINT
; PURPOSE:
;	To integrate numerically a Gaussian
; CATEGORY:
;	Numerical integration
; CALLING SEQUENCE:
;	T_GAUINT,PEAK,WIDTH,INTEGRAL
; INPUTS:
;	PEAK = the peak value of the Gaussian
;	WIDTH = the 1/e width ‑ this should be the output from the
;		MULTIFIT or GAUSSFIT functions for the 1/e width
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	INTEGRAL = the integral under the curve
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;	
; MODIFICATION HISTORY:
;	25‑5‑1993 nt
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_GETDIR.PRO

;
; NAME:
;	t_getdir
; PURPOSE:
;	To obtain a list of sub‑directories in the current directory.
; CATEGORY:
;	File manipulation
; CALLING SEQUENCE:
;	out=t_getdir()
; INPUTS:
;	none
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	out = a string array containing the names of the sub‑directories
;		set to ‑1 on error
; OPTIONAL OUTPUT PARAMETERS:
;	none
; KEYWORDS:
;	none
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	none
; PROCEDURE:
;	Modified from the PICKFILE procedure in the widget IDL library
;
; MODIFICATION HISTORY:
;	05‑11‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_GETFIL.PRO

;
; NAME:
;	t_getfil
; PURPOSE:
;	To get a list of files in the current directory corresponding to the
;	file filter.
; CATEGORY:
;	File manipulation
; CALLING SEQUENCE:
;	out = t_getfil (filt)
; INPUTS:
;	filt = a string containing a file filter. Default = '*.*'
; OPTIONAL INPUT PARAMETERS:
;	none
; OUTPUTS:
;	out = a string array of files in the current directory meeting
;		the filter specification
; OPTIONAL OUTPUT PARAMETERS:
;	none
; KEYWORDS:
;	none
; COMMON BLOCKS:
;	none
; SIDE EFFECTS:
;	none
; RESTRICTIONS:
;	none
; PROCEDURE:
;	Modified from PICKFILE in the IDFL widget library.
;
; MODIFICATION HISTORY:
;	05‑11‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_HELP.PRO

;
; NAME:
;	T_HELP
; PURPOSE:
;	To provide a simple interface for a help widget.
; CATEGORY:
;	Rosetta 
; CALLING SEQUENCE:
;	T_HELP,TEXT [,TITLE=TITLE] [,STATUS]
; INPUTS:
;	TEXT is a string array containing information.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	TITLE = the title of the help widget.
; COMMON BLOCKS:
;	C_HELP internal common block
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	
; PROCEDURE:
;	Trivial.  Fire a widget and load the text into a text widget
;	with a done button.
;
; MODIFICATION HISTORY:
;	19‑06‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_HEXINT.PRO

;
; NAME:
;	T_HEXINT
; PURPOSE:
;	To convert a 2‑hex byte number of any length into an integer.
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	INT_OUT= T_HEXINT (HEX_IN [,TWO_OUT,STATUS])
; INPUTS:
;	HEX_IN = string with most significant bytes first (e.g. '34FE')
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	INT_OUT = longword integer output
; OPTIONAL OUTPUT PARAMETERS:
;	TWO_OUT = the two's complement result
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	1‑2‑1990  NT
;	06‑02‑1994  NT  Revised for DISRSOFT tools
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_HMSDEG.PRO

;
; NAME:
;	T_HMSDEG
; PURPOSE:
;	To convert right ascension in hours, minutes and seconds into
;	decimal degrees
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	ANGLE=T_HMSDEG( HMS [,STATUS])
; INPUTS:
;	HMS is the hours minutes and seconds for the object
; 		in the format hh:mm:ss.s
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	ANGLE = the output angle.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	19‑11‑1994  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\T_IEEE_H.PRO

;
; NAME:
;   T_IEEE_H (former IEEE_to_Host from Goddard‑Library)
; PURPOSE:
;    To translate an IDL‑Variable in IEEE‑754 representation (as used, for
;    Example, in FITS‑Data ), into the HostMachineArchitecture.
;
; CALLING SEQUENCE:
;
;    T_IEEE_H, Data [, Status, IDLTYPE = IDL_Type]
;
; INPUT‑OUTPUT PARAMETERS:
;     Data ‑ any IDL‑Variable, Scalar or Vector. It will be modified by
;            T_IEEE_H to convert from IEEE to HostRepresentation. Byte 
;            and StringVariables are returned by T_IEEE_H unchanged.
; OPTIONAL KEYWORD INPUTS:
;     IDLTYPE ‑ scalar integer (1‑7) specifying the IDL‑DataType according
;             to the Code given by the SIZE‑Function. This Keyword is usually
;             set when "Data" is a ByteArray to be interpreted as
;             another DataType (e.g. FLOAT).
; EXAMPLE:
;     A 2880 ByteArray (named ByteArr) from a FITS‑Record is to be 
;     interpreted as floating and converted to the HostRepresentaton:
;
;      DISR> T_IEEE_H, ByteArr, IDLTYPE=4
; METHOD:
;     The BYTEORDER procedure is called with the appropiate Keyword
; RESTRICTION:
;     Will run *much* faster for Floating or DoublePrecision if the IDL‑Version
;     is since 2.2.2 when the /XDRTOF Keyword became available to BYTEORDER.
;     However, T_IEEE_H should still work in earlier Versions of IDL
; MODIFICATION HISTORY:
;     Written, W. Landsman   Hughes/STX   May, 1992
;     Fixed error Case statement for float and double   Septemer 1992
;     DISR‑adapted, J. A. St\"uwe    MPAE    May, 1994
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_IMAGE.PRO

;  
; NAME:  
;       T_IMAGE  
; PURPOSE:  
;       To simulate the Mackintosh Image program for simple operations  
;       on an image  
; CATEGORY:  
;       Data display  
; CALLING SEQUENCE:  
;       T_IMAGE,PIXELS  
; INPUTS:  
;       PIXELS = a pixel array (should be 2‑D)  
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       NONE  
; OPTIONAL OUTPUT PARAMETERS:  
;       NONE  
; KEYWORDS:  
;       NONE  
; COMMON BLOCKS:  
;       IMAGE = a common block required to pass parameters through the  
;               XMANAGER  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;       There are some.  For MARK to work well, the image should contain  
;       values between ‑999 and plus 999.  Try to avoid depressing the  
;       mouse button for too long in LINE DRAW mode since this fires the mouse  
;       too quickly and too often for the program.  
; PROCEDURE:  
;       Click on the various buttons to perform operations.  The right mouse  
;       button usually stops operations such as LINEDRAW, MARK, POINTER and  
;       BOX.  
;  
; MODIFICATION HISTORY:  
;       7/5/93 NT   Preliminary test version  
;       17/6/93 NT  Modification to display for a status bar.  
;       10/12/93 NT Extra wait loaded into SLOWBOX because the HP is too fast!  
;       13/12/93 NT Error check to be sure input image exists.  
;       27/06/94 NT Addition of rotation capability.  
;       09/11/94 NT Addition of flip and profile capability.  
;       28/11/94 NT Improved zoom capability using T_ZOOM
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_INTERP.PRO

;
; NAME:
;	T_INTERP
; PURPOSE:
;	Interpolation within a two‑dimensional array.
; CATEGORY:
;	Interpolation
; CALLING SEQUENCE:
;	T_INTERP,IMAGE,POINTSX,POINTSY,OUTPUT
; INPUTS:
;	IMAGE = the image including the data
;	POINTSX, POINTSY  are vectors including the coordinates to be
;	interpolated
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the output vector corresponding to POINTSX,POINTSY
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	Points outside the input image are set to ‑32768
; RESTRICTIONS:
;	Vectors only
; PROCEDURE:
;	TRIVIAL
;	
; MODIFICATION HISTORY:
;	27‑1‑1993  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_LAGR.PRO

;
; NAME:
;	T_LAGR
; PURPOSE:
;	A Lagrange 4 point interpolation routine.
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	T_LAGR,FX,FY,X,Y
; INPUTS:
;	FX = independent variable
;	FY = dependent variable
;	X = point for which value is required.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	Y =  output interpolated value
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	29‑1‑1993 NT
;	30‑01‑1994 NT Name changed to T_LAGR
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_LEAST.PRO

; NAME:
;	T_LEAST
; PURPOSE:
;	To produce a linear least square fit to input data.
; CATEGORY:
;	Simple statistics.
; CALLING SEQUENCE:
;	FIT = T_LEAST (X,Y  [,GRADIENT,INTERCEPT,SDEV,MX,MY] )
; INPUTS:
;	X,Y = input arrays of x and y co‑ordinates to be fit.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	FIT = fitted y values.
; OPTIONAL OUTPUT PARAMETERS:
;	GRADIENT = gradient of fitted line.
;	MX = mean of x values.
;	MY = mean of y values.
;	INTERCEPT = intercept.
;	SDEV = standard deviation from fit.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; KEYWORDS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	NT 22‑1‑87  MPAE, LINDAU.
;	nt  30‑11‑87  intercept added  
;	27‑11‑1993 NT Change to V3.1 IDL.  Modified to a function
;			with optional parameters. 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_LOMMEL.PRO

;
; NAME:
;	T_LOMMEL
; PURPOSE:
;	To compute the normalised surface brightness according to a
;	Lommel‑Seeliger law.
; CATEGORY:
;	Surface physics modelling.
; CALLING SEQUENCE:
;	OUTPUT=T_LOMMEL(INCIDENCE,EMISSION[,STATUS])
; INPUTS:
;	INCIDENCE = the angle of incidence on the surface [deg]
;	EMISSION = the angle of emission on the surface [deg]
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the surface brightness normalised to 1 above the 
;		sub‑solar point at a phase angle of zero.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report.
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	PRINT,T_LOMMEL(20.,20.)
; PROCEDURE:
;	See Beebe and Herzog, Icarus 25 555 1975 and refs. therein.
;
; MODIFICATION HISTORY:
;	11‑09‑1994 NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MARK.PRO

;  
; NAME:  
;       T_MARK  
; PURPOSE:  
;       To mark the current image with its value.  
; CATEGORY:  
;       Display  
; CALLING SEQUENCE:  
;       T_MARK,IMAGE [,OFFX,OFFY]  
; INPUTS:  
;       IMAGE = the image itself  
; OPTIONAL INPUT PARAMETERS:  
;       OFFX,OFFY = offset of the image from  
;               the corner of the window  
; OUTPUTS:  
;       To image display.  
; OPTIONAL OUTPUT PARAMETERS:  
;       NONE  
; KEYWORDS:  
;       COLOR  
;       NOMULTI the switch for the Power of 10 adjustment  
; COMMON BLOCKS:  
;       NONE  
; SIDE EFFECTS:  
;       Draw on graphics device.  
; RESTRICTIONS:  
;       Not available in anything except X and WIN  
;  
; PROCEDURE:  
;       To maintain some semblance of sense the routine  
;       multiplies your image by a power of ten in such  
;       a way that the maximum value lies between 100 and 1000.  
;       You thus have a dynamic range of 1000 in the image.  
;       The power of ten required is displayed on the screen  
;       in a print statement.  This can be stopped by using the  
;       NOMULTI switch.  But note that values may then  
;       be out of range!!  
; MODIFICATION HISTORY:  
;       29‑1‑1993 NT  
;       26‑11‑1993 NT Fix for two button mouse.  
;       28‑07‑1994 NT Inclusion of STRTRIM to truncate the blanks. 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MEANS.PRO

;
; NAME:
;	T_MEANS
; PURPOSE:
;	An interactive routine designed to investigate sections of
;	of an image and plot out results.
; CATEGORY:
;	Interactive image analysis
; CALLING SEQUENCE:
;	T_MEANS, IMAGE
; INPUTS:
;	IMAGE = a standard image
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	Plots to disk.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	Internal common block for widgets
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	27‑10‑1993 NT  Prototype
;	07‑01‑1994 NT  Correction for change in widget_text tag name
;       21‑01‑1994 NT  Button widget control modified for clearer performance
;	22‑01‑1994 NT  Implementation of hourglass and sizing control for the
;			draw window when the image size > screen size/2
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MIEPHA.PRO

;
; NAME:
;	T_MIEPHA
; PURPOSE:
;	given the size parameter, complex index of refraction, a vector
;	containing angles, then return the phase function
; CATEGORY:
;	Modelling of scattering function
; CALLING SEQUENCE:
;	t_miepha, x, m_ref, ntheta,theta,phase [,status]
; INPUTS:
;	x = the size parameter of the particles
;	m_ref = the complex index of refraction (complex number!!)
;	theta = a vector angle for which the phase function is required
;		NB: this is in [radians]
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	phase = the output phase function for the angles specified
; OPTIONAL OUTPUT PARAMETERS:
;	status = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
; 	t_miepha,5.213,complex(1.55,0.01), 3.141595*findgen(181)/180.,phase
;	
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	25‑02‑1994  Original algorithm and program produced by WJM.  
;		    Incorporated into DISRSOFT by NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MINNAE.PRO

;
; NAME:
;	T_MINNAE
; PURPOSE:
;	To compute the normalised surface brightness according to a
;	Minnaert law.
; CATEGORY:
;	Surface physics modelling.
; CALLING SEQUENCE:
;	OUTPUT=T_MINNAE(INCIDENCE,EMISSION,K_PARAMETER[,STATUS])
; INPUTS:
;	INCIDENCE = the angle of incidence on the surface [deg]
;	EMISSION = the angle of emission on the surface [deg]
;	K_PARAMETER = the K parameter  must be ‑1 < K < 1
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the surface brightness normalised to 1 above the 
;		sub‑solar point at a phase angle of zero.
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report.
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	PRINT,T_MINNAE(20.,20.,0.3)
; PROCEDURE:
;	See Beebe and Herzog, Icarus 25 555 1975 and refs. therein.
;
; MODIFICATION HISTORY:
;	11‑09‑1994 NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MISSED.PRO

;
; NAME:
;	T_MISSED
; PURPOSE:
;	To fill missing pixels
; CATEGORY:
;	Image reconstruction.
; CALLING SEQUENCE:
;	T_MISSED,PIXELS_IN,PIXELS_OUT [,STATUS]
; INPUTS:
;	PIXELS_IN = INPUT PIXEL SET
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	PIXELS_OUT = output reconstructed data
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Identify all pixels set to ‑32768.  Interpolate where 
;	at least one pixel in the immediate surroundings is filled.
;	Algorithm for filling is that all neighbours are used
;	but pixels on the diagonals are weighted less (sqrt 2).
;	If pixels are still missing (i.e. were completely
;	surrounded by missed pixels on the first pass) then the
;	program loops until all missed pixels are filled.
;
; MODIFICATION HISTORY:
;	16‑3‑93  NT
;	01‑05‑1994 NT Improved interpolation.
;	28‑05‑1994 NT  Bug fix for pixels completely surrounded by
;			missed pixels.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MJD.PRO

;
; NAME:
;	T_MJD
; PURPOSE:
;	Computes the modified Julian date
; CATEGORY:
;	Timings
; CALLING SEQUENCE:
;	RESULT=T_MJD (DAY,MONTH,YEAR,HOURS,MINS,SECS)
; INPUTS:
;	DAY,MONTH,YEAR,HOURS,MINS,SECS = fairly obvious I think.
;	The month must be set as an integer.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	RESULT = time in days for the Modified Julian Date
;		00:00 UT on 0th January 1993 = 48987.0000
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Procedure only works for Julian dates from 1901 AD onward.
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	19‑12‑1988  NT
;	25‑11‑1993  NT  Modified for DISRSOFT and IDL V3.1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MKDIR.PRO

;
; NAME:
;	T_MKDIR
; PURPOSE:
;	To make a directory independent of the operating system.
; CATEGORY:
;	Tools
; CALLING SEQUENCE:
;	OUTPUT = T_MKDIR(NEW_DIRECTORY)
; INPUTS:
;	NEW_DIRECTORY = the path of the new directory to be created
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = 1 if the directory has been successfully created
;		0 or ‑1 if not.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	No error checking is performed on the input.  So watch it!
; EXAMPLE:
;	OUTPUT = T_MKDIR('d:\cal_soft\disrsoft\data\t940130a')
; PROCEDURE:
;	This is a real tricky problem.  I first check to see if the directory
;	exists.  Note that there is no change in the current directory, so
;	the full path needs to be used unless you want to create something
;	under the current directory.  I then call the operating system
;	with a spawn.  The result argument doesn't work under WIN32
;	with the spawn, therefore I cannot get the error message if there
;	is one from the operating system.  Thus I must check again
;	to see if the directory has been correctly generated.  Then exit.
;
; MODIFICATION HISTORY:
;	30‑01‑1994 NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MOSAIC.PRO

;           
; NAME:           
;       T_MOSAIC           
; PURPOSE:           
;       An interactive program to compare, match, and mosaic two           
;       images.           
; CATEGORY:           
;       Tools           
; CALLING SEQUENCE:           
;       T_MOSAIC , IMAGE1, IMAGE2 [, IMAGE_OUT] [,MISSING=MISSING] [, STATUS]           
; INPUTS:           
;       IMAGE1 forms a reference image to which IMAGE2 will be           
;       matched.        
; OPTIONAL INPUT PARAMETERS:           
;       NONE        
; OUTPUTS:           
;       NONE           
; OPTIONAL OUTPUT PARAMETERS:           
;       IMAGE_OUT is the output from the mosaic program. If the mosaic action        
;               is not completed by the user, this variable will be filled        
;               with a scalar value of ‑1        
;           
;       STATUS = standard status report.           
; KEYWORDS:           
;       MISSING (if set) specifies the value of missed pixels (default        
;               is zero).  Input pixels containing the value MISSING        
;               are treated as missed as well as pixels which are        
;               not defined after the mosaic process.        
; COMMON BLOCKS:           
;       Internal           
; SIDE EFFECTS:           
;                  
; RESTRICTIONS:           
;                  
; EXAMPLE:           
;       This procedures allows you to mosaic images.  IMAGE1 forms the        
;       reference image. All operations are performed on IMAGE2. The        
;       program first requires you to determine the offset between the        
;       two images.  This can be performed either manually or by using        
;       an FFT correlation routine.  Manual operation requires you        
;       to click on modify coordinates and change the x and y coordinates        
;       for the mosaic.  The numbers you see define the pixel in IMAGE2        
;       which be averaged with IMAGE1(0,0).  These numbers can be negative        
;       of course.  The FFT correlation is envoked by using the buttons        
;       Set ref Move mos  (set reference move mosaic) and Set mos Move ref.        
;       With the former button, you modify the position and the size of        
;       the correlation box on the reference image. You are then forced        
;       to go to the mosaic image and place a box of the same size on        
;       the mosaic image.  Set mos Move ref operates in the opposite way.        
;       Thus you can specify exactly which parts you wish to use for        
;       the correlation.  Pressing the correlation button then invokes the        
;       sub‑pixel correlation.        
;        
;       Once the correlation points have been set, you can click on Mosaic        
;       and the program will call T_ADDIMS and put the frames together.        
;       T_IMAGE and T_WPROFI have been put in the widget to help you        
;       take a look at the result before you exit the routine.        
;        
;       You also have the options to turn off sub‑pixel accuracy and to        
;       turn off averaging of pixels in the mosaic using the exclusive        
;       widgets on the left.  These buttons are set on entry to the code        
;       (i.e. sub‑pixel accuracy and averaging of data points is the        
;       default).        
;        
;        
;        
; PROCEDURE:           
;       Use a widget to manipulate IMAGE2 and then use FFT correlation           
;       and translation to prepare the data for matching.  Use T_ADDIMS        
;       to add the images together with averaging and masking for        
;       missing pixels.         
; MODIFICATION HISTORY:           
;       25‑11‑1994 NT Prototype.           
;           
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MOVBOX.PRO

;  
; NAME:  
;      T_MOVBOX  
; PURPOSE:  
;      To manipulate the position on an image of a box which has 
;      already been fixed in size.  
; CATEGORY:  
;      Mosaic tools   
; CALLING SEQUENCE:  
;      T_MOVBOX,P,TEXT1,TEXT2,TEXT3,TEXT4,BOX_DIM,BOXER [,STATUS] 
; INPUTS:  
;      P = the image which forms the limits of the box movement 
;       TEXT1, TEXT2, TEXT3, and TEXT4 are the ids of text widgets  
;       which will be used to monitor the mouse position and give  
;       statistics on the image.  
;  
;       TEXT1 and 2 give the mouse coordinates, TEXT3 gives the output  
;       statistics, TEXT4 gives error messages and instructions.  
;       The calling routine should have a separate text widget for  
;       each of these entries. The widget should be non‑editable and  
;       have YSIZE=1.  
; 
;       BOX_DIM = the x and y dimensions of the box in a two element 
;          vector (integer assumed!) 
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       BOXER = the lower left and upper right corners of the box  
;                [x1,y1,x2,y2]  
;       Note that this variable will be ill‑defined if you exit before the  
;       box has been defined.  
;         
; OPTIONAL OUTPUT PARAMETERS:  
;       STATUS = standard status report  
; KEYWORDS:  
;       NONE 
; COMMON BLOCKS:  
;       NONE  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;         
; EXAMPLE:  
;       T_MOVBOX,FINDGEN(200,200) MOD 200,TX1,TX2,TX3,TX4,[20,10],BOXER  
; PROCEDURE:  
;       derived from T_SLWBOX  
;  
; MODIFICATION HISTORY:  
;       23‑11‑1994 NT  
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MULFIT.PRO

; NAME: 
;       CURVEMFIT 
; 
; PURPOSE: 
;       Non‑linear least squares fit to a function of an arbitrary  
;       number of parameters.  The function may be any non‑linear  
;       function where the partial derivatives are known or can be  
;       approximated. 
; 
; CATEGORY: 
;       E2 ‑ Curve and Surface Fitting. 
; 
; CALLING SEQUENCE: 
;       Result = CURVEMFIT(X, Y, W, A, SIGMAA,TYPE, FUNCTION_NAME = name) 
; 
; INPUTS: 
;       X:  A row vector of independent variables. 
; 
;       Y:  A row vector of dependent variable, the same length as x. 
; 
;       W:  A row vector of weights, the same length as x and y. 
;               For no weighting, 
;               w(i) = 1.0. 
;               For instrumental weighting, 
;               w(i) = 1.0/y(i), etc. 
; 
;       A:  A vector, with as many elements as the number of terms, that  
;           contains the initial estimate for each parameter.  If A is double‑ 
;           precision, calculations are performed in double precision,  
;           otherwise they are performed in single precision. 
; 
; KEYWORDS: 
;       FUNCTION_NAME:  The name of the function (actually, a procedure) to  
;       fit.  If omitted, "FUNCT" is used. The procedure must be written as 
;       described under RESTRICTIONS, below. 
; 
; OUTPUTS: 
;       Returns a vector of calculated values. 
;       A:  A vector of parameters containing fit. 
; 
; OPTIONAL OUTPUT PARAMETERS: 
;       Sigmaa:  A vector of standard deviations for the parameters in A. 
;        
; COMMON BLOCKS: 
;       NONE. 
; 
; SIDE EFFECTS: 
;       None. 
; 
; RESTRICTIONS: 
;       The function to be fit must be defined and called FUNCT, 
;       unless the FUNCTION_NAME keyword is supplied.  This function, 
;       (actually written as a procedure) must accept values of 
;       X (the independent variable), and A (the fitted function's 
;       parameter values), and return F (the function's value at 
;       X), and PDER (a 2D array of partial derivatives). 
;       For an example, see FUNCT in the IDL User's Libaray. 
;       A call to FUNCT is entered as: 
;       FUNCT, X, A, F, PDER 
; where: 
;       X = Vector of NPOINT independent variables, input. 
;       A = Vector of NTERMS function parameters, input. 
;       F = Vector of NPOINT values of function, y(i) = funct(x(i)), output. 
;       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct. 
;               PDER(I,J) = DErivative of function at ith point with 
;               respect to jth parameter.  Optional output parameter. 
;               PDER should not be calculated if the parameter is not 
;               supplied in call. 
; 
; PROCEDURE: 
;       Copied from "CURFIT", least squares fit to a non‑linear 
;       function, pages 237‑239, Bevington, Data Reduction and Error 
;       Analysis for the Physical Sciences. 
; 
;       "This method is the Gradient‑expansion algorithm which 
;       combines the best features of the gradient search with 
;       the method of linearizing the fitting function." 
; 
;       Iterations are performed until the chi square changes by 
;       only 0.1% or until 20 iterations have been performed. 
; 
;       The initial guess of the parameter values should be 
;       as close to the actual values as possible or the solution 
;       may not converge. 
; 
; MODIFICATION HISTORY: 
;       Written, DMS, RSI, September, 1982. 
;       Does not iterate if the first guess is good.  DMS, Oct, 1990. 
;       Added CALL_PROCEDURE to make the function's name a parameter. 
;               (Nov 1990) 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_MULWHE.PRO

;
; NAME:
;	T_MULWHE
; PURPOSE:
;	This routine attempts to determine which elements in ARRAY
;	are equal to the elements in TEMPLATE.  This would normally
;	be performed with WHERE but this routine specifically addresses
;	the problem of template being a large vector of values.
; CATEGORY:
;	Array manipulation
; CALLING SEQUENCE:
;	OUT = T_MULWHE (ARRAY , TEMPLATE [,COUNT,STATUS] )
; INPUTS:
;	ARRAY = an array of between 1 and 8 dimensions
;	TEMPLATE = a vector of values
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUT = the numbers of the array elements which meet the
;		condition ARRAY = TEMPLATE
; OPTIONAL OUTPUT PARAMETERS:
;	COUNT = the number of elements meeting the constraint
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Slow
; EXAMPLE:
;	print,t_mulwhe([2,3,4,5,6,7,8,9,0,1,2,3],[5,6,7,8],count)
;
;	3  4  5  6
;	print,count
;
;	4
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	28‑05‑1994  NT Prototype.
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_NEAREL.PRO

;
; NAME:
;	T_NEAREL
; PURPOSE:
;	Determines the element of a vector or array closest to the required
;	value.
; CATEGORY:
;	Data manipulation
; CALLING SEQUENCE:
;	T_NEAREL,FX,X,ELEMENT [,ERROR]
; INPUTS:
;	FX = the vector or array
;	X = the value you are hunting for
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	ELEMENT is the element number you are hunting for.
; OPTIONAL OUTPUT PARAMETERS:
;	ERROR = the difference between X and FX at that point.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	29‑1‑1993 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_NUMERC.PRO

;
; NAME:
;	T_NUMERC
; PURPOSE:
;	To test if a string can be converted into a numeric value.
; CATEGORY:
;	Tools
; CALLING SEQUENCE:
;	OUTPUT = T_NUMERC (INPUT, DATATYPE=DATATYPE)
; INPUTS:
;	INPUT = a string
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT takes the value 1 if INPUT can be converted into the
;		numeric type specified by DATATYPE
;	OUTPUT takes the value 0 if INPUT cannot be converted
;	OUTPUT takes the value ‑1 if there is a program failure
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	DATATYPE can take the following values
;			'FIX' : test if integer
;			'LONG' : test if long integer
;			'FLOAT' : test if the INPUT is floating point
;			'SCIENTIFIC': test if the INPUT is in scientific
;					notation (e.g. 1.e‑001 or 1.345E+099) 
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Cant deal with complex or structures.
; PROCEDURE:
;	Use the byte codes of numerics to search for bad characters.
;
; MODIFICATION HISTORY:
;	10‑12‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_NUMMEN.PRO

;
; NAME:
;	T_NUMMEN
; PURPOSE:
;	To take a string array and eliminate all multiple mentions of each
;	string and therefore return a small array.
; CATEGORY:
;	String manipulation
; CALLING SEQUENCE:
;	OUTLIST = T_NUMMEN (INLIST [,SORT=SORT])
; INPUTS:
;	INLIST = a 1‑D string array
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTLIST = a 1‑D string array
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	SORT  if set applies a sort to OUTLIST before returning
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Must be 1‑D.
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	12‑8‑1993  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_NUMSET.PRO

;    
; NAME:    
;      T_NUMSET     
; PURPOSE:    
;      A subroutine which allows you   
;      set or examine interactively a series of numerical parameters.   
; CATEGORY:    
;      Widget data input     
; CALLING SEQUENCE:    
;      T_NUMSET,NUMBERS [,TITLE=TITLE] [,SUB_TITLES=SUB_TITLES] [,STATUS]     
; INPUTS:    
;      NUMBERS = a vector which contains the values to be displayed  
;          or entered. Number of elements must be greater than 1 and  
;          less than 20.  This vector is modified by the procedure  
;          and acts as the output as well as the input.  
; OPTIONAL INPUT PARAMETERS:    
;      none     
; OUTPUTS:    
;      NUMBERS see input     
; OPTIONAL OUTPUT PARAMETERS:    
;      STATUS = standard status report     
; KEYWORDS:    
;      TITLE = a title for the display  
;      SUB_TITLES = a string vector the same length as NUMBERS containing  
;                  descriptions or titles for each vector.   
; COMMON BLOCKS:    
;      Internal     
; SIDE EFFECTS:    
;      Widgets are created     
; RESTRICTIONS:    
;      None     
; EXAMPLE:    
;           
; PROCEDURE:    
;      Just fire up a series of editable text widgets.     
;    
; MODIFICATION HISTORY:    
;      25‑11‑1994 NT  Prototype     
;    
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_PLANCK.PRO

; 
; NAME: 
;       T_PLANCK 
; PURPOSE: 
;       To compute Planck's radiation law and return the flux as a  
;       function of the input wavelength normalized so that the integral 
;       over all wavelengths = 1. 
; CATEGORY: 
;       Maths 
; CALLING SEQUENCE: 
;       REL_FLUX=T_PLANCK(TEMPERATURE,WAVELENGTH) 
; INPUTS: 
;       TEMPERATURE gives the temperature of the emitting body in Kelvin. 
;       WAVELENGTH = a vector or a scalar containing wavelengths [m] for the 
;               calculation and should increase montonically in units of 
;               1.e‑9 for the normalization to be correct. 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       REL_FLUX = the output flux 
; OPTIONAL OUTPUT PARAMETERS: 
;       NONE 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; PROCEDURE: 
;       TRIVIAL 
; MODIFICATION HISTORY: 
;       16‑04‑1994  NT 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_POLAR.PRO

;
; NAME:
;	T_POLAR
; PURPOSE:
;	Polar coordinate transform
; CATEGORY:
;	Image manipulation.
; CALLING SEQUENCE:
;	T_POLAR,P,P1,X,Y,RAD1,RAD2,AZ1,AZ2,COL,LIN
; INPUTS:
;	P = input array
;	X,Y = centre of rotation
;	RAD1,RAD2 = inner and outer radius
;	AZ1,AZ2 = starting and finishing azimuth in degrees.
;	COL = number of samples in radius
;	LIN = number of samples in azimuth
; OPTIONAL INPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; OUTPUTS:
;	P1 = OUTPUT ARRAY
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	10‑JUN‑1987  NT
;	5‑12‑1989  NT  Modified to speed up but uses larger arrays!!
;	14‑6‑1993  NT  Version 3.0 IDL
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_POSIT.PRO

; NAME:
;	T_POSIT
; PURPOSE:
;	To indicate the cursor position on the TV and give the data value of
;	the array.
; CATEGORY:
;	Image analysis.
; CALLING SEQUENCE:
;	T_POSIT            ;Find screen position only.
;	T_POSIT,ARRAY      ;Find screen position and array value.  Array
;	                    ;assumed to start at 0,0.
;	T_POSIT,ARRAY,XOFFSET=XOFFSET,XOFFSET=XOFFSET
;                           ;As above except array start position specified.
; INPUTS:
; OPTIONAL INPUT PARAMETERS:
;	ARRAY               ;Array to be studied. Not necessarily on screen.
; KEYWORDS:
;	XOFFSET,YOFFSET     ;Offsets in x and y of image position on screen.
; OUTPUTS:
;	Terminal display of cursor position and image status.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	Press right mouse button to quit.  Mouse button 1, when clicked
;	in the window, will return the position of the cursor in
;	device coordinates.  If an array has been entered in the procedure
;	call then the value at the point when the mouse is clicked
;	will be returned.
; MODIFICATION HISTORY:
;	NT 16‑DEC‑1986  MPAE, LINDAU.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_PROFIL.PRO

;
; NAME:
;	T_PROFIL
; PURPOSE:
;	An interactive program which asks for 2 positions input by mouse
;	on the current graphics window and plots in another window
;	the resultant profile.
; CATEGORY:
;	Data analysis
; CALLING SEQUENCE:
;	T_PROFIL,IMAGE [,PROFILE [,OFFX,OFFY [,DEV [,ENDS [,NOMARK ,WSIZE,
;	 XPOS, YPOS, COLOR]]]]]
; INPUTS:
;	IMAGE = the 2‑D image to be accessed.
; OPTIONAL INPUT PARAMETERS:
;	OFFX,OFFY = the offset from coordinate position (0,0) of the image
;	on the current graphics device.
;	DEV controls where the output plot is directed.  A number between
;		0 and 7 opens (or erases!) that window number on the
;		current graphics device.  'PS' will send the output to
;		a PostScript file IDL.PS
;		NOTE:  SET_PLOT, 'PS' is NOT made inside this program.  The
;		setting to 'PS' for the device forces the programs to write
;		to the current device.  In this way you can control the plot
;		of the profile (setting viewport, screen size etc.) externally.
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	PROFILE = the actual profile
;	ENDS = 2x2 array giving the x,y coordinates of the end points
; KEYWORDS:
;	NOMARK = if NOMARK is set then a line is not drawn on the image
;		indicating the plot
;	WSIZE = the size of the window for the profiles plot in fractions
;		of 512 x 512 (default = 0.8)
;	XPOS,YPOS = the position of the window
;	DEV controls where the output plot is directed.  A number between
;		0 and 7 opens (or erases!) that window number on the
;		current graphics device.  'PS' will send the output to
;		a PostScript file IDL.PS
;		NOTE:  SET_PLOT, 'PS' is NOT made inside this program.  The
;		setting to 'PS' for the device forces the programs to write
;		to the current device.  In this way you can control the plot
;		of the profile (setting viewport, screen size etc.) externally.
;	COLOR = a color for the line drawn across the image
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	Setting and erasing of graphics windows possible if careless.
;	If no window is open, a window may be opened.
; RESTRICTIONS:
;	If the plotting device is NOT 'X' or 'WIN' then the program bombs out.
; PROCEDURE:
;	Check graphics device.  Call the mouse.  Make sure the selected points
;	are inside the image.  Compute the points on the line.  Interpolate.
;	Plot and return.
; MODIFICATION HISTORY:
;	27‑1‑1993  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_PSSET.PRO

; NAME:
;	T_PSSET
; PURPOSE:
;	To provide a GUI for the IDL PostScript interface.
; CATEGORY:
;	Graphics
; CALLING SEQUENCE:
;	T_PSSET [,STATUS]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The PostScript device is set and manipulated.
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	T_PSSET
; PROCEDURE:
;	Set up a widget allowing manipulation of all
;	PS keywords.
;
; MODIFICATION HISTORY:
;	16‑11‑1994  NT	
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_RESWIN.PRO

;  
; NAME:  
;      T_RESWIN   
; PURPOSE:  
;      To restore the contents of a window with colour table.   
; CATEGORY:  
;      Display   
; CALLING SEQUENCE:  
;      T_RESWIN, FILENAME[,STATUS ,WINDOW=WINDOW]   
; INPUTS:  
;      FILENAME = the name of the file from which the data is to be 
;                  restored.  
; OPTIONAL INPUT PARAMETERS:  
;      NONE   
; OUTPUTS:  
;      To disk.   
; OPTIONAL OUTPUT PARAMETERS:  
;      STATUS = standard status report   
; KEYWORDS:  
;      WINDOW = the number of the window to which
;          the data will be restored (default = current)   
; COMMON BLOCKS:  
;      COLORS = the IDL colors common block   
; SIDE EFFECTS:  
;      The restored window is set to the current window!!!   
; RESTRICTIONS:  
;      NONE   
; EXAMPLE:  
;      T_RESWIN,'C:\TEMP\HOLD.DIS',WINDOW=0   
; PROCEDURE:  
;      Declare the colors common block.
;      Read in the data from the XDR file
;      Load the common blocks
;      Determine the window size and load the data
; MODIFICATION HISTORY:  
;      01‑03‑1994  NT   
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ROTATE.PRO

;
; NAME:
;	T_ROTATE
; PURPOSE:
;	Procedure used to rotate 3‑dim. co‑ordinate systems
;		Ref.:Bronstein‑Semendjajew, 21st Edition, p.216            
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	T_ROTATE, X,Y,Z, ALPHA,BETA,GAMMA, ANGLE ,XBAR,YBAR,ZBAR [,STATUS])
; INPUTS:
;	X,Y,Z = a 3 element vector specifying the x,y,z of the original
;			direction (directional cosines!!!)
;
;	ALPHA,BETA,GAMMA = a 3 element vector specifying the rotation axis
;			to be used  (directional cosines!!)
;
;	ANGLE = the angle of the rotation in degrees
;
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	XBAR,YBAR,ZBAR = the 3 element vector output
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	None
; EXAMPLE:
;	t_rotate,.1,.3,.94868,1.,0.,0.,30.,xbar,ybar,zbar,status
; PROCEDURE:
;	Follow Klaus Wilhelm's original program.
;
; MODIFICATION HISTORY:
;	08‑02‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SAVWIN.PRO

;  
; NAME:  
;      T_SAVWIN   
; PURPOSE:  
;      To save the contents of a window with colour table.   
; CATEGORY:  
;      Display   
; CALLING SEQUENCE:  
;      T_SAVWIN, FILENAME[,STATUS ,WINDOW=WINDOW]   
; INPUTS:  
;      FILENAME = the name of the file in which the data is to be 
;                  stored.  
; OPTIONAL INPUT PARAMETERS:  
;      NONE   
; OUTPUTS:  
;      To disk.   
; OPTIONAL OUTPUT PARAMETERS:  
;      STATUS = standard status report   
; KEYWORDS:  
;      WINDOW = the number of the window to be stored (default = current)   
; COMMON BLOCKS:  
;      COLORS = the IDL colors common block   
; SIDE EFFECTS:  
;      NONE   
; RESTRICTIONS:  
;      NONE   
; EXAMPLE:  
;      T_SAVWIN,'C:\TEMP\HOLD.DIS',WINDOW=0   
; PROCEDURE:  
;      Declare the colors common block.
;      If common block is undefined then load the default colour table.  
;      Determine the window size
;      Read the window
;      Load it into the output array (use XDR).
; MODIFICATION HISTORY:  
;      01‑03‑1994  NT   
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SEPARA.PRO

;
; NAME:
;	T_SEPARA
; PURPOSE:
;	To determine whether the character in input is a VMS, UNIX,
;	or WIN32 separator.
; CATEGORY:
;	Operating system manipulations
; CALLING SEQUENCE:
;	OUTPUT=T_SEPARA(INPUT)
; INPUTS:
;	INPUT =  a one character string containing the character to be
;		tested.  If a multi‑character string is entered then
;		the first character after leading blanks are removed
;		is tested!!!
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = 'VMS' if INPUT is ']' or '.'
;		= 'HP‑UX' if INPUT is '/'
;               = 'WIN32' if INPUT is '\'
;		Otherwise its ‑1
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	PRINT,T_SEPARA(']')
;		'VMS'
; PROCEDURE:
;	Trivial	
;
; MODIFICATION HISTORY:
;	30‑01‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SIGMA.PRO

; NAME:
;	T_SIGMA
; PURPOSE:
;	To calculate mean, standard deviation and variance of an array.
; CATEGORY:
;	Simple statistics.
; CALLING SEQUENCE:
;	T_SIGMA,P,N,MEAN,STAN,VARI
; INPUTS:
;	P = array on which calculation is performed.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
; OPTIONAL OUTPUT PARAMETERS:
;	N = no. of elements in array.
;	MEAN = mean of elements.
;	STAN = standard deviation from sample variance.
;	VARI = variance.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	NT 17‑DEC‑1986  MPAE, LINDAU.
;	NT 28‑10‑1993 Go to V3.1 IDL.
;	NT 23‑11‑1994 Fixed for double precission errors in Total command.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SIMPSO.PRO

;
; NAME:
;	T_SIMPSO
; PURPOSE:
;	To calculate the integral of a curve using Simpson's rule.
; CATEGORY:
;	Maths
; CALLING SEQUENCE:
;	T_SIMPSO,X,Y,OUT
; INPUTS:
;	X,Y = the x values and the y values for the integration.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUT= the result
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	NONE
; MODIFICATION HISTORY:
;	1‑6‑1987 NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\T_SINCEV.PRO

;
; NAME:
;   T_SinceV (former: SINCE_VERSION from GSFC‑Library)
; PURPOSE:
;   Determine if the current Release of IDL (as given in the !VERSION.RELEASE
;   SystemVariable) comes after the user specified Release.   
; CALLING SEQUENCE:
;   Test = T_SinceV(Release[,Status])
; INPUT:
;   Release ‑ ScalarString, must be formatted exactly like the 
;             !VERSION.RELEASE SystemVariable (e.g. '2.2.1'). 
; OUTPUT:
;   Test ‑ 1 if current Release is identical or later than "Release"
; EXAMPLE:
;   Use the /FTOXDR Keyword to the BYTEORDER Procedure if the current 
;   Release of IDL is 2.2.2 or later
;
;      DISR> IF T_SinceV('2.2.2') THEN BYTEORDER,A,/FTOXDR
; REVISION HISTORY:
;   Written   Wayne Landsman         Hughes/STX        January, 1992
;   Corrected algorithm     W. Landsman                April, 1992
;   DISR_adapted            J. A. St\"uwe     MPAE     May, 1994
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SLIDER.PRO

;  
; NAME:  
;       T_SLIDER  
; PURPOSE:  
;       A widget slider for data entry.  
; CATEGORY:  
;       Widgets  
; CALLING SEQUENCE:  
;       VALUE_OUT=T_DIALOG(TITLE=TITLE,MINIMUM,MAXIMUM, [ /MODAL 
;                ,FORMAT=FORMAT ,STATUS])  
; INPUTS:  
;       MINIMUM = the minimum value for the slider 
;       MAXIMUM = the maximum value for the slider  
; OPTIONAL INPUT PARAMETERS:  
;       NONE  
; OUTPUTS:  
;       VALUE_OUT = the output from the slider  
; OPTIONAL OUTPUT PARAMETERS:  
;       STATUS = standard status report  
; KEYWORDS:  
;       TITLE = the title of the dialogue box 
;       FORMAT = if set makes it a floating point widget with the
;                  given format 
;       MODAL = if set prevents other widgets being pressed until this one  
;               disappears.  
; COMMON BLOCKS:  
;       NONE  
; SIDE EFFECTS:  
;       NONE  
; RESTRICTIONS:  
;       NONE  
; EXAMPLE:  
;         
; PROCEDURE:  
;       Trivial.  Set up an editable text widget.  
;  
; MODIFICATION HISTORY:  
;       17‑08‑1994  NT  
;        
;  
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SLWBOX.PRO

;
; NAME:
;	T_SLWBOX
; PURPOSE:
;	This is a high level routine which can be incorporated into
;	widgets.  It produces a rubber‑box cursor on the current window
;	and returns the coordinates in the original image of the
;	box which has been interactively defined.
; CATEGORY:
;	Tools
; CALLING SEQUENCE:
;	T_SLWBOX,P,TEXT1,TEXT2,TEXT3,TEXT4,BOXER [,HIST] [,STATUS]
; INPUTS:
;	P = the image array.
;	TEXT1, TEXT2, TEXT3, and TEXT4 are the ids of text widgets
;	which will be used to monitor the mouse position and give
;       statistics on the image.
;
;	TEXT1 and 2 give the mouse coordinates, TEXT3 gives the output
;	statistics, TEXT4 gives error messages and instructions.
;	The calling routine should have a separate text widget for
;	each of these entries. The widget should be non‑editable and
;	have YSIZE=1.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	BOXER = the lower left and upper right corners of the box
;		 [x1,y1,x2,y2] defined interactively.
;	Note that this variable will be ill‑defined if you exit before the
;	box has been defined.
;
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	HIST if set plots a histogram of the resultant box.
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	This routine must be called by a widget event manager. The correct
;	window MUST be set before entering this program.
; EXAMPLE:
;	
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	22‑11‑1994  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\T_STRNUM.PRO

;
; NAME:
;   STRNUMBER
; PURPOSE:
;   Function to determine if a String is a valid numeric Value.
; CALLING SEQUENCE:
;	Value = T_StrNum(Str [,Status])
; INPUTS:
;	Str ‑ String
; OUTPUTS:
;	Value ‑ if the String Str has a valid numerical Value, otherwise ‑1
; WARNING:
;    (1)   Note that a blank String (e.g. " ") is not a Valid numeric Value, 
;          although an empty String ("") is (=0.0).
;    (2)   In V2.2.2 there was a bug in the IDL ON_IOERROR procedure that
;          will cause the following statement to hang up IDL
;
;            IDL> PRINT,'' + String( T_StrNum('xxx') )
;          This bug was fixed in V2.3.0
;     (3)  As of V2.3.2, an IDL bug is seen in the following Statements 
;            IDL> Str = 'E'
;            IDL> q = T_StrNum(Str)  &  PRINT,Str
;         The Variable 'Str' gets modified to an empty String. This Problem
;         is related to the ambiguity of whether 'E' is a number or not 
;         (could be = 0.0E). A Fix is expected in a new IDL version.
; HISTORY:
;	Version 1.0 by D. Lindler Aug. 1987
;	Version 2.0 by J. A. St\"uwe @ MPAE, May 1994, DISR‑adapted
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_STRREV.PRO

;
; NAME:
;	T_STRREV
; PURPOSE:
;	To reverse the order of a string.
; CATEGORY:
;	String manipulation ‑‑‑‑ Tools
; CALLING SEQUENCE:
;	OUTPUT=T_STRREV(INPUT)
; INPUTS:
;	INPUT =  a string of any length
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the reverse of the string
;	If INPUT is a string array then each element of the array
;			is reversed.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	19‑11‑1992  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_STRRPL.PRO

;
; NAME:
;	T_STRRPL
; PURPOSE:
;	To search a string for a character combination and replace in
;	with a character combination.
; CATEGORY:
;	String manipulation.
; CALLING SEQUENCE:
;	OUTPUT = T_STRRPL(INPUT, SEARCH_FOR, REPLACE_WITH)
; INPUTS:
;	INPUT = the input string to be corrected
;	SEARCH_FOR = the string combination to be replaced
;	REPLACE_WITH = the string combination with which SEARCH_FOR
;			is replaced
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = the corrected string
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	If INPUT does not contained the search string then OUTPUT is
;	set to INPUT.
; RESTRICTIONS:
;	As in a standard word processor, the program searches for the first
;	occurance of a string and replaces it before searching for the
;	next occurance.  Therefore if you replace the string 'mm' with the
;	string 'bb' in a string with the combination 'mmm' then the result
;	will be 'bbm' ‑‑ the last 'm' will not be replaced. 
; EXAMPLE:
;	IDL> PRINT,T_STRRPL('Nick likes wombats','wombats','women')
;	
;	Nick likes women
;
;
;	NOTE!!!!  This routine is case sensitive!!!!!!!
;
;
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	21‑02‑1994 NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SUBMAX.PRO

; NAME:    
;       T_SUBMAX    
; PURPOSE:    
;       Determine polynomial fit to a surface: uses POLYWARP to determine    
;       coefficients of the polynomial, then evaluates the polynomial to    
;       yield the fit surface and interpolates to find the maximum    
; CATEGORY:    
;       E2 ‑ Curve and surface fitting    
; CALLING SEQUENCE:    
;       T_SUBMAX,SURFACE,DEGREE,X,Y [,FIT_SURFACE,STATUS]    
; INPUTS:    
;       surface = two‑dimensional array of data to be fit to.  Sizes of    
;                      each dimension may be unequal.    
;       degree       = maximum degree of fit (in one dimension).    
; OPTIONAL INPUT PARAMETERS:    
;       none.    
; OUTPUTS:    
;       x,y = position of maximum within surface    
; OPTIONAL OUTPUT PARAMETERS:    
;       fit_surface  = two‑dimensional array of values from the evaluation of    
;                      the polynomial fit.    
;       status = standard status report    
; COMMON BLOCKS:    
;       none.    
; SIDE EFFECTS:    
;       none.    
; RESTRICTIONS:    
;       The number of data points in data_surface must be greater or equal to    
;       (degree+1) squared.    
; PROCEDURE:    
;       Generate coordinate arrays for POLYWARP using the indices as    
;       coordinates.  The yi and ky arrays for POLYWARP are, in this usage,    
;       redundant, so they are sent as dummies.  The coefficients returned    
;       from POLYWARP are then used in evaluating the polynomial fit to give    
;       the surface fit.    
; MODIFICATION HISTORY:    
;       Written by: Leonard Sitongia, LASP University of Colorado,    
;               April, 1984.    
;       Modified by Mike Jone, LASP, Sept. 1985.    
;       11‑04‑1994 add on by nt to get maximum and include status report    
;    
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SUBSFT.PRO

; 
; NAME: 
;       T_SUBSFT 
; PURPOSE: 
;       To sub‑pixel shift an image by the given deltas. 
; CATEGORY: 
;       Image manipulation. 
; CALLING SEQUENCE: 
;       T_SUBSFT,IMAGE_IN,IMAGE_OUT,DX,DY [,STATUS,MISSING=MISSING] 
; INPUTS: 
;       IMAGE_IN = a two‑dimensional image 
;       DX,DY = the sub‑pixel shift required in pixel units 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       IMAGE_OUT = the output pixels 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; KEYWORDS: 
;       MISSING = the value to which missing pixels are set (default =0) 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; EXAMPLE: 
;        
; PROCEDURE: 
;       Trivial.  Use INTERPOLATE function. 
; 
; MODIFICATION HISTORY: 
;       19‑07‑1994 NT 
;       28‑11‑1994 NT  Modified to mask out missing pixels from shift
;                      Sub‑shift shifts the array in the same sense as
;                      the SHIFT function in IDL.
; 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_SYMBOL.PRO

;
; NAME:
;	T_SYMBOL
; PURPOSE:
;	To offer a choice of user‑defined symbols which can be used
;	with !psym=8
; CATEGORY:
;	Plots
; CALLING SEQUENCE:
;	T_SYMBOL [,STATUS] [,SYMBOL=SYMBOL] [,SIZE=SIZE] [,/FILL]
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS =standard status report
; KEYWORDS:
;	SYMBOL = a string with the following options
;		'TRIANGLE'
;		'CIRCLE'
;		'SQUARE'
;		'STAR'
;		'DIAMOND'
;	SIZE = a size parameter (default = 1)
;	FILL = when set, fills the symbol
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	The user‑defined symbol is set and can be accessed by
;	seeting PSYM = 8.
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	T_SYMBOL,SYMBOL='DIAMOND',SIZE=2.,/FILL
; PROCEDURE:
;	Branch with a case statement and use USERSYM routine
;	to set the symbol.
;
; MODIFICATION HISTORY:
;	18‑10‑1994 NT	
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_TIMMJD.PRO

;
; NAME:
;	T_TIMMJD
; PURPOSE:
;	Converts the output from the IDL systime procedure to a modified
;	Julian date.
; CATEGORY:
;	Tools for time calculations
; CALLING SEQUENCE:
;	RESULT = T_TIMMJD (TIME_STRING)
; INPUTS:
;	TIME_STRING = the output from the IDL systime procedure.  The routine
;			will also work for the HP "date" format but will
;			not take into account the time zone!!
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	RESULT = the modified Julian date corresponding to the input time
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The input time is assumed to be UT.  No attempt to convert for the
;	time zone is made.
; PROCEDURE:
;	Trivial
;
; MODIFICATION HISTORY:
;	23‑11‑1993  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_TRACER.PRO

; NAME:
;	T_TRACER
; PURPOSE:
; 	Procedure to trace a graph from the scanner.
; CATEGORY:
;	
; CALLING SEQUENCE:
;	T_TRACER,IMAGE,X,Y [,N,STATUS]
; INPUTS:
;	IMAGE = the input image to be investigated
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	X,Y = vectors containing the x and y values of the digitized graph.
; OPTIONAL OUTPUT PARAMETERS:
;	N = the number of elements in the vectors
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	The program requires you to be quite careful in the
;	way you enter your data.  You should begin by
;	setting the type of graph by clicking on one of the
;	exclusive buttons (LIN‑LIN, LIN‑LOG etc.).  You should
;	then set the origin and the ends of the x and y axis.
;	YOU SHOULD THEN CLICK ON "CLEAR ALL"!!!
;	Then trace the line you want using the draw widget.  You can
;	delete the last point with the CLEAR LAST button.
;	You can clear all points or just the last one using
;	the buttons. If you do not use this order, you risk putting
;	erroneous data points at the front of your output.
; PROCEDURE:
;	Tricky with the widgets.  Program based on TRACER routine from
;	1987 so of course I've forgotten how it works!  I get points off
;	the graph using the draw widget.  Then depending upon which
;	switch is set, I convert the data into the new coordinate
;	system.  Note that I calculate if the scanned graph is rotated.
;	I seem to remember this section of the code being based
;	Bronstein and Semenjajew.  The widget just gets the data points.
;	The conversion is performed after the widget has been destroyed.
;	Using the DONE button performs the calculation.  CANCEL stops
;	everything and no calculations are performed.
; MODIFICATION HISTORY:
;	07‑08‑1994 NT 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_TREE.PRO

;
; NAME:
;	T_TREE
; PURPOSE:
;	To determine the tree of directories 
; CATEGORY:
;	File manipulation.
; CALLING SEQUENCE:
;	OUTPUT = T_TREE ([FILTER=FILTER, DIRECTORY=DIRECTORY, FILES
;				,STATUS])
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	OUTPUT = a string array containing the full directory specification
;		of all directories below the current directory
; OPTIONAL OUTPUT PARAMETERS:
;	FILES = a string array containing the full directory specification
;		of all files in the directories below the current
;		according to the file filter specified in the keyword
;		FILTER
;	STATUS = standard status report
; KEYWORDS:
;	FILTER = the file filter for the file list determination
;			Default = '*.*'
;	DIRECTORY = the top level directory to be studied (default = current)
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	05‑11‑1993  nt
;	29‑01‑1993  nt  Inclusion of directory keyword.
;	06‑03‑1994  nt  Bug fix.  Note that in a FOR DO loop
;			the final index cannot be modified
;			inside the loop!  You cannot therefore
;			extend the number of times that you go through
;			the loop.  For some reason IDL
;			cant recognize this.  You must therefore
;			use a WHILE DO loop!
;			STATUS report also included.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_TVSURR.PRO

; 
; NAME: 
;       T_TVSURR 
; PURPOSE: 
;       To produce a thin surround on the image display automatically. 
; CATEGORY: 
;       Display 
; CALLING SEQUENCE: 
;       T_TVSURR [,COLOUR=COLOUR,STATUS] 
; INPUTS: 
;       NONE 
; OPTIONAL INPUT PARAMETERS: 
;       NONE 
; OUTPUTS: 
;       To screen 
; OPTIONAL OUTPUT PARAMETERS: 
;       STATUS = standard status report 
; KEYWORDS: 
;       COLOUR = the colour value defaulting to 255 
; COMMON BLOCKS: 
;       NONE 
; SIDE EFFECTS: 
;       NONE 
; RESTRICTIONS: 
;       NONE 
; PROCEDURE: 
;       TRIVIAL 
; MODIFICATION HISTORY: 
;       11‑04‑1994 NT 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_UNIVEC.PRO

;
; NAME:
;	T_UNIVEC
; PURPOSE:
;	To convert a unit vector into azimuth and declination info and
;	vice versa.
; CATEGORY:
;	MATHS
; CALLING SEQUENCE:
;	T_UNIVEC,X1,Y1,Z1,AZIMUTH,DECLIN[,/TO_VECT,/T_AZIDEC,STATUS]
; INPUTS:
;	X1,Y1,Z1  or AZIMUTH,DECLIN  the former comprise components of the
;		unit vector, the latter comprise the azimuth angle from z=0
;		and the declination angle from the x‑z plane (both in degrees.)
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	X1,Y1,Z1  or AZIMUTH,DECLIN
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	TO_VECT = if set tells the program to convert the given azimuth
;		and declinations to unit vectors
;	TO_AZIDEC = if set tells the program to convert the given unit
;		vectors to azimuth and declination
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Note there is no check on the input so that you can input vectors,
;	scalars, arrays in almost any format and still get a result.
;	Alternatively, you can crash the program or produce erroneous
;	results if your input is not properly set up.
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	7‑SEP‑1987  NT
;	11‑SEP‑1994 NT  To version 3.1 IDL
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\T_UNIX_V.PRO

;
; NAME:
;    T_UNIX_V
; PURPOSE:
;    To convert UNIX‑IDL‑DataTypes to VAX‑IDL‑DataTypes. Currently
;    assumes that the UNIX‑IDL‑DataType is IEEE‑Standard.
; CALLING SEQUENCE:
;    T_UNIX_V, Variable [, Status]
; PARAMETERS:
;    Variable ‑ The DataVariable to be converted. This may be a Scalar
;	 or an Array. Valid DataTypes are Integer, LongWord,
;	 FloatingPoint, and DoublePrecision. The Result of the 
;        Conversion is passed back in the original Variable.
; RESTRICTIONS:
;	Only tested for Data from IEEE‑Standard UNIX‑Machines (e.g. SUN0)
; EXAMPLE:
;	Read a 100 by 100 Matrix of FloatingPointNumbers from a DataFile
;	created on a Sun.  Then convert the MatrixValues into VAX‑Format.
;
;	DISR> OPENR,1,'VAX_FLOAT.DAT'
;	DISR> Data = FLTARR(100,100)
;	DISR> READU,1,Data
;	DISR> T_UNIX_V,Data
;
; MODIFICATION HISTORY:
;	13‑Jun‑88 ‑ John Hoegy
;	04‑May‑90 ‑ WTT:  Created CONV_UNIX_VAX from VAX2SUN,
;			  reversing FloatingPointProcedure.
;       30‑May‑94 ‑ J. A. St\"uwe @ MPAE, DISR‑adapted
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_VALDIR.PRO

;
; NAME:
;	t_valdir
; PURPOSE:
;	To determine whether a directory exists or not.
; CATEGORY:
;	File manipulation
; CALLING SEQUENCE:
;	OUT = t_valdir (dir [,status])
; INPUTS:
;	dir = a string containing the directory specification
; OPTIONAL INPUT PARAMETERS:
;	None
; OUTPUTS:
;	OUT = 0 if not exists or  1 if exists
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	None
; COMMON BLOCKS:
;	None
; SIDE EFFECTS:
;	None
; RESTRICTIONS:
;	None
; PROCEDURE:
;	Adapted from PICKFILE routine from IDL widget library. 
;
; MODIFICATION HISTORY:
;	05‑11‑1993  NT Extracted as special tool from D_SEARCH
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_WEXTRA.PRO

;
; NAME:
;	T_WEXTRA
; PURPOSE:
;	To use a widget to extract a subarray from an image with a box cursor.
; CATEGORY:
;	Image manipulation
; CALLING SEQUENCE:
;	T_WEXTRA,IMAGE_IN,IMAGE_OUT [,STATUS]
; INPUTS:
;	IMAGE_IN = input image
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	IMAGE_OUT = the output 2‑d array
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; EXAMPLE:
;	
; PROCEDURE:
;	TRIVIAL.  Copied algorithm from T_IMAGE
;
; MODIFICATION HISTORY:
;	20‑07‑1994 NT
;	23‑11‑1994 NT Replaced original box cursor routine with
;			T_SLWBOX
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_WIDGET.PRO

;
; NAME:
;	t_widget
; PURPOSE:
;	To test whether widgets are available.
; CATEGORY:
;	System
; CALLING SEQUENCE:
;	TEST=t_widget( [STATUS])
; INPUTS:
;	NONE
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	TEST = 1 if widgets are available,  0 if not
; OPTIONAL OUTPUT PARAMETERS:
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL  p1.22 IDL appendix
;
; MODIFICATION HISTORY:
;	10‑11‑93  NT
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_WPROFI.PRO

;
; NAME:
;	T_WPROFI
; PURPOSE:
;	A widget driven profile drawer.
; CATEGORY:
;	Image analysis
; CALLING SEQUENCE:
;	T_WPROFI,IMAGE
; INPUTS:
;	IMAGE = any two‑dimensional array
;
;
;
;		To run the program, click anywhere on the image and a line
;		will appear joining the last position and the current
;		mouse position.  The plot window will be filled with the
;		plot along that line.  The initial cursor position is 0,0.
;
;		REDRAW redisplays the image with all lines erased.
;		REPLOT redisplays the image with only the current plot line
;			and re‑plots (useful if you modify the titles).
;		SHOW ENDS places the end points on the plotted display
;		The sliders re‑scale the image
;		GO TO POSTSCRIPT asks for a file and plots the current image
;		Titles for the x and y axes and the heading can be entered
;		into the editable text widgets on the right.
;
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	Plots controlled by widgets
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	Profiles will not be plotted or replotted if the number of elements
;	in the profile is less than or equal to one. (i.e. you click on the
;	same place twice).
; PROCEDURE:
;	TRIVIAL
;
; MODIFICATION HISTORY:
;	13‑10‑1993  NT Prototype
;	07‑01‑1994  NT Correction for change in widget_text tag_names.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\OUTPUT\T_W_NAN.PRO

;
; NAME:
;	T_W_NaN (former WhereNaN from GSFC‑Library)
; PURPOSE:
;	Find the Positions of all Values within an Array that correspond to the
;	IEEE NaN (not‑a‑number) SpecialValues.
;
; CALLING SEQUENCE:
;	Result = T_W_NaN(Array [, Count, Status] )
;
; INPUT PARAMETERS:
;	Array  = Array to test against the IEEE NaN SpecialValues. Must be
;                of either FloatingPoint‑, DoublePrecision‑, or ComplexType.
;
; OUTPUTS:
;	The Result of the Function is the Indices of all Values of "Array"
;	corresponding to the IEEE NaN Specification, similar to the IDL‑WHERE
;	Function.
;
; OPTIONAL OUTPUT PARAMETERS:
;	Count	= Number of Values found corresponding to IEEE NaN.
;
; SIDE EFFECTS:
;	If no NaN values are found, or if "Array" is not of Type Float,
;	DoublePrecision, or Complex, then ‑1 is returned,
;       and "Count" is set to 0.
;
; RESTRICTIONS:
;	"Array" must be of Type Float, DoublePrecision, or Complex.
;
; PROCEDURE:
;	The BitPatterns of the Numbers being tested are compared against the
;	IEEE NaN Standard.
;
; MODIFICATION HISTORY:
;       William Thompson, Feb. 1992.
;       William Thompson, Oct. 1992, fixed bug regarding order of bytes on VAX
;                                    machines.
;       Joachim A. St\"uwe @ MPAE, May 1994, DISR‑adapted
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\TOOLS\T_ZOOM.PRO

;
; NAME:
;	T_ZOOM
; PURPOSE:
;	To put a callable surface around the compound widget
;	CW_ZOOM to allow easy zoom calls.
; CATEGORY:
;	Messing around
; CALLING SEQUENCE:
;	T_ZOOM,PIXELS_IN [,PIXELS_OUT] [,STATUS]
; INPUTS:
;	PIXELS_IN = the input pixels
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	NONE
; OPTIONAL OUTPUT PARAMETERS:
;	PIXELS_OUT optionally returns the contents of the zoomed
;		image if commanded from the widget. If the zoomed
;		image is never reported then PIXELS_OUT will be ‑1
;	STATUS = standard status report
; KEYWORDS:
;	NONE
; COMMON BLOCKS:
;	Internal
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	This routine only works with BYTSCL data because of restrictions
;       using CW_ZOOM.  The input can be of any type. It is converted
;	to bytes before display.  The output (PIXELS_OUT) however
;	has the same datatype as the input!  Watch for this.
;
;	CW_ZOOM has some problems with very small images.  In wrapping
;	this surface around it, I have tried to compensate for this
;	by putting automatic scaling controls on several parameters
;	to ensure the widget will run.  Nonetheless try do to use it
;	on postage stamps! 
;
; EXAMPLE:
;	
; PROCEDURE:
;	
;
; MODIFICATION HISTORY:
;	27‑11‑1994 NT Prototype
;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

 
++++++++++++++++ D I S R S O F T     R O U T I N E   ++++++++++++++++++

                C:\CAL_SOFT\DISRTEST\XY\XY_BILIN.PRO

; NAME:
;	XY_BILIN
; PURPOSE:
;	Bilinear interpolation routine for arrays.
; CATEGORY:
;	Image analysis.
; CALLING SEQUENCE:
;	XY_BILIN,P,X1,Y1,VAL
; INPUTS:
;	P = array.
;	X1,Y1 = required point.
; OPTIONAL INPUT PARAMETERS:
;	NONE
; OUTPUTS:
;	VAL = value at point.
; OPTIONAL OUTPUT PARAMETERS:
;	NONE
; COMMON BLOCKS:
;	NONE
; SIDE EFFECTS:
;	NONE
; RESTRICTIONS:
;	NONE
; PROCEDURE:
;	TRIVIAL
; MODIFICATION HISTORY:
;	3‑3‑87 NT
;	10‑6‑1987  REVISED TO SET MISSING PIXELS TO ‑32768  NT
;	28‑1‑88  NT REVISED
;	11‑3‑88 revised because of possible errors caused by large array
;		manipulation.  NT
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++