This page is a listing of the entire contents of this library for IDL. This listing is the long version. Viewing the much more compact listing may be handier.
NAME:
ABSCAL
PURPOSE:
Provide an absolute calibration using the BZERO and BSCALE keywords
in an FITS header
CALLING SEQUENCE:
RESULT = ABSCAL(VALUE,HEADER)
INPUTS:
VALUE - Any scalar, vector, or array (usually an integer type giving a
relative intensity).
HEADER - A FITS header array containing the absolute calibration
keyword BSCALE, and optionally BZERO and BUNIT.
OUTPUT:
RESULT = BSCALE*VALUE + BZERO, where the BSCALE and BZERO scalars
are taken from the FITS header.
If the absolute calibration keywords do not exist, then
RESULT = VALUE, and !ERR = -1.
SYSTEM VARIALBES:
If the system variable !DEBUG is set, then ABSCAL will print the
calibration units given by the BUNIT keyword.
REVISION HISTORY:
Written W. Landsman, STX Corporation January 1987
(See /host/bluemoon/usr2/idllib/ghrs/pro/abscal.pro)
NAME:
AD2XY
PURPOSE:
Compute an X and Y position given the RA and DEC and the astrometry
parameters CD, CRPIX, and CRVAL. A tangent (gnomonic) projection is
assumed. AD2XY is meant to be used internal to other procedures.
For interactive purposes, use ADXY.
CALLING SEQUENCE:
AD2XY,A,D,CD,CRPIX,CRVAL,X,Y
INPUTS:
A - R.A. in RADIANS, scalar or vector
D - Dec. in RADIANS, scalar or vector
CD - 2 x 2 array containing the CD parameters CD11 CD12
in RADIANS. CD21 CD22
CRPIX - 2 element vector containing X and Y coordinates
of reference pixel
CRVAL - 2 element vector containing R.A. and DEC
of reference pixel in radians
OUTPUTS:
X - row position in pixels, scalar or vector
Y - column position in pixels, scalar or vector
RESTRICTIONS:
Note that all angles must be in radians, including CD and CRVAL
Also note that the CRPIX vector should be in FORTRAN convention
(starts at (1,1)), while X and Y are given in IDL convention
(starting at (0,0)).
No parameter checking is performed
REVISION HISTORY:
Written by R.H. Cornett, SASC Tech, 4/7/86
Converted to IDL by B. Boothman, SASC Tech, 4/21/86
(See /host/bluemoon/usr2/idllib/ghrs/pro/ad2xy.pro)
*NAME: ADDPM
*PURPOSE: Correctly adds proper motions to input positions.
*CALLING SEQUENCE:
ADDPM,ra,dec,pm_ra,pm_dec,v_r,parallax,delta_t,OUTRA,OUTDEC
*PARAMETERS:
INPUT:
ra - (REQ) - (0) - (R,D) - RA in decimel degrees.
dec - (REQ) - (0) - (R,D) - Dec in decimel degrees.
pm_ra - (REQ) - (0) - (R,D) - RA proper motion in arcsec/century.
pm_dec - (REQ) - (0) - (R,D) - DEC proper motion in arcsec/century.
v_r - (REQ) - (0) - (R,D) - Radial velocity in
parallax- (REQ) - (0) - (R,D) - Parallax angle in
delta_t - (REQ) - (0) - (R,D) - Time span in years.
OUTPUT:
OUTRA - (REQ) - (0) - (R,D) - Corrected RA in decimel degrees.
OUTDEC - (REQ) - (0) - (R,D) - Corrected DEC in decimel degrees.
*EXAMPLES:
For Epsilon Ind given in Taff:
ADDPM,329.887726,-56.992683,3.93999,-2.5554,-40.4,0.285,50.0,ra,dec
*RESTRICTIONS:
RA and DEC are assumed to be in Degrees.
PM_RA and PM_DEC are assumed to be in
V-R assumed to be in
PARALLAX assumed to be in
DELTA_T assumed to be in decimel years.
*NOTES:
This procedure is used with TA_POS.PRO but can be used independantly.
*PROCEDURE:
Taken from Taff, "Computational Spherical Astronomy". Uses third
order polynomial solution (eq. 3.34, page 39).
*MODIFICATION HISTORY:
Ver 1.0 - 12/xx/90 - A. Warnock - ST Systems Corp.
Ver 2.0 - 02/04/91 - J. Blackwell - GSFC - Modified to conform with
GHRS DAF standards.
Mar 27 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/addpm.pro)
NAME:
ADSTRING
PURPOSE:
Return RA and Dec as character string in sexigesimal format.
RA and Dec may be entered as either a 2 element vector or as
2 scalars. You may also specify the precision of the declination
in digits after the decimal point.
CALLING SEQUENCE
RESULT = ADSTRING(DEC) ;Convert scalar to sexigesimal string
RESULT = ADSTRING(RA_DEC,[PRECESION])
RESULT = ADSTRING(RA,DEC,[PRECISION])
INPUTS:
RA_DEC - 2 element vector giving the right ascension and declination
in decimal degrees.
RA - Right ascension in decimal degrees
DEC - Declination in decimal degrees
PRECISION - The number of digits after the decimal of DEClination.
The RA is automatically 1 digit more. This parameter may
either be the third parameter after RA,DEC or the second
parameter after [RA,DEC]. It is not available for just
DEC. If no PRECISION parameter is passed, a precision
of 1 for both RA and DEC is returned to maintain
compatibility with past ADSTRING functions. A precision
of 0 will result in the below format, always claimed, but
but never delivered by ADSTRING.
OUTPUT:
RESULT - Character string containing HR,MIN,SEC,DEC,MIN,SEC formatted
as (2I3,F5.1,2I3,I4). If only a single scalar is supplied
it is converted to a sexigesimal string (2I3,F5.1).
PROCEDURES CALLED:
RADEC,ZPARCHECK,SIXTY
EXAMPLE:
Display CRVAL coordinates in a FITS header, H
EXTAST,H,CD,CRPIX,CRVAL ;Extract 2 element CRVAL vector (degrees)
PRINT,ADSTRING(CRVAL) ;Print CRVAL vector in sexigesimal format
REVISION HISTORY:
Written W. Landsman June 1988
Addition of variable precision and DEC
seconds precision fix. Only operates
if third parameter is present to
preserve compatibility w/ previous ver. Aug. 1990 [E. Deutsch]
Improved round-off procedure Aug. 1990 [W. Landsman]
(See /host/bluemoon/usr2/idllib/ghrs/pro/adstring.pro)
NAME:
ADXY
PURPOSE:
Use an image header to compute X and Y positions, given the
RA and Dec in decimal degrees. A tangent (gnomonic) projection
is assumed
CALLING SEQUENCE:
ADXY,HDR ;Prompt for Ra and DEC
ADXY,HDR,A,D,X,Y
INPUTS:
HDR - Image header containing astrometry parameters
OPTIONAL INPUTS:
A - Right ascension in decimal DEGREES, scalar or vector
D - Declination in decimal DEGREES, scalar or vector
If A and D are not supplied, user will be prompted to supply
them in either decimal degrees or HR,MIN,SEC,DEG,MN,SC format.
OPTIONAL OUTPUT:
X - row position in pixels, same number of elements as A and D
Y - column position in pixels
OPERATIONAL NOTES:
If less than 5 parameters are supplied, or if !DEBUG=1, then
then the X and Y positions are displayed at the terminal.
If the procedure is to be used repeatedly with the same header,
then it would be faster to use AD2XY.
REVISION HISTORY:
W. Landsman STX January,1988
(See /host/bluemoon/usr2/idllib/ghrs/pro/adxy.pro)
NAME:
AIPSDIR
PURPOSE:
Print a listing of AIPS image files on a VAX directory
CALLING SEQUENCE:
aipsdir,[usernum,dir]
OPTIONAL INPUTS:
usernum - an AIPS user number, integer scalar. AIPDIR will
only display images belonging to this user. If not
supplied or set = -1, then AIPSDIR displays all images
on the directory.
dir - string giving name of the directory containing the AIPS
catalog. If not supplied, then the default AIPS directory
(currently CHAMP$USER5:[AIPS.DATA]) is used
NOTES:
Finding the VAX directory that contains your AIPS images appears to
be as much of an art as a science. Users on non-LASP systems will have
to modify line 1 of this program giving the default AIPS directory.
SIDE EFFECTS:
AIPSDIR display the user number, slot number, date image was catalogued,
image name, and VAX directory name.
METHOD:
The catalog directory ('CA') files are opened, and interpreted as per
GOING AIPS (15-APR-1987), p. 5-3
REVISION HISTORY:
Written W. Landsman March, 1986
(See /host/bluemoon/usr2/idllib/ghrs/pro/aipsdir.pro)
NAME
AIPSNAME
PURPOSE:
Returns the VAX filename of a specified AIPS sequence number, for
a given user number. Needed because AIPS tries to hide the VAX
file name, which is what the IDL procedure AIPSRD needs to read an image.
CALLING SEQUENCE:
filename = aipsname(userno,[seqno,directory])
INPUTS:
userno - AIPS user number, integer scalar
seqno - sequence or slot number of image in the user's catalog.
If not supplied, AIPSNAME will display all images in the
users catalog, and prompt for a choice.
directory - string giving disk and directory name to search for the
image. If not supplied, AIPSNAME uses the default
AIPS directory (currently CHAMP$USER5:[AIPS.DATA])
OUTPUT:
STRING giving full VAX file name of the catalog header ('CB' file)
of the desired image.
EXAMPLE:
User number 11 wants the VAX filename of the image with a slot
number of 1 in his catalog.
FILENAME= AIPSNAME(11,1)
NOTES:
AIPSNAME currently assumes an AIPS format version of 'B', i.e.
for images written in the 15-JAN-1987 AIPS version. Users
may need to change the first line of this program for other
AIPS data formats. The default AIPS directory also needs to be
changed on other systems.
AIPSNAME does not check that the filename really exists; it merely
creates a VAX filename from a user number and slot number, as per
GOING AIPS (15-APR-1987), p. 5-3.
REVISION HISTORY:
Written W. Landsman March 6, 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/aipsname.pro)
NAME
AIPSRD
PURPOSE:
Read an AIP disk image (MAP) file into an IDL image and header arrays
Use AIPSDIR or AIPSNAME to determine the VAX filename of the desired
AIPS image.
CALLLING SEQUENCE:
AIPSRD,IM,HDR,[FILENAME]
OPTIONAL INPUT:
FILENAME - String giving the complete VAX file name (including extension)
of the AIPS image header file. The first two characters
of the file name should be 'CB' and the last two should be
'01'. If a directory is not supplied then AIPSRD uses a
default directory (currently 'CHAMP$USER5:[AIPS.DATA]').
OUTPUTS:
IM - image array with size and dimensions as specified in the AIPS
catalog header
HDR - FITS type header array created from values in the AIPS catalog
header. HDR will NOT include any HISTORY keywords.
REVISION HISTORY:
Written W. Landsman March 7, 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/aipsrd.pro)
NAME:
AIRTOVAC
PURPOSE:
Convert air wavelengths to vacuum wavelengths, i.e.
correct for the index of refraction of air under standard
conditions. Wavelength values below 2000 A will not be
altered. Accurate to about 0.005 A
CALLING SEQUENCE:
AIRTOVAC,WAVE
INPUT/OUTPUT:
WAVE - Wavelength in Angstroms, scalar or vector
WAVE should be input as air wavelength(s), it will be
returned as vacuum wavelength(s). WAVE is always converted to
double precision upon return.
EXAMPLE:
If the air wavelength is W = 6056.125 (a Krypton line), then
AIRTOVAC,W yields an vacuum wavelength of W = 6057.804
(The correct value is 6057.802)
METHOD:
An approximation to the 4th power of inverse wavenumber is used
See IUE Image Processing Manual Page 6-15.
REVISION HISTORY
Written, D. Lindler 1982
Documentation W. Landsman Feb. 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/airtovac.pro)
*NAME: ARC
*CLASS:
*CATEGORY: WAVELENGTH CALIBRATION
*PURPOSE:
A driver for the GHRS WAVECAL procedure to give a more interactive
representation for the wavelength calibration.
*CALLING SEQUENCE:
arc,name[,gnumber,
textout=textout,calspec=calspec,ident=ident,noplot=noplot]
*PARAMETERS:
name - file name of GHRS WAVECAL observation.
gnumber - (INT) grating number (range 1-7)
1 = G140M
2 = G160M
3 = G200M
4 = G270M
5 = G140L
6 = Echelle A
7 = Echelle B
*Optional Keywords:
calspec - (logical) - 0 if CALHRS has not been run on WAVECAL obs.
- 1 if CALHRS has already been run on WAVECAL obs.
textout - redirects output of log file (i.e. textout=3 creates file
ARC.PRT). Default is to the screen.
ident - (string) - identifier for calibrated WAVECAL,(default: _R)
noplot - (logical) - 0 - perform interactive graphics steps.
1 - DO NOT perform interactive graphics steps.
*EXAMPLES:
1) Run ARC on archival WAVECAL obs. 3607 (PKS2155-304 WAVCAL/SPYBAL)
arc,3607
...you will be prompted for inputs and plot scaling
2) Same as example 1 except we run initial CALHRS prior to calling ARC
calhrs,3607,'bck=00,errors=0' ; creates h3607_r
arc,3607,/calspec
3) Same as examples 2 except change IDENTifier for calibrated file.
calhrs,3607,'bck=00,errors=0,ident=_TST ; creates h3607_tst
arc,3607,/calspec,ident='_tst'
4) Same as example 1, except turn off all plotting (non-interactive mode)
arc,3607,/calspec,/noplot
5) Same as example 2 except generate log of session:
arc,3607,textout=3 ; creates ARC.PRT and ARC_RESULTS.PRT
6) Run ARC in full debug mode
!debug=1 ; diagnostic text and graphics
!dump=2 ; complete history
arc,3607,textout=3 ; creates ARC.PRT and ARC_RESULTS.PRT
7) Capture TEK mode plots for hardcopy
plotopen
arc,3607
plotprint
*NOTES:
For grating 5, it uses NBSLIB_G5.TAB.
For all other gratings, it uses NBSLIB.TAB.
This routine assumes only 1 spectra order for echelle modes.
*MODIFICATION HISTORY:
R Robinson/CSC - Version 1
18-apr-1992 JKF/ACC - moved to GHRS DAF.
18-may-1992 JKF/ACC - switched defaults for YESNO.
20-jul-1992 JKF/ACC - added NVAR=2 for echelle mode.
(See /host/bluemoon/usr2/idllib/ghrs/pro/arc.pro)
*NAME:
arc_cplot
*CLASS: graphics
*CATEGORY:
*PURPOSE:
Procedure to plot a comparison of two spectra and manipulate the plot
*CALLING SEQUENCE:
arc_cplot,w1,f1,w2,f2 [,init_plot=init_plot, plot_info=plot_scale]
*PARAMETERS:
w1 and f1 are the wavelength and flux vectors for the first spectrum
w2 and f2 are the wavelength and flux vectors for the second spectrum
*OPTIONAL KEYWORDS:
init_plot - (logical) - 0 - does not initialize plot scale
1 - initializes plot scales (req. 1st the time).
plot_info - (structure) - plot scaling information (see ARC.PRO)
*RESTRICTIONS:
Subroutine called by ARC
*NOTES:
*PROCEDURE:
*MODIFICATION HISTORY:
R Robinson/CSC Version 1
18-apr-1992 JKF/ACC Moved to GHRS DAF.
18-may-1992 JKF/ACC - fixed bug in call to YESNO.
(See /host/bluemoon/usr2/idllib/ghrs/pro/arc_cplot.pro)
*NAME: arc_plot_dis
*CLASS:
*CATEGORY:
*PURPOSE:
arc_plot_dis,lname,cwave,plot_info=plot_info
*CALLING SEQUENCE:
Procedure to plot out the dispersions for the lines contained in
the line table
*PARAMETERS:
lname - (string) - name of line table
cwave - central wavelength
*EXAMPLES:
*RESTRICTIONS:
Subroutine called by ARC
*MODIFICATION HISTORY:
R Robinson - version 1
27-apr-1992 JKF/ACC - moved to GHRS DAF.
(See /host/bluemoon/usr2/idllib/ghrs/pro/arc_plot_dis.pro)
NAME:
ASTRO
PURPOSE:
Interactive astronomical utitlity for precession and coordinate
conversion.
CALLING SEQUENCE:
ASTRO,[SELECTION]
OPTIONAL INPUT:
SELECTION - Integer (0-6) giving the the particular astronomical
utility to be used. (0) Precession, (1) RA, Dec to Galactic
coordinates, (2) Galactic to RA,Dec (3) RA,Dec to Ecliptic,
(4) Ecliptic to RA, Dec, (5) Ecliptic to Galactic, (6) Galactic
to Ecliptic. Program will prompt for SELECTION if this parameter
is omitted.
METHOD:
ASTRO uses PRECESS to compute precession, and EULER to compute
coordinate conversions.
REVISION HISTORY
Written, W. Landsman November 1987
(See /host/bluemoon/usr2/idllib/ghrs/pro/astro.pro)
NAME
ASTROLIB
PURPOSE:
Add the system variables in use in the IDL Astronomy User's Library
CALLING SEQUENCE:
ASTROLIB
INPUTS:
None.
OUTPUTS:
None.
METHOD:
The system variables !PRIV, !DEBUG, !TEXTUNIT, and !TEXTOUT are added.
REVISION HISTORY:
Written, Wayne Landsman, July 1986.
Use DEFSYSV instead of ADDSYSVAR December 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/astrolib.pro)
NAME:
AVG
PURPOSE:
Calculate the average value of an array, or calculate the average
value over one dimension of an array as a function of all the other
dimensions.
CALLING SEQUENCE:
RESULT = AVG(ARRAY)
RESULT = AVG(ARRAY,DIMENSION)
INPUTS:
ARRAY = Input array. May be any type except string.
OPTIONAL INPUT PARAMETERS:
DIMENSION = Optional dimension to do average over.
OUTPUTS:
The average value of the array when called with one parameter.
If DIMENSION is passed, then the result is an array with all the
dimensions of the input array except for the dimension specified,
each element of which is the average of the corresponding vector
in the input array.
For example, if A is an array with dimensions of (3,4,5), then the
command B = AVG(A,1) is equivalent to
B = FLTARR(3,5)
FOR J = 0,4 DO BEGIN
FOR I = 0,2 DO BEGIN
B(I,J) = TOTAL( A(I,*,J) ) / 4.
ENDFOR
ENDFOR
RESTRICTIONS:
Dimension specified must be valid for the array passed; otherwise the
input array is returned as the output array.
PROCEDURE:
AVG(ARRAY) = TOTAL(ARRAY)/N_ELEMENTS(ARRAY) when called with one
parameter.
When DIMENSION is passed, then the function SUM is used.
MODIFICATION HISTORY:
William Thompson Applied Research Corporation
July, 1986 8201 Corporate Drive
Landover, MD 20785
Converted to Version 2 July, 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/avg.pro)
*NAME: AVSPT
*PURPOSE: Find single point zeros in IUEHI file and remove
*CALLING SEQUENCE:
result = avspt(f,e,kk)
*MODIFICATION HISTORY:
F Walter - 6/90 - donated to GHRS DAF.
Mar 27 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/avspt.pro)
NAME: A_b PURPOSE: Compute interstellar extinction in the B bandpass as a function of galactic position using the 21 parameter function given by deVaucoulers in the 2nd Reference Catalog of Galaxies CALLING SEQUENCE: result = A_b(l2,b2) INPUT PARAMETERS l2 = galactic longitude (degrees), scalar b2 = galactic latitude (degrees), scalar OUTPUT PARAMETERS RESULT - Interstellar extinction Ab in magnitudes NOTES: The controversial aspect of the deVaucoulers reddening curve is that it predicts an extinction of about 0.2 at the poles The parameters used here differ from the ones printed in the RC2 but are the ones actually used for entries in the catalog (see Rowan-Robinson 1985) REVISION HISTORY Written by R. Cornett and W. Landsman, STX 10/16/1987
(See /host/bluemoon/usr2/idllib/ghrs/pro/a_b.pro)
NAME: BANDS PURPOSE: To get the floating point and byte arrays of all the bands of one hcon of an image. CATEGORY: IMAGE PROCESSING CALLING SEQUENCE: BANDS,PLATE,HCON,BB1,BB2,BB3,BB4,B1,B2,B3,B4 INPUTS: PLATE = plate number HCON = hcon number OPTIONAL INPUT PARAMETERS: NONE OUTPUTS: BB1,BB2,BB3,BB4 = byte arrays of each band B1,B2,B3,B4 = floating point arrays of each band COMMON BLOCKS: IRASHDR SUBROUTINES CALLED IMGET MINMAX2 SIDE EFFECTS: NONE RESTRICTIONS: Works on V1 and V 2 of IDL. PROCEDURE: Straightforward. MODIFICATION HISTORY: Written, Stephen Merkowitz 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/bands.pro)
*NAME:
BASEREM 30 SEPTEMBER 1980
*PURPOSE:
To fit a polynomial of order NDEG to a user-specified
spectral region for removing a baseline from a spectral feature.
*CALLING SEQUENCE:
BASEREM,x,y,ndeg,xl,xr,a,YBF,CHIS
*PARAMETERS:
X (REQ) (I) (1) (I L F D)
Array of independent variables.
Y (REQ) (I) (1) (I L F D)
Array of dependent variables.
NDEG (REQ) (I) (1) (I)
Degree of polynomial used to approximate baseline.
A (REQ) (I/O) (1) (F)
Floating point array with at least NDEG+1 elements .
(polynomial coefficients are written into the last NDEG+1
elements).
Input vector A with added coefficients as described above
(output).
XL,XR (REQ) (I/O) (0) (I L F D)
Scalar values which if non-zero are used as the left & right
coordinates of the excluded region. If zero, the user is
prompted for these values via terminal cursor positions.
YBF (REQ) (O) (1) (I L F D)
Values of Y produced by polynomial.
CHIS (REQ) (O) (0) (I L F D)
Variance of the fit (as calculated by WPOLYFIT without
weighting).
*INTERACTIVE INPUT:
User is prompted for cursor positions of spectral feature region not
to be included in baseline calculation (if XL & XR are initially
zero).
*SUBROUTINES:
WPOLYFIT
PARCHECK
*NOTES:
- BASEREM will prompt user for cursor positions until the number of points
between the limits is greater than the number of elements in vector A
plus NDEG-2.
- BASEREM is used by GAUSSFIT for removing a baseline of a Gaussian
feature. In GAUSSFIT, the vector A has NDEG + 1 + 3*NCOMP elements
where NCOMP is the number of Gaussian components in the input array.
- The points selected by the user to designate the edges of the feature
can be specified in any order. These points are INCLUDED in the baseline
fit.
- When BASEREM is used to fit the background of a region in which several
Gaussians are to be fit, the user still specifies one set of endpoints.
The endpoints should represent the leftmost and rightmost sides of the
features.
- BASEREM use to be restricted to fits of less than 3rd order when
used on the PDP computer. Higher fits are now possible but depending on
the magnitude of the input X and Y arrays, problems may occur. If
errors occur the user may want to try rerunning BASEREM after scaling
the input X and/or Y arrays. For most IUE applications, rescaling the
flux array is necessary for high order fits.
*PROCEDURE:
BASEREM extracts the region excluding that described by the cursor
positions (or XL and RL), and uses WPOLYFIT to calculate a polynomial
fit, the YBF values, and the reduced chi square.If NDEG = 0, BASERERM
returns 1 element in the vector A simply representing the average value
of the baseline region. Since the weighting vector passed to WPOLYFIT
is set to ones, the CHIS parameter is simply the variance of the fit.
*EXAMPLES:
To fit a baseline with a 5th order polynomial:
A = FLTARR(9) ; 6 for baseline, 3 for a possible Gaussian feature
xl= 0
xr= 0
BASEREM,W,F,5,xl,xr,A,YBF,CHISQ
*MODIFICATION HISTORY:
PDP VERSION: I. DEAN AHMAD (modified VAX version: R. Thompson)
7-16-84 RWT updated documentation & made user interaction optional
8-8-84 RWT defined FXL & FXR for non-interactive mode
11-8-85 RWT RETALL used for 1st RETURN & NELEMENTS & # added for DIDL
4-13-87 RWT VAX mods: add PARCHECK, replace TEKDATA with CURSOR,
replace TKPLOT & XYOUT with PLOTS, XYOUTS, & SCTODC, use
assignment statements.
10-28-87 RWT remove restriction of NDEG being <3, allow sides of
feature to be specified in any order, add procedure call
listing, add PLOT,Y, add endpoints to baseline array, remove
FXR, FXL, YL & YR calculations, and remove oplot and listing
of CHIS.
8-22-89 RWT Unix mods: remove SCTODC & HARDCOPY, store coords.
in arrays, add get_kbrd
Mar 4 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/baserem.pro)
*NAME:
BBDRAW 6-JAN-83
*PURPOSE:
Draw blackbody curves over data through a given point.
*CALLING SEQUENCE:
BBDRAW,WAVE,FLUX,WPICK,TEMP,DILUTION,WBB,FBB
*PARAMETERS:
WAVE (REQ) (I) (1) (I L F D)
Wavelength scale.
FLUX (REQ) (I) (1) (I L F D)
Flux to be fit.
WPICK (REQ) (O) (0) (F)
Wavelength of the point through which the blackbody curve
is forced to pass.
TEMP (REQ) (O) (0) (F)
Blackbody temperature last chosen by user.
DILUTION (REQ) (O) (0) (F)
Dilution factor at point chosen by user for blackbody
with temperature temp.
WBB (REQ) (O) (1) (F)
Array of final blackbody wavelengths.
FBB (REQ) (O) (1) (F)
Array of final blackbody fluxes.
*INTERACTIVE INPUT:
User selects a point through which the blackbody curve must pass,
then user inputs guesses for temperature until he gets tired.
*SUBROUTINES CALLED:
PLANCK
*RESTRICTIONS: modified for sun idl version 1.1
*NOTES:
Uses planck.pro to calculate the bb curves.
*MODIFICATION HISTORY:
26-JAN-83 BY RJP= correction of a program by I. Ahmad based on a
program by S. Heap
6-21-85 RWT add WBB and FBB output parameters, use new IUEPLOT
and remove unnecesssary compiles
10-22-85 RWT DIDL change: use # for @
5-6-87 RWT VAX mods: add PARCHECK, plot titles, and use
CURSOR for TEKDATA
9-24-87 CAG corrected dilution factor to reflect IUE calibration
wavelength scale units of per Angstrom instead of per cm
(as given in Allen, Astrophysical Quantities). URP #275.
10-12-87 RWT add procedure call listing
05-oct-89 jtb @gsfc modified for sun/unix idl
Mar 4 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/bbdraw.pro)
NAME:
BB_FLUX
PURPOSE:
gives the blackbody flux (NOT the "astrophysical flux") in
ergs/cm2/s/sr from allen astrophysical quantities section 44
CALLING SEQUENCE:
RESULT = BB_FLUX(TEMPERATURE,WAVELENGTH)
INPUTS:
TEMP = tempreature
WAVE = wavelength - must be in microns
OPTIONAL INPUT PARAMETERS:
NONE
OUTPUTS:
blackbody flux
COMMON BLOCKS:
NONE.
SIDE EFFECTS:
NONE.
PROCEDURE:
Straightforward.
RESTRICTIONS
Works on V 1 and V 2 of IDL
MODIFICATION HISTORY:
Written, Stephen Merkowitz 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/bb_flux.pro)
*NAME: bck_smooth.pro *PURPOSE: Routine to smooth background spectra by a median filter followed by a mean filter. *CALLING SEQUENCE: bck_smooth,median_width,mean_width,poly_order,data *PARAMETERS: INPUTS: median_width - median filter width mean_width - mean filter width poly_order - width of polynomial (-1 do not use) INPUT/OUTPUTS: data - data vector *HISTORY: DJL DJL MAR'91 - added option for polynomial fitting.
(See /host/bluemoon/usr2/idllib/ghrs/pro/bck_smooth.pro)
*NAME:
BINS (General IDL Library 01) 6-JAN-83
*CLASS:
Resampling
*CATEGORY
*PURPOSE:
To bin flux data on a specified wavelength grid with or without weights.
*CALLING SEQUENCE:
BINS,WAVE,FLUX,WEIGHT,WCENTER,WIDTHS,WMEAN,WSIGMA,WGT
*PARAMETERS:
WAVE (REQ) (I) (1) (I L F D)
Required input vector giving the wavelength scale for the
flux data which are to be binned.
FLUX (REQ) (I) (1 2) (I L F D)
Required input vector or array giving the flux data to be binned.
If flux is an array (e.g. an ELBL file) the binning is only
performed in the wavelength direction
WEIGHT (OPT) (I) (1 2) (F D)
Optional input vector or array giving point by point weights
for the flux vector. If specified as a scalar, WEIGHT =
FLUX * 0 + WEIGHT; otherwise, WEIGHT must have same dimensions
as FLUX.
WCENTER (REQ) (I/O) (0 1) (I L F D)
Required input scalar or vector giving the centers for
the wavelength bin(s). The units MUST be the same as for
the WAVE vector. This vector is recomputed for output to the
actual value used (i.e. to describe any edge effects).
WIDTHS (REQ) (I/O) (0 1) (I L F D)
Required input scalar or vector giving the full width in the
same units as the WAVE array for each bin. This is
recomputed to the actual value used (i.e. to describe bins
truncated at ends of array).
WMEAN (REQ) (O) (0 1 2) (F D)
Required scalar, vector or array output variable containing the
(weighted) mean value of the FLUX array in each bin.
WSIGMA (REQ) (O) (0 1 2) (F D)
Required scalar, vector or array output variable containing the
(weighted) rms standard deviation from the WMEAN in each bin.
WGT (REQ) (O) (0 1) (F D)
Required scalar or vector output variable containing the
new weight values in each bin. If weight is not specified,
WGT equals the number of points in each bin.
*EXAMPLES:
with WEIGHT assigned by procedure WEIGHT,
BINS,WAVE,FLUX,WEIGHT,WCENTER,WIDTHS,WMEAN,WSIGMA,WGT
For uniform weighting:
BINS,WAVE,FLUX,WCENTER,WIDTHS,WMEAN,WSIGMA,WGT
For weighted binning of a 2-D line-by-line file using 50 A
bins from 1150 to 1600 angstroms:
READFILE,IMAGET,LABEL,H,W,FIMAGE,EIMAGE ;create image array
WEIGHT,EIMAGE,WEIGHT ;use epsilons for weight
WIDTHS = 50 ;specify constant width
WCENTER = 1150 + INDGEN(10)*50 ;generate wavelength centers
BINS,W,FIMAGE,WEIGHT,WCENTER,WIDTHS,WMEAN,WSIGMA,WGT ;run bins
*SYSTEM VARIABLES USED:
!NOPRINT if=0, the results are printed in tabular form
>0, the results are not printed.
*INTERACTIVE INPUT:
None.
*SUBROUTINES CALLED:
TABINV
PARSHIFT
*FILES USED:
None.
*SIDE EFFECTS:
None.
*RESTRICTIONS:
modified for sun/unix idl version 1.1
*NOTES:
Actually uses (WEIGHT>0) for weights.
All inputs may be an array, vector or scalar.
If WEIGHT is a scalar then all points have this weight.
If WIDTHS is a scalar then all bins have this width.
The results are printed out if !NOPRINT = 0.
WCENTER and WIDTHS are recomputed to be the actual values used.
Typing BINS without parameters will display the procedure call
statement.
FLUX and WEIGHT may be specified as arrays so that line-by-line
type files can binned using weights.
*PROCEDURE:
Treats original data rigorously as binned data.
*MODIFICATION HISTORY:
Jan 6 1983 RJP GSFC Modified BINS to allow weights
Apr 17 1987 RWT GSFC Added PARCHECK, made WEIGHT optional
May 8 1987 RWT GSFC Fix PARSHIFT
Jul 23 1987 RWT GSFC Use !NOPRINT to suppress tabular printout
Aug 25 1987 RWT GSFC correct calculation of N for scalar WCEN,
and add listing of procedure call statement
Mar 7 1988 CAG GSFC Add VAX RDAF-style prolog
5-23-88 RWT fix scaling factor error in printout format
7-28-88 RWT allow FLUX to be an array
1-17-89 RWT remove recalculation of total weight (IWGT)
5-16-89 RWT & jtb remove LOOKUP commands, use N_ELEMENTS,
and use vector subscripts in TOTAL commands
sep 13 1989 jtb @gsfc correct calculation of npoints and weights
for 'end effects'
sep 18 1989 jtb @gsfc modifications for unix/sun idl
apr 23 1990 rwt & jtb correct error for epsilon weighting and
improve iwsigma, iwmean, and pwgt calculation
Mar 4 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)...added
longword for GHRS spectra.
(See /host/bluemoon/usr2/idllib/ghrs/pro/bins.pro)
*NAME: BIN_SPEC
*CLASS:
*CATEGORY:
*PURPOSE:
Procedure to bin a GHRS spectrum by summing over a specified (NPTS)
number of datapoints to produce an effective low resolution spectrum
*CALLING SEQUENCE:
bin_spec,npts,wave,flux,bin_wave,bin_flux
*PARAMETERS:
INPUT:
npts - number of points per bin.
wave - wavelength vector
flux - flux vector
OUTPUT:
bin_wave - binned wavelength vector
bin_flux - binned flux vector
*EXAMPLES:
1) Sum spectrum over 5 datapoints (assumes WAVE and FLUX exist)
npts=5
bin_spec,npts,wave,flux,bin_wave,bin_flux
plot,bin_wave,bin_flux,psym=0
oplot,wave,flux,psym=3
2) Average spectrum over 5 datapoints (assumes WAVE and FLUX exist)
npts=5
bin_spec,npts,wave,flux,bin_wave,bin_flux
bin_flux = bin_flux/npts
plot,wave,flux,psym=3
oplot,bin_wave,bin_flux,psym=0
*MODIFICATION HISTORY:
R Robinson - Version 1.
23-apr-1992 JKF/ACC - moved to GHRS DAF.
(See /host/bluemoon/usr2/idllib/ghrs/pro/bin_spec.pro)
*NAME:
BLEMISH (General IDL Library 01) August 13, 1986
*CLASS:
Data Editing
*PURPOSE:
To interactively remove blemishes in a flux vector by linear
interpolation between the flux values on each side of the
blemish. (Based on BLEMISH by D. Lindler.)
*CALLING SEQUENCE:
BLEMISH,WAVE,FLUX,BSIZE,FCOR
*PARAMETERS:
WAVE (REQ) (I) (1) (F D)
Required input vector containing the wavelength data associated
with the FLUX data which are to be edited.
FLUX (REQ) (I) (1) (F D)
Required input vector containing the flux data which are to be
edited.
BSIZE (OPT) (I) (0) (F D)
Optional input scalar parameter specifying the interval, in the same
units as WAVE, over which the FLUX data are to be averaged
on either side of the blemish, before interpolating across the
blemish.
FCOR (REQ) (O) (1) (F D)
Required output vector giving the edited FLUX array.
*EXAMPLES
To linearly interpolate across a blemish, using the adjacent good
data points:
BLEMISH,WAVE,FLUX,FCOR
To linearly interpolate across a blemish using an average of the
data points within BSIZE wavelength units of the edges of the blemish,
BLEMISH,WAVE,FLUX,BSIZE,FCOR
*SYSTEM VARIABLES USED:
!ERR
!NOPRINT
*INTERACTIVE INPUT:
Flux versus wavelength is plotted and the user is requested
to indicate with the verticle cross-hairs the extent of the
blemish. The procedure then fills those points within the
blemish with values interpolated between the endpoints of the
blemish.
This process is repeated until the user types 0 (zero) or presses
the right mouse button when asked to position the crosshairs.
*SUBROUTINES CALLED:
BINS
TABINV
PARCHECK
*FILES USED:
None.
*SIDE EFFECTS:
Aborting the procedure may result in !ERR and !NOPRINT being
altered.
*RESTRICTIONS:
Device Dependent - This procedure requires a terminal equipped
with a graphics cursor.
(modified to run under unix sun idl version 1.2)
*NOTES:
Order of specifying endpoints is not important.
*PROCEDURE:
For each pair of positions marked by the user the wavelengths
at those points are computed by CURSOR. The subscripts
associated with those wavelengths are computed with TABINV.
BINS is called to calculate binned flux if BSIZE is specified.
Let IMIN and IMAX be the pair of subscripts. For each value
of I, IMIN < I < IMAX, a new flux is computed for FCOR(I):
FCOR(I) = FCOR(IMIN) + S*(WAVE(I)-WAVE(IMIN))
where:
S = (FCOR(IMAX)-FCOR(IMIN)) / (WAVE(IMAX)-WAVE(IMIN))
or, if BSIZE is specified,
S = (MEAN(1) - MEAN(0)) / (WC(1) - WC(0))
where MEAN is the average flux values and WC is the bin center
positions.
*MODIFICATION HISTORY:
D. Lindler GSFC initial version
Oct 31 1985 JKF GSFC DIDL compatible (indirect compilation)
Jul 25 1986 CLI GSFC add BSIZE parameter to take average flux
on either side of the specified points.
Aug 13 1986 RWT GSFC use N_ELEMENTS and CURSOR commands
Feb 19 1987 RWT GSFC VAX Mods: make BSIZE optional, account
references, @ for #, remove one GOTO
statement and DO loop, improve calculation
of subscripts, allow points to be
specified in any order.
Mar 14 1987 RWT GSFC add PARCHECK
May 6 1987 RWT GSFC fix error with N_PARAMS(0)=3 mode
Mar 8 1988 CAG GSFC VAX RDAF-style prolog, add disabling
of tabular printout from BINS.
jan 1 1990 jtb gsfc modified for sun/unix idl.
Mar 4 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/blemish.pro)
NAME:
BOXAVE
PURPOSE:
Box-average a 1 or 2 dimensional array. This procedure differs
from REBIN in that INTEGER arrays are boxaveraged using REAL arithmetic.
For boxaveraging REAL and DOUBLE arrays, the REBIN function should be
used (it is faster).
CALLING SEQUENCE:
RESULT = BOXAVE(ARRAY) ;Prompt for Box Size
RESULT = BOXAVE(ARRAY,XSIZE) ;Use a square box
RESULT = BOXAVE(ARRAY,XSIZE,YSIZE) ;Rectangular box for a 2-D array
INPUTS:
ARRAY - Two dimensional input Array to be box-averaged. Array may be
one or 2 dimensions and of any type except character. The
REBIN function is faster for floating or double arrays.
OPTIONAL INPUTS:
XSIZE - Size of box in the X direction, over which the array is to
be averaged. If omitted, program will prompt for this
parameter.
YSIZE - For 2 dimensional arrays, the box size in the Y direction.
If omitted, then the box size in the X and Y directions are
assumed to be equal
OUTPUT:
RESULT - Output array after box averaging. If the input array has
dimensions XDIM by YDIM, then RESULT has dimensions
XDIM/NBOX by YDIM/NBOX. The type of RESULT is the same as
the input array. However, the averaging is always computed using
REAL arithmetic, so that the calculation should be exact.
If the box size did not exactly divide the input array, then
then not all of the input array will be boxaveraged.
PROCEDURE:
Program boxaverages all points simultaneously using vector subscripting
REVISION HISTORY:
Written, W. Landsman, October 1986
Modified for version 2 IDL, B. Pfarr, Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/boxave.pro)
*NAME:
BOXCOUNT
*PURPOSE:
Determine integrated counts within selected regions. The regions are
specified by registering the cursor on a contour map.
*CALLING SEQUENCE:
BOXCOUNT,map,x,y,COUNTS,CPP,XPOS,YPOS
*PARAMETERS:
input: map -contour map, assumed already on screen
x,y - x,y coordinates used in the plot
output: counts - output counts in the boxes
cpp -counts/per pixel in the boxes
xpos, ypos - x and y vertices of the selected boxes
*EXAMPLES:
ta_mosaic,'z0j50102m',map ; 5x5 mosaic
siz= size(map)
xsiz= findgen(siz(1))
ysiz= findgen(siz(2))
contour, map
boxcount,map,xsiz,ysiz,counts,cpp,xpos,ypos
1) place cursor on lower-left corner of region of interest
2) place cursor on upper-right corner of region of interest
3) repeat steps 1-2 for each region of interest.
3) type 0 to exit.
*RESTRICTIONS:
*NOTES:
Use cursor to select each box. Register cursor at lower left and then
upper right hand corner of region of interest.
*MODIFICATION HISTORY:
Bruce Altner July 1990
31-OCT-1991 JKF/ACC -changed cursor call to work with MAC.
13-May-1992 DJN/CSC -checks for neg values in selected box. Sets
any negative values found to zero prior to
totally up the integrated number of counts.
18-may-1992 JKF/ACC - fixed bug in domain limits of plot.
(See /host/bluemoon/usr2/idllib/ghrs/pro/boxcount.pro)
NAME:
BSORT
PURPOSE:
Function to sort data into ascending order, like a simple bubble sort.
original subscript order is maintained when values are equal (FIFO).
(This differs from the IDL SORT routine alone, which may rearrange
order for equal values)
CALLING SEQUENCE:
result = bsort( array, [asort] )
INPUT:
Array - array to be sorted
/INFO = optional keyword to cause breif message about # equal values.
OUTPUT:
result - sort subscripts are returned as function value
OPTIONAL OUTPUT:
Asort - sorted array
HISTORY
written by F. Varosi Oct.90:
uses WHERE to find equal clumps, instead of looping with IF ( EQ ).
compatible with string arrays, test for degenerate array
W. Landsman November 1990
20-MAY-1991 JKF/ACC via T AKE- return indexes if the array to
be sorted has all equal values.
(See /host/bluemoon/usr2/idllib/ghrs/pro/bsort.pro)
*NAME: CALCPOS
*PURPOSE: Updates an input position for precession and proper motion.
*CALLING SEQUENCE:
CALCPOS,ra_deg,dec_deg,pm_ra,pm_dec,v_r,parallax,in_equinox,
out_equinox,pm_equinox,obs_epoch,pm_epoch,pm_yn,prec_pos,OUTRA,OUTDEC
*PARAMETERS:
INPUT:
ra_dec - (REQ) - (0) - (R,D) - Input RA, decimal degrees.
dec_deg - (REQ) - (0) - (R,D) - Input DEC, decimal degrees.
pm_ra - (REQ) - (0) - (R,D) - Proper motion in RA, arcseconds/yr.
pm_dec - (REQ) - (0) - (R,D) - Proper motion in DEC, arcseconds/yr.
v_r - (REQ) - (0) - (R,D) - Radial velocity, km/sec.
parallax - (REQ) - (0) - (R,D) - Parallax, arcseconds.
in_equinox - (REQ) - (0) - (R,D) - Starting coordinate equinox
(e.g., 1950.0 coords).
out_equinox- (REQ) - (0) - (R,D) - Ending coordinate equinox
(e.g., 2000.0 coords).
pm_equinox - (REQ) - (0) - (R,D) - Equinox for proper motions
(e.g., 1950.0 coords).
obs_epoch - (REQ) - (0) - (R,D) - Date of observation (e.g., 1990.9).
pm_epoch - (REQ) - (0) - (R,D) - Date to update proper motions
from (e.g., 1958.5).
pm_yn - (REQ) - (0) - (S) - 'Y' if proper motion corrections
are to be done.
prec_pos - (REQ) - (0) - (S) - 'Y' if precession is to be performed.
OUTPUT:
outra - (REQ) - (0) - (R,D) - Resulting RA, decimal degrees.
outdec - (REQ) - (0) - (R,D) - Resulting DEC, decimal degrees.
*SUBROUTINES CALLED:
ZPRECESS (from UIT ASTRO Ver 1.0 User's library PRECESS)
*EXAMPLES:
See CHECKPOS.PRO
*RESTRICTIONS:
Proper motion equinox must be either J2000.0 or the same as
the input equinox.
*PROCEDURE:
Precesses position, if necessary. Proper motion correction is
applied either before or after precession, depending on the
equinox of the proper motions.
*MODIFICATION HISTORY:
Ver 1.0 - 12/xx/90 - A. Warnock - ST Systems Corp.
Ver 2.0 - 02/11/91 - J. Blackwell - GSFC - Modified to conform with
GHRS DAF standards.
Mar 28 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calcpos.pro)
*NAME: calc_carpos *PURPOSE: Procedure to compute carrousel position from wavelength and order number *CALLING SEQUENCE: calc_carpos,grating,order,wave,carpos,angle INPUTS: grating - grating mode (1-7) (EA=6, EB=7) order - spectral order number (1 for first order gratings) wave - wavelength Either order or wave may be vectors, if both are vectors they should be the same length. If order or wave are vectors then carpos will be returned as a vector. OUTPUTS: carpos - carrousel position to center wavelength on the photocathode. angle - grating scan angle in radians HISTORY: version 1 D. Lindler June 88 9-AUG-1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calc_carpos.pro)
*NAME:
calc_ripple
*PURPOSE:
Compute approximate ripple function for purposes of estimating
exposure times. (no epsilon effect is included and the
blaze is set to 63.4 degress and 2*delta=13.25)
*CALLING SEQUENCE:
calc_ripple,grating,order,wave,ripple
*PARAMETERS
INPUTS:
grating - grating mode (6 for EA and 7 for EB)
order - spectral order(s)
wave - wavelength(s)
OUTPUT:
ripple - echelle ripple function normallized to 1.0 at
the blaze angle.
HISTORY:
version 1 D. Lindler June 88
Mar 11 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calc_ripple.pro)
CALFOS Calibrates FOS GEIS files CALLING SEQUENCE: calfos,name,params,wave,flux,eps,err,h,gpar,rate,gross,sky,back,net INPUTS: name - rootname of input file (without extension) params - keyword parameters 0 - use all defaults 1 - interactive specification 'filename' - from text file with form keyword=value keyword=value or 'keyword=value,keyword=value' OUTPUTS: wave - wavelength array flux - flux array eps - data quality array err - propagated stat array h - FITS header array gpar - group parameter array rate - counts/sec (not deadtime corrected) gross - gross spectrum (background subtracted and flat fielded) sky - unsmoothed sky back - background spectra net - gross minus smoothed sky Output data arrays are three dimensional: dimension 1 - (nchnls+ overscan - 1)*nxsteps dimension 2 - nysteps (number of ysteps relevant to the data type) dimension 3 - number of readouts x number of slices If some processing steps are omitted, some output arrays may not defined. KEYWORD PARAMETERS: The following keyword parameters can be specified in the PARAMS input. FILTER WIDTHS bck_md background median filter width bck_mn background mean filter width sky_md sky median filter width sky_mn sky mean filter width PROCESSING STEPS dqi_corr data quality PERFORM or OMIT or err_corr propagate errors LAST (stop after step) cnt_corr count rates Blank use header off_corr compute/apply GIMP offsets ppc_corr paired pulse wav_corr wavelengths bac_corr background subtraction gmf_corr background geomagnetic field correction flt_corr flat field sky_corr sky subtraction flx_corr flux calibration SPECIAL SWITCHES ddt_over override DEFDDTBL keyword in header to use dead diode table specified in ddthfile (see below) REFERENCE FILES bachfile background header file fl1hfile flat-field file 1 fl2hfile flat-field file 2 iv1hfile inverse sensitivity file 1 iv2hfile inverse sensitivity file 2 ddthfile disabled diode table file dq1hfile data quality init. file 1 dq2hfile data quality init. file 2 ccg2 paired pulse coef. table ccs0 aperture area table ccs1 aperture position table ccs2 emission line table ccs3 filter width table ccs5 background shift table ccs6 dispersion coef. table offs_tab GIMP offset table (if supplied then the offsets will not be computed but will instead be taken from this table) gmftab Background correction table due to geomagnetic field (if supplied then the corrections will not be computed but will be taken from this table) ccs7 gimp sensitivity table ccs8 Background correction geomagnetic rate table (used if no corrections table supplied) All input parameters have a blank default. A blank value indicates that the value will be taken from the input header except for the filter widths which will be taken from reference table CCS3 if not supplied. Processing steps may have values PERFORM, OMIT, or LAST. The steps are performed in the order specified above. If a step is set to LAST, all subsequent steps will be omitted. Reference file names may have a full VMS file specification with one exception. The first $ (dollar sign) will be converted to a colon. This allows you to use the iraf logicals which may already be in the headers as a VMS logical. You will not be able to use the dollar sign in disk names. You must set a logical to the disk which does not have the dollar sign. OPERATIONAL NOTES: If !dump>0 you will get text history (which is also added to the header) printed to the screen. EXAMPLES: Run CALFOS on observation Y00VK106R using all defaults. CALFOS,'y0vk106r',0,wave,flux,eps,err,header Process file with rootname myjunk, stop after sky subtraction: Use a sky median filter width of 11 and mean width of 5. CALFOS,'myjunk','SKY_CORR=LAST,SKY_MD=11,SKY_MN=5',wave,flux HISTORY: version 1.0 D. Lindler Jan. 1990 version 1.1 G. Hartig Aug. 1990 - modified to handle new data quality files. version 1.2 D. Neill Nov. 1990 - added kludge to skip opening *.q0h/*.q0d files if data quality corr not enabled. version 1.2 D. Lindler Feb 1991 - added GIMP offset application version 1.3 D. Lindler Mar 1991 - added gimp offset computation version 1.4 D. Neill Jul 1991 - added Backgrnd GeoMag Field corr version 2.0 Lindler/Neill Jul 1991 - added gimp sensitivity table. Modifications to work with new header/ group parameter keywords. version 2.1 D. Neill Oct 1991 - added GMF rates reference table. D. Neill Jan 1992 - Changed BGF to GMF to comply with SDAS version 2.2 D. Neill Mar 1992 - changed structure to make reading data files more sensible version 2.3 D. Neill Sep 1992 - removed lower limit of 1 in calculating error array version 2.4 D. Lindler April 1992 - corrected round off of zero count rate and zero error in GIMP routine to non-zero values.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos.pro)
calfos_bac CALLING SEQUENCE: calfos_bac,bac,fwidths,config,pattern,h,data,eps,back,rootname,ctable,rtable INPUTS: bac - reference background (from CALFOS_RDBAC). It is used only if no ystep has the background. fwidths = 2 element vector with median filter width and the mean filter width config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) rootname - rootname of observation; if present and non-null, apply geomagnetic field correction factor to any reference backgrounds used. ctable - geomagnetic field background corrections table. rtable - geomagnetic field background rates reference table. INPUT/OUTPUTS: h - FITS header data - data array eps - epsilon array OUTPUTS: back - background array of size (ns x ysteps x slices*nreads) HISTORY: version 1.0 D. Lindler Jan 1990 Feb 1991 D. Lindler Fixed bug in zeroing of data for EPS>200 Jul 1991 D. Neill Added implementation of geomagnetic background Oct 1991 D. Neill Added implementation of GMF rates reference table Jan 1992 D. Neill Changed BGF to GMF to comply with STSDAS
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_bac.pro)
CALFOS_CCG2 Read deadtime coefficient table CALLING SEQUENCE: calfos_ccg2,name,config,h,coef INPUTS: name - ccg2 table name config - configuration vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation OUTPUTS: coef - vector of coefficients coef(0) - tau1 (1) - theshold (2) - q0 (3) - q1 (4) - F (5) - RSAT (6) - R20 (7) - R5 HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccg2.pro)
CALFOS_ccs0 Read aperture area table CALLING SEQUENCE: calfos_ccs0,name,config,h,areas INPUTS: name - ccs0 table name config - configuration vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation OUTPUTS: coef - vector of areas area(0) = upper area(1) = lower HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs0.pro)
CALFOS_ccs1 Read aperture position table CALLING SEQUENCE: calfos_ccs1,name,config,h,ypos INPUTS: name - ccs1 table name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from calfos_rd) INPUT/OUTPUTS: h - FITS header for the observation gpar - group parameter blocks OUTPUTS: ypos - vector of ybase positions ypos(0) = upper ypos(1) = lower HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs1.pro)
CALFOS_CCS2 Read sky emission line table CALLING SEQUENCE: calfos_ccs2,name,config,h,line_beg,line_end INPUTS: name - CCS2 table name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation OUTPUTS: line_beg - vector of beginning positions line_end - vector of ending positions HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs2.pro)
CALFOS_ccs3 Read filter width table CALLING SEQUENCE: calfos_ccs3,name,config,h,widths INPUTS: name - ccs3 table name config - configuration vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation widths - 4 element array. On input it contains the strin keyword parameter values. On output it contains 4 integers widths with missing values filled in. HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs3.pro)
CALFOS_CCS5 Read sky NSHIFT table CALLING SEQUENCE: calfos_ccs5,name,config,pattern,h,nshift INPUTS: name - ccs5 table name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation OUTPUTS: nshift - vector of nshift positions nshift(0) = sky in upper aperture nshift(1) = sky in lower aperture HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs5.pro)
CALFOS_ccs6 Read dispersion coef. table CALLING SEQUENCE: calfos_ccs6,name,config,h,coef INPUTS: name - ccs6 table name config - configuration vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header for the observation OUTPUTS: coef - dispersion coefficients (6 x 2 array) coef(*,0) - upper or single aperture or pass_dir=1 coef(*,1) - lower aperture or pass_dir=2 coef(N,*) - COEFF_N (N=0,4) coef(5,*) - XZERO HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ccs6.pro)
CALFOS_DQI data quality initialization CALLING SEQUENCE: calfos_dqi,name,ypos,config,pattern,,dqi,eps,data INPUTS: name - rootname of observation ypos - 2 element vector containing upper and lower aperture pos. config - instrument configuration vector pattern - pattern vector from CALFOS_RD dqi - data quality initialization vector (from CALFOS_RDDQI) It should already be corrected for the scan pattern INPUT/OUTPUTS: eps - data quality values data - data array HISTORY: version 1 D. Lindler Jan 1990 version 2 D. Lindler Aug 1, 1991 Added upper/lower dqi vectors version 3 D. Neill Mar 1992 Modified to read .q0h file directly
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_dqi.pro)
CALFOS_EXP Convert to count rates CALLING SEQUENCE: calfos_exp,fname,pattern,ddt,h,gpar,data,eps,err,expmax INPUTS: fname - rootname of observation pattern - pattern vector for CALFOS_RD ddt - disabled diode table (for the diode range observed) Value = 0 (good diode) Value=1 (bad) INPUT/OUTPUT: h - FITS header gpar - group parameters from calfos_rd data - data array eps - data quality array err - error array OUTPUT expmax - maximum exposure time for a readout HISTORY: version 1 Don Lindler Jan 1990 version 2 D. Neill Mar 1992 Modified to read reject array directly version 3 D. Lindler Apr, 1993 added EXPMAX output parameter
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_exp.pro)
CALFOS_FLT FOS flat fielding CALLING SEQUENCE: calfos_flt,flat,ypos,config,pattern,h,data,err INPUTS: flat - flat field array NS x 2. flat(*,0) = upper or single aperture or pass_dir = 1 flat(*,1) = lower aperture or pass_dir = 2 ypos - two element vector containing the ybase for the upper and the lower aperture for a paired aperture. config - instrument configuration (output from CALFOS_RD) pattern - pattern vector (output from CALFOS_RD) INPUT/OUTPUTS: h - fits header data - data array err - propagated error array HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_flt.pro)
CALFOS_WAV Conversion to absolute flux units. CALLING SEQUENCE: calfos_ivs,ivs,ypos,config,pattern,net,h,err,flux INPUTS: ivs - inverse sensitivity array (from calfos_rdivs) ypos - ybases of the upper and lower aperture of an aperture pair (from routine calfos_ccs1) config - configuration vector (from calfos_rd) pattern - pattern vector (from calfos_rd) net - net spectra array INPUTS/OUTPUTS: h - FITS header err - propagated statistics array OUTPUTS: flux - absolute flux array HISTORY: version 1 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ivs.pro)
CALFOS_MEAN Mean filter routine CALLING SEQUENCE: result = calfos_mean(in,width,first,last) INPUTS: in - input spectrum width - filter width (if greater than the number of points in the input spectrum the output spectrum will have the average of the input spectrum at each point) OPTIONAL INPUTS: first - vector of first data point in regions not to be filtered. If first(0)<0 then no regions will be excluded in the filter. last - vector of last data point in regions not to be filtered OUTPUTS: filtered spectrum returned as function result HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_mean.pro)
CALFOS_MEDIAN FOS median filter routine CALLING SEQUENCE: result = calfos_median(in,width,first,last) INPUTS: in - input spectrum width - filter width (if greater than the number of points in the input spectrum the output spectrum will have the average of the input spectrum at each point) OPTIONAL INPUTS: first - vector of first data point in regions not to be filtered. If first(0)<0 then no regions will be excluded in the filter. last - vector of last data point in regions not to be filtered OUTPUTS: filtered spectrum is returned as the function result HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_median.pro)
calfos_off Apply GIMP offsets to the data. Offsets are applied to the nearest pixel. No interpolation is done. CALLING SEQUENCE: calfos_off,rootname,table,stable,pattern,expomax,h,data,err,eps,gpar INPUTS: rootname - observation rootname table - GIMP offset table. The only required column is OFFSET_X which gives an offset for each spectrum. The offsets are in units of diodes with positive offsets going toward the right. If not supplied then it will be generated with FOS_GIMP. stable - gimp sensitivity factor reference table pattern - substep pattern vector (FROM CALFOS_RD) expomax - maximum exposure time for a readout INPUT/OUTPUT: h - FITS header data - 2-D data array err - error array eps - epsilon array (data last at ends by shift are flagged with an epsilon=700) gpar - group parameter array HISTORY: version 1 D. Lindler Feb. 21, 1991 July 1991 D. Lindler added Gimp sensitivity table and Group parameter updating. Fixed for no error prop. when err_corr=omit Apr, 1992 D. Lindler Corrected roundoff error when zero counts gave a non-zero count rate and non-zero error.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_off.pro)
CALFOS_PPC FOS paired pulse correction CALLING SEQUENCE: calfos_ppc,ppcoef,h,data,err,eps INPUTS: ppcoef - paired pulse coef. (from routine CALFOS_CCG2) INPUT/OUTPUTS: h - FITS header for the data data - data array err - propagated error array eps - data quality array HISTORY: version 1 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ppc.pro)
calfos_rd Routine to read fos .d0h file CALLING SEQUENCE: calfos_rd,name,h,data,gpar,eps,pattern,config INPUTS: name - file name OUTPUTS: h - FITS header data - data array [ns x ysteps x (nreads*slices)] gpar - group parameter blocks eps - data quality array pattern - vector of pattern keyword values config - string vector of configuration parameters HISTORY: version 1.0 D. Lindler Jan 1990 version 1.1 D. Neill Nov 1990 - added kludge to skip opening *.q0h/*.q0d files if data quality corr not enabled. version 1.2 D. Neill Aug 1991 - checks for binary search and does not change YPOS group params in that case. version 1.3 D. Neill Mar 1992 - reads only data from .d0h file
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rd.pro)
CALFOS_RDBAC read background reference file CALLING SEQUENCE: calfos_rdbac,name,config,pattern,h,back INPUTS: name - reference file name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header OUTPUTS: back - background vector of length (nchnls+overscan-1)*xsteps HISTORY: version 1.0 D. Lindler Jan 1980
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rdbac.pro)
CALFOS_RDddt read disable diode file CALLING SEQUENCE: calfos_rdddt,rname,name,config,pattern,h,ddt INPUTS: rname - rootname of observation name - reference file name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header OUTPUTS: ddt - disabled diode vector (length = nchnls) HISTORY: version 1.0 D. Lindler Jan 1980 version 1.1 D. Neill Mar 1992 reads ddt from ref file or .ulh file
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rdddt.pro)
CALFOS_RDDQI read data quality initialization file CALLING SEQUENCE: calfos_rddqi,name,config,pattern,h,dqi INPUTS: name - reference file name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header OUTPUTS: dqi - data quality init vector (nchnls+overscan-1)*xsteps HISTORY: version 1.0 D. Lindler Jan 1980 version 1.1 D. Neill Aug 1990 - modified to handle new dqi files
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rddqi.pro)
CALFOS_RDFLT read flat feild reference file CALLING SEQUENCE: calfos_rdflt,name,config,pattern,h,flat INPUTS: name - reference file name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header flat - flat field array of size (nchnls+overscan-1)*xsteps x 2 On the first call (for FL1HFILE) flat will be created and the proper row filled in. On the second call (FL2HFILE) the new row will simply be inserted. HISTORY: version 1.0 D. Lindler Jan 1980
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rdflt.pro)
CALFOS_RDIVS read invserse sensitivity reference file CALLING SEQUENCE: calfos_rdivs,name,config,pattern,h,ivs INPUTS: name - reference file name config - configuration vector (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) INPUT/OUTPUTS: h - FITS header ivs - inv. sens. array of size (nchnls+overscan-1)*xsteps x 2 On the first call (for IV1HFILE), IVS will be created and the proper row filled in. On the second call (IV2HFILE) the new row will simply be inserted. HISTORY: version 1.0 D. Lindler Jan 1980
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_rdivs.pro)
calfos_ref Get reference file names and switches from input header CALLING SEQUENCE: calfos_ref,h,pattern,config,reference,switches,ddt_over INPUTS: h - fits header of .d0h file (from CALFOS_RD) pattern - pattern vector (from CALFOS_RD) config - configuration vector (from CALFOS_RD) ddt_over - switch to override the defddtbl header keyword INPUT/OUTPUTS: reference - reference file names switches - calibration switches (on output it will be changed to a logical vector 1-perform 2-omit) OPERATIONAL NOTES: Only blank reference files and calibration switches are filled in with values from the input header. HISTORY: version 1.0 D. Lindler Jan. 1990 added osfcnvrt to handle logical name conversion (between sunos and vms) D. Neill May. 1990 prints error message if filename n/a used D. Neill Jan 1991 Feb. 1991 added GIMP offset application Jul. 1991 added Background Geomagnetic Field correction application Jul. 1991 added gimp sensitivity file and OFFS_TAB header table Oct. 1991 added BGF rates reference table (CCS8) Oct. 1991 changed error messages and actions associated with GIMP and BGF corrections Jan. 1992 changed BGF to GMF to comply with STSDAS Mar. 1992 Changed order of DQI and ERR corrs, added special switch to override DEFDDTBL
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_ref.pro)
calfos_repair Repair bad pixels in a data vector by linear interpolation over good pixels. CALLING SEQUENCE: calfos_repair,mask,data INPUTS: mask - mask of same length as data. mask=0 (good pixel) mask=1 (bad pixel) INPUT/OUTPUT: data - data vector OPERATIONAL NOTES: if all pixels are bad, no repair is done and !err is set to -1. Otherwise !err is set to 1. HISTORY: version 1.0 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_repair.pro)
CALFOS_SKY subtracts smoothed sky spectrum from object spectra. CALLING SEQUENCE: calfos_sky,areas,line_beg,line_end,nshift,ypos,widths,config,pattern, gross,sky,eps_sky,h,eps,net INPUTS: areas - relative aperture areas (from routine calfos_ccs0) areas(0) - upper aperture areas(1) - lower aperture line_beg - beggining positions of emmision lines not to be smoothed (from routine calfos_ccs2) line_end - ending positions (from routine calfos_ccs2) nshift - amount to shift the sky before subtraction (from routine calfos_ccs5) ypos - ybases of the upper and lower aperture (from routine calfos_ccs1) widths - median and mean filter widths for smoothing the sky. (from routine calfos_ccs3) config - instrument configuration (from routine calfos_rd) pattern - pattern vector (from routine calfos_rd) gross - object spectra sky - sky spectra eps_sky - data quality for sky spectra INPUT/OUTPUT: h - FITS header eps - data quality for the gross/net OUTPUTS: net - the net spectra HISTORY: version 1 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_sky.pro)
CALFOS_WAV Determine FOS wavelengths CALLING SEQUENCE: calfos_wav,coef,ypos,config,pattern,h,wave INPUTS: coef - dispersion coefficients (from routine calfos_ccs6) ypos - ybases of the upper and lower aperture of an aperture pair (from routine calfos_ccs1) config - configuration vector (from calfos_rd) pattern - pattern vector (from calfos_rd) INPUTS/OUTPUTS: h - FITS header OUTPUTS: wave - wavelength array HISTORY: version 1 D. Lindler Jan 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calfos_wav.pro)
*NAME: calhrs *PURPOSE: Reduce (calibrate) GHRS science data. *PARAMETERS: CALLING SEQUENCE: calhrs,name,params,readouts,wave,flux,eps,err,headers,log INPUTS: name - name of input file without qualifier or the id number of the file. OPTIONAL INPUTS: params - parameter description. 0 - use all defaults 1 - interative selection of parameters string - parameter defintion of the form 'parname1=value1,parname2=value2,,,,' string array - each element of the array has form 'parname=value' string of form '$filename' where filename is the name of the file containing one parameter per line in the form; parname=value Any parameter not specified is set to its default. Defaults for the parameters can be found by using interactive selection params=1 or examinining the default (text) file, ZDEF:CALHRS.DEF. The following parameters are availble. OUTFILE Write results to output science file (0-no 1-yes) INDENT Output file identification (string, output file name is.SCI ERRORS propagate statistical errors (0-no 1-yes) LOG write processing log (0-no, 1-yes) BCK_MED Background, median filter width BCK_MEAN Background, mean filter width SKY_MED Sky mean filter width SKY_MEAN Sky median filter width DEFAULTS name of text file containing default reference file names DCOFF name of dispersion coefficient table used to compute offset from DCTAB file. The following parameters control the processing steps that are preformed and the intermediate output written. Each parameter is a 2 digit integer where the first digit specifies the value for accum. mode and the second digit specifies the value for direct-downlink mode. Values for the digits are assigned as follows: 0 - do not perform the step 1 - perform step, don't write output from the step 2 - perform step, write data 3 - perform step, write data and epsilon 4 - perform step, write data and errors 5 - perform step, write data, epsilon, and errors 6 - perform step, write data, epsilon, and errors, and do not perform any following steps. MAP Perform mapping function DQI data quality initialization EXP Convert to count rates PPC Perform paired pulse correction DIO Diode non-uniformity correction DOP Correct for doppler compensation PHC Correct for photocathode granularity VIG Correct for vignetting MER merge substep bins BCK subtract background ADC Apply dispersion coeffients THM Correct for thermal motion IAC apply incidence angle correction RIP perform echelle ripple correction ABS absolute sensitivity correction HEL helocentric wavelengths AIR convert to air wavelengths The following parameters control which reference file to use. There default value is DEF specifying the default reference file. Default reference file names are stored in the text file ZCAL:DEFAULTS.TXT LMAPTAB line mapping function coefficient table SMAPTAB sample mapping function coefficient table CCTAB carrousel calibration table DCTAB dispersion coefficient table IATAB incidence angle table (SSA to LSA) SCLTAB offsets to spectral calibration lamp apertures GRATTAB echelle grating parameter table RIPTAB echelle ripple coefficient table DQIFILE data quality initialization file DIOFILE diode response file name PHCFILE photocathode response file name VIGFILE vignetting response file name ABSFILE absolute sensitivity file name WAVFILE wavelengths for ABSFILE BLEMTAB contains photocathode blemish locations readouts - vector of scalar giving the readout numbers to process. If set to 0, the last readout is processed. If not supplied, or set to 'ALL', all readouts are processed. OPTIONAL OUTPUTS: wave - two dimensional wavelength array. wave(*,i) contain the wavelengths for readout i+1. flux - two dimensional flux array (same form as wave) eps - two dimensional data quality array err - two dimensional statistical error array headers - two dimensional data header arrays. Size=(128xNREADOUTS) log - processing log (string array in internal FITS header format) OPERATIONAL NOTES: If you want to like to watch the progress of the reduction set !DUMP to 1 or greater. Text output will then be printed as controlled by !TEXTOUT. EXAMPLES: Reduce observation 20000 with all defaults, results will be placed in H20000.SCI and H20000.PLH (processing log). CALHRS,20000 Reduce the same observation but stop after background subtraction, and use MYRESP.HHH for the diode response reference file. CALHRS,20000,'BCK=66,DIOFILE=MYFILE' Reduce observation file Z01Y0201.SCI with interactive parameter selection. return wavelengths and flux in idl variables. CALHRS,'Z01Y0201',1,'ALL',WAVE,FLUX Restore observation 22090, readout 10, with no file output and results returned in IDL variables. CALHRS,22090,'OUTFILE=0,LOG=0',10,WAVE,FLUX,EPS,ERR,IH,LOG Process 50 observations, specify text output, and place the text output for all 50 observations in file TODAYS.PRT !textout=3 Specify file output textopen,'today' Open textfile !textout=5 Inhibit CALHRS from opening new textfile for each obs. for i=20000,20049 do calhrs,i Reduce them !textout=3 This allows textclose to close the file textclose HISTORY: version 1, D. Lindler April 1989 version 1.1, D. Lindler Feb 6. 1991 added DCOFF input parameter and FPSPLIT disp. coef. offset computation in CALHRS_WAV. implemented disp. coef. thermal motion. and cubic dispersion coef term. version 1.2 D. Lindler Mar 1991 Added background scale factors BACK_A,...,BACK_D and polynomial fit to compute a smooth background. Switched order of paired pulse and diode response correction. Enhanced epsilon computation 9-SEP-1991 JKF/ACC - added COADD_DDL keyword parameter to coadd direct downlink obs. prior to calibration. 5-NOV-1991 JKF/ACC - changed COADD_DDL logical per DJL. Version 1.4 10-Jun-1992 DJL/ACC - added photocathode blemish flagging. Allows use of global coefficients for computing dispersion coefficients for arbituary carrousel positions. version 1.5 added 2 temperature thermal model and time model. version 1.6 added ability to select default reference files by time, grating mode, detector, and aperture version 1.7 added GIMP and Echelle scattered light defaults table (DJL, Feb 24, 1993)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs.pro)
*NAME:
calhrs_abs
*PURPOSE:
Routine to convert GHRS data to absolute flux units.
*PARAMETERS:
CALLING SEQUENCE:
calhrs_abs,fnames,ih,wave,flux,err,log
INPUTS:
fnames - string array of two elements
fnames(0) = sensitivity reference file name
fnames(1) = wavelengths for fnames(0)
ih - header vectors (128 x nreads)
wave - wavelength array npoints x nreads
INPUTS/OUTPUTS:
flux - flux array npoints x nreads
err - propagated statistical error array
if not supplied or set to a scalar, statistical
errors are not computed
log - (optional) processing log (string array)
HISTORY:
version 1 D. Lindler Apr 89
Mar 18 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_abs.pro)
*NAME:
calhrs_air
*PURPOSE:
Convert vacumm wavelengths to air wavelenghts
*PARAMETERS:
CALLING SEQUENCE:
calhrs_air,wave,ih,log
INPUT/OUTPUT:
wave - wavelength vector(s)
OPTIONAL INPUT/OUTPUTS:
ih - header array (if supplied the conversion will be flagged)
log - processing log
HISTORY:
version 1 D. Lindler April 89
Mar 18 1991 JKF/ACC - moved to GHRS DAF (IDL Version 2)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_air.pro)
*NAME: calhrs_bck *PURPOSE: Routine to compute and subtract the background from GHRS spectra. *CALLING SEQUENCE: calhrs_bck,ih,data,eps,fwid,bcktab,bck_scale,first,nf,nmerge,ihf,flux, ihb,back,epsb,log *PARAMETERS: INPUTS: ih - header array for unmerged data bins (128 x N) data - data array for unmerged data bins (512 x N) eps - data quality array for unmerged data bins (512 x N) fwid - integer array of 4 elements fwid(0) - interorder median filter width fwid(1) - interorder mean filter width fwid(2) - sky median filter width fwid(3) - sky mean filter width fwid(4) - order of polynomial for smoothing the background fwid(5) - order of polynomial for smoothing the sky bcktab - table of background scaling fudge factors bck_scale - vector of fudge factors to use instead of table values bck_scale(0) = back_a bck_scale(1) = back_b bck_scale(2) = back_c bck_scale(3) = back_d first - first bin in unmerged data for each readout. integer vector of length M nf - number of bins found for each readout integer vector of length M nmerge - number of bins merged for gross spectra (0 means no merging) INPUT/OUTPUTS: ihf - headers for the gross spectra (128 x M) flux - flux vectors for each readout for which the background is to be subtracted. OUTPUTS: ihb - headers for the background spectra (128 x M) back - background spectra (500 x M) epsb - epsilon for the background spectra (500 x M) OPTIONAL INPUT/OUTPUTS: log - processing log (string array) METHOD: The background is determined using one of four possiblities. type 0 - sky type 1 - interorder observed width main diode array type 2 - background diodes from background data bins type 3 - background diodes from gross spectral bins If nmerge is 0 (no spectral merging) then type 3 background is used. If substep bin ids 5 or 6 are present then type 0 is used. If substep bin ids 3 or 4 are present the type 1 is used. if substep bin ids greater than 6 are present then type 0 is used. If none of the previous conditions are satisfied, type 3 is used. If multiple types can be used, the the one with the smaller type number is used. HISTORY: version 1 D. Lindler March 1989 version 2.0 D. Lindler March 1990 - added polynomial fit to background and the background scale factors (ie the Cardelli fudge factors) version 2.1 D. Lindler Feb, 1993 added default scattered light table to CALHRS.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_bck.pro)
calhrs_blem Subroutine of CALHRS which flags photocathode blemishes CALLING SEQUENCE: calhrs_blem,table,ih,epsilon,log INPUTS: table - name of blemish table containing the following columns DETECTOR - detector number LINE1 - starting line of the blemish LINE2 - ending line of the blemish SAMPLE1 - starting sample of the blemish SAMPLE2 - ending sample of the blemish EPSILON - epsilon flag for the blemish ih - header array 128 x n INPUT/OUTPUT: epsilon - epsilon vectors log - history log HISTORY: version 1 D. Lindler May 1992 17-jun-1992 JKF/ACC - fixed problem with subscripts.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_blem.pro)
*NAME:
calhrs_dc
*PURPOSE:
Computes dispersion coefficients for given carrousel position by
one of two methods:
1) Interpolates or extrapolates in table of dispersion coefficients
to determine coefficients for a specified carrousel position.
2) Computes dispersion coefficients using global fit for grating.
Global fit models the disp. coef. as a polynomial function of
carrousel position.
*PARAMETERS:
CALLING SEQUENCE:
calhrs_dc,global,cpos,dc,cpos1,dc1,log
INPUTS:
global - vector of global fit coefficients.
CAP_A, CAP_C, MCENTER, F00, F01, F02, F10, F11, F12,
F20, F21, F22, F30, F31, F32, F40, F41, F42, F50, F51, F52
cpos - vector of carrousel positions for tabulated
dispersion coefficients (used if global_coef is undefined)
dc - table of dispersion coefficients. dc(i,*) contain
the coefficients for cpos(i) (used if global_coef is undefined)
cpos1 - carrousel position for which disp. coefficients
are desired.
OUTPUTS:
dc1 - vector of disp. coef. for cpos1
OPTIONAL INPUT/OUTPUT:
log - processing log (string array)
HISTORY:
version 1 D. Lindler Mar 89
version 2 D. LIndler May 92 Added GLOBAL vector as input. It
contains the global fit to the dispersion coef. for the
grating mode. Dispersion coef. are computed from the
coefficients of the fit.
version 2 D. Lindler Nov 12, 1992 added variation of m term with
carrousel position.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_dc.pro)
*NAME: CALHRS_DEF *PURPOSE: SUBROUTINE OF CALHRS - not standalone user procedure, used to set default reference file names *PARAMETERS: INPUTS: defname - name of text file containing default parameters detector - detector number grating - grating mode obsdate - observations date "DD-MMM-YYYY HH:MM:SS.SS" aperture - target aperture (SC1, SC2, LSA, SSA) INPUTS/OUTPUTS: par - parameter array log - processing log *NOTES: File DEFNAME is read to get default file names *HISTORY: 7-may-1991 JKF/ACC - resolved UNIX logicals. 5-jun-1992 JKF/ACC - stripe off VAX syntax (zcal:) 10-Jun-1992 DJL/ACC - added BLEMTAB processing 01-Dec-1992 DJL/ACC - added ability to select default reference files by grating, detector, aperture and observation time. 23-feb-1993 DJL/ACC - added BCKTAB to defaults.txt 7-Sep-1993 JKF/ACC - resolved logical(ZCAL) for non-VMS systems.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_def.pro)
*NAME:
calhrs_dio
*PURPOSE:
Perform correction for diode non-linearities
*PARAMETERS:
CALLING SEQUENCE:
calhrs_dio,fname,udls,ih,data,eps,err,log
INPUTS:
fname - reference file name
udls - array of udls for the observation
ih - headers for the data (128 x N)
INPUT/OUTPUTS:
data - data arrays (512 x N)
eps - epsilon values
OPTIONAL INPUT/OUTPUTS:
err - propagated statistical errors
If not supplied or set to a scalar, no error propagation
is done.
log - processing log
HISTORY:
version 1 D. Lindler April 1989
Apr 17 1991 JKF/ACC - handle degenerating array (N)
Apr 19 1991 JKF/ACC - avoid bad UDL data (incorrect IH)
Apr 22 1991 DJL/ACC - new version of CALHRS
Apr 24 1991 DJL/ACC - replaced NBADM with BADM
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_dio.pro)
*NAME: calhrs_dqi *PURPOSE: Routine to perform data quality initialization *CALLING SEQUENCE: calhrs_dqi,fname,udls,eps,log *PARAMTERS: INPUTS: fname - file name of the data quality initialization file udls - unique data logs INPUTS/OUTPUTS: eps -data quality array (512xN) OPTIONAL INPUT/OUTPUT: log - update log (string array) METHOD: The 512 point initialization vector, DQI, is read from the reference file (fname). Where DQI(i) is greater then EPS(i,j), EPS(i,j) is set to DQI(i). OPERATIONAL NOTES: unit 8 is used for reading the reference file. HISTORY: version 1 D. Lindler Mar 89 version 2.0 D. Lindler Mar 91 added combaddition affect on epsilons
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_dqi.pro)
*NAME: calhrs_exp *PURPOSE: Routine to convert to count rates. *CALLING SEQUENCE: calhrs_exp,ih,data,errors *PARAMETERS: INPUTS: ih - header array (128xN) INPUT/OUTPUT: data - data array (512xN) errors - propagated error array (512xN). if set to a scalar (errors calculation is not done) OPTIONAL INPUT/OUTPUT: log - processing log (string array) METHOD: exposure time is computed as ((NPER * 0.05) - 0.002) * NCOADDS where NPER is the number of 50 millisecond periods per coadd NCOADDS is the number of times data was coadded to the bin HISTORY: version 1 D. Lindler March 89
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_exp.pro)
hrs_gimp
Routine to compute the geomagnetically induced image motion and correct
the mapping function for the motion.
CALLING SEQUENCE:
calhrs_gimp,gimp,ihudl,udl,u1,u2,ih,log
INPUTS:
gimp - 2 element vector giving motion (diodes/gauss)
gimp(0) for detector 1
gimp(1) for detector 2
ihudl - udl headers (128 x nudl)
udl - udl array
u1 - vector of starting udl number for each science record
u2 - vector of ending udl number for each science record
sdtype - data type ('DDL' for direct downlink, 'ACC' for accum)
INPUTS/OUTPUTS:
ih - header vectors for the science record. Mapping function
info will be updated and motion value added.
log - processing log
HISTORY:
version 1 D. Lindler Feb. 1993
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_gimp.pro)
calhrs_hel
Convert to heliocentric wavelengths by correcting for the earth's
motion around the sun.
CALLING SEQUENCE:
calhrs_help,ih,wave,log
INPUT/OUTPUTS:
ih - 128 x N integer*2 header vectors
wave - wavelength vectors (npts x N)
log - processing log (with HST DG2 data included)
DESCRIPTION
Use the low-precision formulae for the Sun's coordiantes described
in the Astronimical Almanac (1984), page C24. The velocities
are obtained by takeing the derivatives of the coordinates. The
velocity vector is in the equatorial coordiante system of epoch
J2000. THis algorithm does not include the Earth-Moon Motion, Sun-
barycenter motion, light time correction from the earth to the Sun.
It should be accurate to approx. 0.025 km/sec. within the epoch range
of 1900 to 2100 AD.
HISTORY:
version 1 D. Lindler Nov 1989
Nov 21 1991 (VER 1.1) JHB/CSC - Modified to handle either old or
new style PODPS keywords.
11-jun-1992 JKF/ACC - version 1.2 - removed warning
messages for old RA/DEC. Added
error message if DEC was not found.
30-jun-1992 JKF/ACC - fixed bug in DECLNTRG condition.
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_hel.pro)
calhrs_iac Subroutine of calhrs for applying the incidence angle correction to wavelengths for data not taken in the small science aperture. CALLING SEQUENCE: calhrs_iac,iatab,ih,wave,log INPUTS: iatab - incidence angle table (CCR8) INPUT/OUTPUT: ih - science record header vectors wave - wavelength vectors log - processing log HISTORY: version 1 D. Lindler Mar 1990
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_iac.pro)
calhrs_map
Routine to perform GHRS mapping function.
CALLING SEQUENCE:
calhrs_map,tnames,ih,log
INPUTS:
tnames - string array with 2 elements:
tnames(0) = line mapping function table
tnames(1) = sample mapping function table
INPUT/OUTPUT:
ih - integer*2 header array 128xN
The following values will be added to IH:
ih(70:71,*) - starting sample for each bin
ih(72:73,*) - delta sample for each bin
ih(74:75,*) - line position for each bin
These will be stored as real*4 values in the
integer array IH.
OPTIONAL INPUT/OUTPUT:
log - processing log (string array)
METHOD:
Coefficients for the line mapping function are read
from table tnames(0) for the data's detector. If multiple
rows in the table are valid, the last valid row is used.
The photocathode line position is computed by:
line = L0 + A *(ydef-2048)
where:
L0, A are parameters in the table
ydef - is the ydeflection for the bin of data.
Coefficients for the sample mapping function are read
from table tnames(1). This table has coefficients
S0, B, C and E tabulated as a function of DETECTOR and
YDEF. Interpolation of the coefficients (in YDEF) is
used to compute coefficients at arbiturary y-deflections.
If a y-deflection is not within the range of y-deflections
within the table, extropolation is not done. The coefficients
for the closest y-deflection in the table are used.
The starting sample for each bin is computed by:
SAMPLE = S0 + B*(xdef-2048) + C*(xdef-2048)**2
and E gives the spacing (deltas) between data points.
HISTORY:
version 1 D. Lindler March 1989
Apr 17 1991 JKF/ACC - degenerating array (N)
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_map.pro)
calhrs_mer procedure to merge substep bins CALLING SEQUENCE: calhrs_mer,ih,d,eps,err,first,nbins,nf,nmerge,iho,d_o,epso,erro,log INPUTS: ih - header array (128 x n) d - data array (512 x n) eps - epsilon array (512 x n) err - propagated statistical error array first - vector giving locations of the first bin for each readout nbins - number of bins in the substep pattern nf - number of bins found for each readout nmerge - number of bins to merge (if 0, no merging done) OUTPUTS: iho,d_o,epso,erro - merged data arrays OPTIONAL INPUT/OUTPUT: log - reduction log (string array) HISTORY: version 1 D. Lindler March 1989
(See /host/bluemoon/usr2/idllib/ghrs/pro/calhrs_mer.pro)
calhrs_ord Routine to compute spectral orders from the carrousel position and y-deflection using the carrousel calibration coefficients. CALLING SEQENCE: calhrs_ord,tname,gmode,aperture,cpos,ydefs,orders INPUTS: tname - name of the carrousel calibration table gmode - grating mode 'G-1',...'E-A' aperture - 'LSA' 'SSA' 'SC1' or 'SC2' cpos - vector of carrousel positions (same length as ydefs) ydefs - vector of y-deflections OUTPUTS: orders - spectral orders METHOD: If it is a first order grating the carrousel positions are set to all 1. For echelle modes the central wavelength is computed by: b*A*sin((C-cpos)/B) order = FIX ( -------------------------------- + 0.5) y - a - d*A*sin((C-cpos)/B) where cpos is the carrousel position y is the y-deflection adjusted for the given aperture a,b,d,A,B,C are table coefficients which vary w