GAUSSINTFIT $SSW/smm/gen/idl/math/gaussintfit.pro
[Previous] [Next]
 NAME:
	GAUSSINTFIT

 PURPOSE:
 	Fit the equation y=f(x) where:

 		F(x) = A0*EXP(-z^2/2) + A3 + A4*x + A5*x^2
 			and
		z=(x-A1)/A2

	A0 = height of exp, A1 = center of exp, A2 = sigma (the width).
	A3 = constant term, A4 = linear term, A5 = quadratic term.
 	The parameters A0, A1, A2, A3 are estimated and then CURVEFIT is 
	called.

 CATEGORY:
	?? - fitting

 CALLING SEQUENCE:
	Result = GAUSSINTFIT(X, Y [, A])

 INPUTS:
	X:	The independent variable.  X must be a vector.
	Y:	The dependent variable.  Y must have the same number of points
		as X.

 OUTPUTS:
	The fitted function is returned.

 OPTIONAL OUTPUT PARAMETERS:
	A:	The coefficients of the fit.  A is a six-element vector as 
		described under PURPOSE.

 CALLS: ***
	CURVEFIT, FGAUSSINT_FUNCT, F_DIV, GAUSSINT_FUNCT, POLY_FIT, f_pder [1], f_pder [2]
 CALLED BY:
	FGAUSSINT_FUNCT
 COMMON BLOCKS:
	None.

 SIDE EFFECTS:
	None.

 RESTRICTIONS:
	The peak or minimum of the Gaussian must be the largest
	or smallest point in the Y vector.

 PROCEDURE:
	If the (MAX-AVG) of Y is larger than (AVG-MIN) then it is assumed
	that the line is an emission line, otherwise it is assumed there
	is an absorbtion line.  The estimated center is the MAX or MIN
	element.  The height is (MAX-AVG) or (AVG-MIN) respectively.
	The width is found by searching out from the extrema until
	a point is found less than the 1/e value.

 MODIFICATION HISTORY:
	DMS, RSI, Dec, 1983.
	ras, 20 jun 1994 changed gaussian to integrating gaussian over an interval


GET_CHAN_NUM $SSW/smm/hxrbs/idl/get_chan_num.pro
[Previous] [Next]

 NAME:
       GET_CHAN_NUM

 PURPOSE:
	Retrieves the channel numbers from the description string in the
	.SC4 file for the HXARCHIVE program

 CATEGORY:
       HXRBS

 CALLING SEQUENCE:
       GET_CHAN_NUM, Cstring, Channels, Numgroups  

 INPUTS:
       Cstring:	Description string in .SC4 file.

 OUTPUTS:
       Channels:	Intarr(2,numgroups) contains first and last
			channel in channel groups. 
	Numgroups:	Number of channel groups

 CALLED BY:
	HXARCHIVE
 MODIFICATION HISTORY:
	Written by AKT
	Mod. 06/96 by RCJ. Added documentation.


GET_DAYN $SSW/smm/hxrbs/idl/get_dayn.pro
[Previous] [Next]

 NAME:
	GET_DAYN

 PURPOSE:


 CATEGORY:
       HXRBS

 CALLING SEQUENCE:


 CALLS: ***
	CHECKVAR [1], UTIME [1], UTIME [2], checkvar [2]
 INPUTS:
       Input:	Array of character strings describing data in SC4/fits file.

 OUTPUTS:
       D_m:
	N_m:

 KEYWORDS:
       FITS:	If non-zero, Input comes from fits file.

 CALLED BY:
	HXARCHIVE, HXFITS
 PROCEDURE:
       none

 MODIFICATION HISTORY:
	Mod. 04/96 by RCJ. Make compatible with fits files.
	Mod. 05/96 by RCJ. Added some documentation.


get_emiss $SSW/smm/xrp/idl/fcs/get_emiss.pro
[Previous] [Next]
 NAME:
       get_emiss
 PURPOSE:
	compute emission measure from line intensity given an ion
       temperature.
 CATEGORY:
       computation
 CALLING SEQUENCE:
	em = get_emiss(flux,line,temp)
 INPUT PARAMETERS
       flux = line flux [ph cm-2 s-1]
       line  = ion identification no. from Mewe list
       temp  = electron temperature (million degrees)
 KEYWORDS:
       /mewe = use original abundances from MEWE table
               (def is to rescale with MEYER abundances)
 OUTPUTS:
	em = log10 volume emission measure (cm-3)
 OPTIONAL OUTPUT PARAMETERS:
       glog = log G(T) (ph cm s-1)
       te   = temperature array (MK)
 CALLS: ***
	INTERPOL, mewe
 PROCEDURE:
       Uses GOFT to get G(T) function (G) for particular ion and then EM
       from: EM = FLUX / G(T)

 MODIFICATION HISTORY:
	Written by DMZ (ARC) Sept 1988
       Converted to version 2 by DMZ (Mar'92)


GET_HXRBS_FITS $SSW/smm/hxrbs/idl/get_hxrbs_fits.pro
[Previous] [Next]

 NAME:
	GET_HXRBS_FITS

 PURPOSE:
       Calls rd_hxrbs_fits to read hxrbs fits files into idl, then
	computes counts/sec or counts/sec/cm^2/keV and plot sum of channels
	if requested.

 CATEGORY:
       HXRBS

 CALLING SEQUENCE:
	GET_HXRBS_FITS, flare=flare, file=file, ut=ut, yarray=yarray, 
	eyarray=eyarray, deltat=deltat, livetime=ltime, edges=edges, h0=h0, 
	h1=h1, h2=h2, plot=plot, flux=flux, units=units, error=error

 CALLS: ***
	ATIME [1], ATIME [2], CHECKVAR [1], F_DIV, RD_HXRBS_FITS, UTPLOT [1], UTPLOT [2]
	UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], checkvar [2], edge_products
 INPUTS:
	Through keywords so you don't have to remember the input order.

 OUTPUTS:
	Through keywords so you don't have to remember the output order.

 KEYWORDS:
	flare:	hxrbs flare number to retrieve data for (1-12776) (input).
       file:	hxrbs fits file name to read (input).
 CALLED BY:
	read_smm_4_spex [1], read_smm_4_spex [2]
		Note:  must pass either flare or file keyword to
		get_hxrbs_fits.
	plot:	if set, plots data in units selected, summed over all channels,
		at 1 second resolution (8 samples averaged together) (input).
	flux:	if set, units of data returned in yarray and plotted will
		be counts/sec/cm^2/keV.  Otherwise, counts/sec. (input)
       ut:	time in seconds since 1-jan-1979, middle of datapoint, 
		dblarr(n) (output)
	yarray:	data array, fltarr(15,n), either counts/sec in each channel,
		or counts/sec/cm^2/keV depending on whether flux keyword is 
		set (output).
	eyarray:uncertainties in yarray, fltarr(15,n) (output)
       deltat:	accumulation interval, scalar, in seconds (output)
       livetime:livetime in each sample in seconds, fltarr(n) (output)
       edges:	output energy loss bands in keV  fltarr(2,15) (output)
       h0:	primary header (string array) (output)
       h1:	header from first (time) extension (string array) (output)
       h2:	header from second (energy edges) extension (string array)
		(output)
	units:	string, units of data in yarray (output)
	error:	if =1, then error reading file.  Otherwise 0. (output)
	
 PROCEDURE:
	There is an archive of FITS files for every HXRBS flare.  These are
	stored on hxrbs_fits:hxrbs_xxx.fits where xxx is the flare number.
	This routine will read those files if the user passes the flare
	keyword, or if the user passes one of those file names explicitly.
	Or user may explicitly pass the name of a HXRBS FITS file that he
	generated.
 	Sample call:
	get_hxrbs_fits, flare=23, /plot, /flux
	get_hxrbs_fits, file='hxrbs_fits:hxrbs_23.fits', ut=ut, yarray=yarray

 MODIFICATION HISTORY:
	Written AKT, 9-sep-1994.
	Mod. 05/14/96 by RCJ. Mod. documentation.


GET_UVBOR $SSW/smm/xrp/idl/fcs/get_uvbor.pro
[Previous] [Next]
 NAME:  
             GET_UVBOR
 PURPOSE:
             retrieve record of UVSP boresite offset wrt S/C
 CATEGORY:  
             utility
 CALLING SEQUENCE: 
             rec=get_uvbor(expno)
 INPUTS:    
             expno = UVSP experiment number (long)
 OUTPUTS:     
             rec= nearest record prior to expno = [pitch,yaw]
 CALLED BY:
	RD_UVCAT
 PROCEDURE:       
             use simple WHERE
 MODIFICATION HISTORY:                           
             written DMZ (ARC) Nov'90


get_uvexp $SSW/smm/xrp/idl/fcs/get_uvexp.pro
[Previous] [Next]
 NAME:
      get_uvexp
 PURPOSE:
      get UVSP experiment numbers for a given day
 CALLING SEQUENCE:
      get_uvexp,ymd,exparr,time=time,pyr=pyr,qual=qual,/nolist
 INPUTS:
      ymd = date requested (e.g. 89/1/23 - user prompted, if not given)
 OUTPUTS:
      exparr = array of experiment numbers
 KEYWORDS:
      time = vector containing seconds since start of day of each expt.
      pyr = 3-element vector with [pitch,yaw,roll] for each expt.
      qual = vector of quality values (zero elements denote bad quality data).
      nolist: if set, inhibit listing. 
      image: if set, select only image expts.
      hcorr: [lat,long] array
 CALLED BY:
	CHKPOINT, find_uvexp
 PROCEDURE:
      reads UVSP CATALOG.CAT for time information and uses binary search
      to home in on experiment numbers for entered date
 MODIFICATION HISTORY:     
      DMZ (ARC) Nov'90 
      Made UNIX compatible - DMZ Jun'93


GET_UVSP $SSW/smm/xrp/idl/fcs/get_uvsp.pro
[Previous] [Next]
 NAME:
       GET_UVSP
 PURPOSE:
      read UVSP data
 CATEGORY:
      I/O
 CALLING SEQUENCE:
      get_uvsp,img,expno
 INPUTS:
      expno = UVSP experiment number
 OUTPUTS:
       IMG= structure created by ST_IMG
 KEYWORDS:
       dir = directory location of data [def = UVSP$DATA (vms) or UVSP_DATA (unix)]
 CALLS: ***
	CHKLOG [1], CHKLOG [2], CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3]
	DATATYPE [1], DATATYPE [2], DATATYPE [3], FETCH, LOC_FILE [1], LOC_FILE [2]
	LOC_FILE [3], RD_UVCAT, REVERSE, UVSPRD, concat_dir [4], st_img
 CALLED BY:
	FCS, rdimg
 PROCEDURE:
      reads UVSP CATALOG.CAT for image information
 MODIFICATION HISTORY:     
      written              - DMZ (ARC) Nov'90 
      made UNIX compatible - DMZ (ARC) Jun'93


get_wind $SSW/smm/gen/idl/graphics/get_wind.pro
[Previous] [Next]
 NAME:
	get_wind
 PURPOSE:
       get a free IDL window
 CALLING SEQUENCE:
	get_wind,index
 INPUTS:
       INDEX - window index to get
 PROCEDURE
       if input window INDEX is available then corresponding window
       will become active, otherwise a new window is opened
 CALLS: ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3]
 CALLED BY:
	FCS, PLOTMAP
 HISTORY:
       Written Mar'93 by D. Zarro (ARC)


GETBRR $SSW/smm/xrp/idl/bcs/getbrr.pro
[Previous] [Next]
 NAME:
       GETBRR
 PURPOSE:
      read BRR keyed access files
 CALLING SEQUENCE:
      getbrr
 INPUTS:
      file = BRR filename (can be optional)
 OUTPUTS:
      BRR spectral data saved in COMMON BCS_FILE for shared use by 
      other programs.
 CALLS: ***
	FETCH, READBRR
 CALLED BY:
	PLOTFIT, plotbrr
 PROCEDURE:
      uses Lemen's READBRR to read BRR files.
 MODIFICATION HISTORY:     
      DMZ (ARC) Jan'92


getbrr_ltc $SSW/smm/xrp/idl/bcs/getbrr_ltc.pro
[Previous] [Next]
 NAME:
	getbrr_ltc
 PURPOSE:
	extract BRR lightcurves 
 CALLING SEQUENCE:
	getbrr_ltc,chan,x,y,e,utbase,accum,$
               xtitle=xtitle,ytitle=ytitle,plabels=plabels
 INPUTS:
	chan = BCS channel no. (1-7)
 OUTPUTS:
	x = time (secs) since UTBASE
       y = total count rate
 OPTIONAL OUTPUTS:
       e = error on y
       utbase = base time of x
       accum= integration time per spectrum (secs) 
 OUTPUT KEYWORDS:
       plabels = string array of useful plot information labels
       xtitle = x-axis label
       ytitle = y-axis label
 CALLED BY:
	plotbrr
 RESTRICTIONS:
	GETBRR must be executed first to load COMMON BCS_FILE
 MODIFICATION HISTORY:
	Written by DMZ (ARC) Feb'92


getbrr_spec $SSW/smm/xrp/idl/bcs/getbrr_spec.pro
[Previous] [Next]
 NAME:
	getbrr_spec
 PURPOSE:
	extract BRR spectra 
 CALLING SEQUENCE:
	getbrr_spec,chan,stime,x,y,e,utbase,accum,dtime,/wave,$
             xtitle=xtitle,ytitle=ytitle,plabels=plabels
 INPUTS 
	chan = BCS channel no. (1-7)
       stime = user specified time of spectrum (in secs)
 OUTPUTS:
	x = bin number or wavelength (if /wave)
       y = spectrum (counts/bin/sec)
 OPTIONAL OUTPUTS:
       e = error on y
       utbase = date
       accum= integration time of spectrum (secs) 
       dtime= actual time of selected spectrum nearest to input STIME
 KEYWORDS:
       /wave = wavelength in Angstrom [def = bin no.]
       plabels = string array of useful plot information labels
       xtitle = x-axis label
       ytitle = y-axis label
 CALLS: ***
	ATIME [1], ATIME [2], REVERSE, UTIME [1], UTIME [2]
 CALLED BY:
	PLOTFIT, plotbrr
 PROCEDURE:
	GETBRR used to read BCS spectra created by MKBRR
       User has option to select spectra by specifying time of spectrum in
       STIME. If STIME is a 2-element vector, then spectra are integrated
       between start and end time.
 MODIFICATION HISTORY:
	Written by DMZ (ARC) Feb'92


GETDIdx $SSW/smm/xrp/idl/fcs/getdidx.pro
[Previous] [Next]
	NAME: GETDIdx.pro

	PURPOSE: Read and return Data-block index for requested 
		data-block.

	PARAMETERS:
		GETDIdx, filunit, rec_pointer, ix, ix2
		
		filunit (input) is unit # of file.
		rec_pointer (input) is rec # of data index
		ix	(output) data index part I
		ix2	(output) data index part II
	
 CALLS: ***
	CONV_VAX_UNIX2
 CALLED BY:
	RDFISDataBlk
	Note: due to a limit on the number of tags in a structure
		the index is return in two parts.

	HISTORY: written Jul-90, by GAL


GETFIS $SSW/smm/xrp/idl/fcs/getfis.pro
[Previous] [Next]
 NAME:
       GETFIS
 PURPOSE:
      read FIS files
 CALLING SEQUENCE:
      getfis
 INPUTS:
      file = FIS file (optional input)
 OUTPUTS:
      FIS structures saved in COMMON FIS_STUFF for shared use by 
      other programs.
 CALLS: ***
	FETCH, getfisblk
 CALLED BY:
	plotfis
 PROCEDURE:
      uses Linford's GETFISBLK procedure (refer to his documentation for details)
 MODIFICATION HISTORY:     
      DMZ (ARC) Jan'91


GETFIS_1BLK $SSW/smm/xrp/idl/fcs/getfis_1blk.pro
[Previous] [Next]
	NAME:	GETFIS_1BLK.pro
	
	PURPOSE: Read and return one data-block (spectra or image)
		in IDL arrays.

	Parameters:
		filunit		is the open unit # of the FIS file
		rec_Pointer-1	is the pointer to the data-block
				index (which is 3x64 bytes long).
		ix		part I of the data-block index
		ix2		part II of the data-block index.

		OUTPUT:
		cryadd		crystal address list
		data		FCS channel data (see below for details)
		bkg		background data
	
 CALLS: ***
	BOUST, CONV_VAX_UNIX2, FCS_INTERP
 CALLED BY:
	RDFISDataBlk
	NOTE:	The output data is ordered so that IDL subscript 1 is 
		channel 1, DGI data is subscript 0, and Sun sensor data
		is subscript 8.

	HISTORY: written 25-Jul-90, by GAL from GETFIS_1set (written by
			Mons Morrison)
		modified 27-Aug-90, to correct background bug.  GAL
		modified 31-Oct-90, to correct orientation of bkg image


getfisblk $SSW/smm/xrp/idl/fcs/getfisblk.pro
[Previous] [Next]
	GetFISBlk.pro 	(ver. 1.5)
 CALLS:
 CALLED BY
	FCS, GETFIS, RDFCS, RDFIS


GetHeader $SSW/smm/xrp/idl/fcs/getheader.pro
[Previous] [Next]
	NAME:	GetHeader

	PURPOSE: Read and return the FIS file header.

	PARAMETERS:
		GetHeader, filunit, Rec_pointer, fileheader

		where:
		filunit	(input)	is the unit # of fis file.
		Rec_pointer (input) is the rec # of fileheader
		fileHeader (output) is the fileHeader info.

	
 CALLS: ***
	CONV_VAX_UNIX2
 CALLED BY:
	getfisblk, rdmap
	HISTORY: written 23-Jul-90


GetPoint $SSW/smm/xrp/idl/fcs/getpoint.pro
[Previous] [Next]
	NAME:	GetPoint.pro
	
	Parameters:
		GETPOINT, fileUnit, filepointer
		where:
		fileunit (input) is the unit # of the openned file.
		filepointer (return) is the file pointer info.

	PURPOSE: Get pointer info from 1st record of FIS file.
	
 CALLS: ***
	CONV_VAX_UNIX2
 CALLED BY:
	getfisblk, rdmap
	HISTORY: written July 90 by GAL.


GetRoMap $SSW/smm/xrp/idl/fcs/getromap.pro
[Previous] [Next]
	NAME: GetRoMap

	PURPOSE: Read and return the complete roadMap.

	PARAMETERS:
		GETROMAP, filunit, rec_Pointer, nDataUnits, Roadmap
		
		where:
		filunit (input)	is the unit #.
		rec_pointer (input) is the starting rec # of roadMap.
		nDataUnits (input) is the # of data-blocks in file.
		roadMap (output) is the roadmap for the file.

 CALLS: ***
	CONV_VAX_UNIX2
 CALLED BY:
	getfisblk, rdmap
	HISTORY:
		written 20-jul-90 by GAL


GETSUM $SSW/smm/hxrbs/idl/getsum.pro
[Previous] [Next]

 NAME:
	GETSUM

 PURPOSE:
       Read SUMMARY files    

 CATEGORY:
       HXRBS

 CALLING SEQUENCE:
       GETSUM

 CALLS: ***
	FETCH, READSUM, thick
 INPUTS:
	none: prompted for summary file

 OUTPUTS:
	T:	Time array (UT)
       Data:	Array of selected data

 OPTIONAL OUTPUTS:
	Unc:	Data uncertainties
       Utbase:	Date of data

 COMMON BLOCKS:
	SUM_DATA

 PROCEDURE:
       Uses READSUM procedure 
       Summary data saved in COMMON SUM_DATA for shared use by 
       other programs.

 MODIFICATION HISTORY:
       DMZ (ARC) May'92
       Mod. 05/08/96 by RCJ. Added documentation.


gextal $SSW/smm/xrp/idl/fcs/gextal.pro
[Previous] [Next]
 NAME:
	gextal
 PURPOSE:
	gets rocking widths and refectivities vs wavelength 
 CATEGORY:
       I/O
 CALLING SEQUENCE:
	gextal,ch,wave,rock,iref,ref
 INPUTS:
	ch = required channel no.
 OPTIONAL INPUT PARAMETERS:
       None
 OUTPUTS:
	rock = rocking width in arcsec units (FWHM)
       wave =  wavelength in angstroms
 OPTIONAL OUTPUT PARAMETERS:
       iref = integrated reflectivity (10-5 radians)
       ref  = peak reflectivity (%)
 CALLS: ***
	CHKLOG [1], CHKLOG [2], GET_LIB, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], MKLOG
 CALLED BY:
	fcs_par, fluxcon
 SIDE EFFECTS:
       None
 RESTRICTIONS:
       Ensure CRYSTAL logical is defined
 PROCEDURE:
	Uses simple open and read commands. Data in CRYSTAL stored
       in columns of increasing wavelength. Different channels are
       blocked in order of decreasing wavelength.
 MODIFICATION HISTORY:
	DMZ, ARC, July 11 1986.


GRAPHICS [2] $SSW/smm/gen/idl/graphics/graphics_page.pro
[Previous] [Next]
 NAME:
	GRAPHICS

 PURPOSE:
 	graphics_page enters graphics mode (for use on Tektronix terminals
 	to switch to graphics page from alpha page, for example)

 CATEGORY:
	Graphics.

 calling sequence: 
	GRAPHICS

 INPUTS:
	None

 OUTPUTS:
	None

 CALLS: ***
	GRAPHICS_PAGE
 SIDE EFFECTS:
	Issues a carriage return if called.

 RESTRICTIONS:

 PROCEDURE:
	See purpose.

 MODIFICATION HISTORY:
 	Written by:	AKT
	Version 2:	RAS, 23-Mar-1995, only called for Tektronix


GRS2UTIME $SSW/smm/grs/idl/grs2utime.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS2UTIME
               
 Purpose     : This function takes the GRS time structure and returns the time
		in seconds from 1-jan-1979, an acceptable anytim.pro format
               
 Category    : SMM, GRS
               
 Explanation : The GRS time format is in year, day of year, hours, minutes, seconds
		milliseconds.  Using YYDOY_2_UT it is straightforward to convert it.
               
 Use         : Seconds = GRS2UTIME( Input)
    
 Inputs      : Input - a Grs_time_structure with structure name GRS_USER_TIME: See GRS_USER_STR.PRO
			or one of the structure tags.
               
 Opt. Inputs : Offset - One of the elements of the OFFSET structure used to define
		the sub major frame time. If this is used, then SECONDS is returned
		as a 2xN fltarrr where the times define the start and end of the
		sample accumulation.
               
 Outputs     : Returns time in seconds from 1-jan-1979.

 Opt. Outputs: None
               
 Keywords    : 

 Calls       : ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3], YYDOY_2_UT
 CALLED BY:
	GRS_EXTRACT, GRS_LIGHTCURVE
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : 
	Version 1, RAS, 1991
	Version 2, RAS, rewritten using YYDOY_2_UT, 19-mar-1997


GRS_CLEAN_PHA $SSW/smm/grs/idl/grs_clean_pha.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_CLEAN_PHA
               
 Purpose     : This procedure reads and cleans the GRS main pha data.
               
 Category    : SMM, GRS
               
 Explanation : The GRS PHA can have errors in some records due to bad bits
		or overflow in an 8 bit register in the Sum Spectrum.  They
		are cleaned by either the Jumper.pro algorithm or by looking
		for isolated bad data.
               
 Use         : Clean_pha = GRS_CLEAN_PHA( [File] )
    
 Inputs      : File - full file name, optional if grs_extract already has
		read a datafile.
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : START_TIME- Accumulate from the Major Frame including this time, ANYTIM readable.
		END_TIME  - Accumulate to the Major Frame including this time, ANYTIM readable.
		ALL_REC_TYPE - If set include all GRS record types, except low power.
		otherwise only Normal night and Normal day records.
			Record types
			0, undef; 1, In-flight Cal day; 2, Normal night; 3, IFC night; 
			$; 4, normal; 5, Not used; 6, Low Power SAA, short record!
		SING - Singles Spectra.
		SUM  - Multiple Detectors Spectra.
 Calls       : ***
	GRS_EXTRACT, JUMPER
 CALLED BY:
	GRS_LIGHTCURVE
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : Version 1, ras, 21-mar-1997


GRS_ENERGY $SSW/smm/grs/idl/grs_energy.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_ENERGY
               
 Purpose     : This function returns a structure giving the nominal energy
		calibration for the various SMM GRS energy-loss data types.
               
 Category    : SMM, GRS
               
 Explanation : 
               
 Use         : ENERGY_STRUCTURE = GRS_ENERGY()
    
 Inputs      : 
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 

 Calls       : ***
	edge_products
 CALLED BY:
	GRS_LIGHTCURVE, GRS_XRAY_RESP
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  : Written as Energy_cal in 1991

 Modified    : Version 1, RAS, 20-Mar-1997


GRS_EXTRACT $SSW/smm/grs/idl/grs_extract.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_EXTRACT
               
 Purpose     : This function reads the GRS User-format files and returns them as
		a structure.  The structure resides in common to facilitate the
		sequential extraction of individual structure elements.
               
 Category    : SMM, GRS
               
 Explanation : The data file is read and all 2900 byte records are placed into the
		structure.  Short records (GRS datatype 6) are discarded.  A new structure
		is read when a new file name is given.
               
 Use         : GRS_DATA_STRUCTURE = GRS_EXTRACT( [Filename] )
    
 Inputs      : Filename- a full file name including the path or a null string
		to retrieve data already read.
               
 Opt. Inputs : None
               
 Outputs     : The function returns the raw data structure over the valid range.
		The data is read into a buffer that is too large so only
		the structures within the timerange (can be set with START_TIME and
		END_TIME) are returned.
 Opt. Outputs: 
               
 Keywords    : START_TIME- Accumulate from the Major Frame including this time, ANYTIM readable.
		END_TIME  - Accumulate to the Major Frame including this time, ANYTIM readable.
		OFFSET    - Time offsets in a GRS Main Frame for the various grs
		data quantities.
		ALL_REC_TYPE - If set include all GRS record types, except low power.
		otherwise only Normal night and Normal day records.
			Record types
			0, undef; 1, In-flight Cal day; 2, Normal night; 3, IFC night; 
			$; 4, normal; 5, Not used; 6, Low Power SAA, short record!
			
 Calls       : ***
	ATIME [1], ATIME [2], CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FCHECK
	GRS2UTIME, GRS_USER_STR, IEEE_TO_HOST [1], IEEE_TO_HOST [2], IEEE_TO_HOST [3]
	IEEE_TO_HOST [4], LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], MINMAX [1], MINMAX [2]
	OS_FAMILY, anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	concat_dir [4], curdir [1], curdir [2], data_chk [1], data_chk [2]
 CALLED BY:
	GRS_CLEAN_PHA, GRS_LIGHTCURVE
 Common      : GRS_EXTRACT
               
 Restrictions: 
               
 Side effects: The file is opened and closed and read into the common block.
               
 Prev. Hist  : 

 Modified    : Version 1, RAS, 19-Mar-1997
		Version 2, RAS, 19-May-1997, added path information
		Version 3, RAS, 7-aug-1997, more path info.		


GRS_JUMPER $SSW/smm/grs/idl/grs_jumper.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_JUMPER
               
 Purpose     : This procedure recovers the true count rate observed in the
		the GRS Xray detectors compensating for overflow and the square
		root compression at high rates.
               
 Category    : SMM, GRS
               
 Explanation : 
 		Reconstitute the true count rate observed in the GRS X-ray
		channelds.  The on-board software compresses the measured X-ray
		counts by taking the square root of the actual counts and
		loading it into an 8 bit register.  The value is recovered by
		the GRS USER format into a 16 bit value using the algorithm
		XRAY = cnts(cnts+1) except when cnts > 181 then cnts is stored.  
		Since cnts is an 8 bit value it is also subject to overflow in
		that 256+1=0 for 8 unsigned bits.  This procedure recovers the
		true counts observed by these detectors subject to the 
		digitization error in the square root compression.
		Search for jumps from/to more than 5000 to a number from
		181-256 in a single time step and a corresponding jump
		on the other side when the rate decreases.  Allow for a data
		gap on either side so the interval is defined by either two
		bracketing jumps or 1 jump and a value from 0-256 on the
		other side.
               
 Use         : grs_jumper, r, r_out, error, flag_reset=flag_reset
    
 Inputs      : R - the 16 bit value in the GRS USER format. One Xray channel
		is used as input at a time.
               
 Opt. Inputs : None
               
 Outputs     : R_OUT - The recovered true counts.
               ERROR - Set if there may be an error in the reset data.

 Opt. Outputs: None
               
 Keywords    : 
		FLAG_RESET - Set if the recovery procedure was used, i.e.
		there was a jump in the data as described under method.

 Calls       : ***
	XJUMPER2
 CALLED BY:
	GRS_LIGHTCURVE
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : Version 1, RAS, OCT. 1992
 		Version 2, RAS, 21-mar-1997, enhanced documentation


GRS_LIGHTCURVE $SSW/smm/grs/idl/grs_lightcurve.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_LIGHTCURVE
               
 Purpose     : This procedure extracts the corrected GRS time histories from the
		raw USER format with associated accumulation time bins.
               
 Category    : SMM, GRS
               
 Explanation : The data is extracted from the USER format structure, corrections
		are made to put the histories into counts/sec, energy calibrations
		are made available, labels are generated, time bins are generated,
		livetimes are generated, overflow corrections are generated.  The
		user selects the desired value, e.g. Main Channel 10-90, burst window,
		xray detectors, Nuclear Line Main Channel Windows, etc and the
		corrections are made and the array is returned.
               
 Use         : TIME_HIST =GRS_LIGHTCURVE( Ut, Live, Energy, Label )
    
 Inputs      : None required after the first call using the keyword FILE.  Subsequent
		calls extract from the common block in GRS_EXTRACT until FILE is changed.
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: Ut	- 2xN sample accumulation time, N is number of readouts
		Live	- Detector live time in sample, may be highly interpolated
		Only main channel has true live time measurement on major frame (16.384 s)
		boundaries.
		Energy	- Energy in MeV associated with energy loss in this readout
		Label   - Descriptive label including energy.
               
 Keywords    : 
		FILE- File name with full path.  Uses file last read by grs_extract.pro
		if not included.
		START_TIME- Accumulate from the Major Frame including this time, ANYTIM readable.
		END_TIME  - Accumulate to the Major Frame including this time, ANYTIM readable.
		DEFAULT_TIME - If set, find time window with 2 minute buffers where the XRAY2
		highest channel is in excess of 50 cts/sec.  If it doesn't exist then
		successively lower Xray2 channels are examined.
		XRAY- If set, return the 4 channels from each of the two GRS Xray detectors,
		sampled every 1.024 seconds.  Corrected to counts/interval including overflow
		correction.
		MCW - If set, return the 3 Main Channel Nuclear Windows, sampled every 2.048
		seconds covering the range from 4.2-6.4 MeV

		PHA_DATA - If set returns the full resolution singles+sum Main Channel spectra.

		SLOWMCW- If set, construct 3 windows from the Main Channel singles
		and sum spectra, channels 10-90, a 0.511 MeV window, and a 2.225 MeV window.
		BURST- If set, return burst window, 300-350 keV, every .064 sec, prescaled
		and rescaled by a factor of 16.  This sounds like a reformatted Time To Spill
		format but the GRS documentation is silent on this subject.
		OBC - If set return calibrated On-Board-Computer readouts
		ENERGY and LIVE are meaningless, no clock corrections made
		so orbital position may be off by up to 71 seconds.
		SHIELD  - If set, return 16 shield elements, 0.512 acc, cycled, 2 per 16.384 sec.
		TOTSHLD	- If set, then return the total Or'd shield, 8.192 sec.	 
		HEM - If set, then return 18 channels of the High Energy Matrix every 2.048 sec.
		ALL_REC_TYPE - If set include all GRS record types, except low power.
		otherwise only Normal night and Normal day records.
			Record types
			0, undef; 1, In-flight Cal day; 2, Normal night; 3, IFC night; 
			$; 4, normal; 5, Not used; 6, Low Power SAA, short record!

 Calls       : ***
	AVG [1], AVG [2], CHECKVAR [1], GRS2UTIME, GRS_CLEAN_PHA, GRS_ENERGY, GRS_EXTRACT
	GRS_JUMPER, GRS_USER_STR, INTERPOL, JUMPER, MINMAX [1], MINMAX [2], PARA_LIVETIME
	SPLINE, checkvar [2]
 CALLED BY:
	read_smm_4_spex [1], read_smm_4_spex [2]
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : Version 1, RAS, 25-mar-1992


GRS_RESP $SSW/smm/grs/idl/grs_resp.pro
[Previous] [Next]

 NAME: 
	GRS_RESP

 PURPOSE:
	This procedure computes the X-ray response of the two x-ray detectors included
	in the SMM GRS instrument.
 CATEGORY:
	SMM, GRS

 CALLING SEQUENCE:
	GRS_RESP,  EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, $
		AREA=AREA, DRM=DRM

 CALLS: ***
	F_DIV, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], curdir [1], curdir [2]
	edge_products
 KEYWORDS:
	EDGES_OUT- Energy channel edges in keV.
	EDGES_IN - Photon input energies for DRM in keV.
	DRM - detector response, counts/sec/cm2/keV per photon/keV/cm2.
	AREA - 317 cm^2
 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	The database file, grsmatrix.dat, must exist on SSWDB_SMM or the current directory.

 PROCEDURE:
	The response function was compiled from the GRS ANATOT procedure.

 MODIFICATION HISTORY:
	Version 1, RAS, 26-Mar-1997


GRS_USER_STR $SSW/smm/grs/idl/grs_user_str.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GRS_USER_STR
               
 Purpose     : This function returns the data structure of the GRS User format.
		The structure holds 2900 bytes.
               
 Category    : SMM, GRS
               
 Explanation : This is the structure of the 2900 byte GRS UNH "user-format."  It is
		used for all but low-power records of the GRS data files which
		have names ending in ".USE"  Adapted from GRS user's guide.
               
 Use         : Structure = GRS_USER_STR()
    
 Inputs      : 
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : OFFSET    - Time offsets in a GRS Main Frame for the various grs
		data quantities.

 Calls       :
 CALLED BY:
	GRS_EXTRACT, GRS_LIGHTCURVE
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  : Taken from code in READ_HTR.PRO, VAXACCUM.FOR, HTRPARAM2.FOR 

 Modified    : Version 1, RAS, 18-Mar-1997
		


GRS_XRAY_RESP $SSW/smm/grs/idl/grs_xray_resp.pro
[Previous] [Next]

 NAME: 
	GRS_XRAY_RESP

 PURPOSE:
	This procedure computes the X-ray response of the two x-ray detectors included
	in the SMM GRS instrument.
 CATEGORY:
	SMM, GRS

 CALLING SEQUENCE:
	GRS_XRAY_RESP,  EDGES_OUT=EDGES_OUT, EDGES_IN=EDGES_IN, $
		AREA=AREA, DRM=DRM, WDET=WDET, [/X1  or /X2]

 CALLS: ***
	GRS_ENERGY, PULSE_SPREAD, RESP_CALC
 KEYWORDS:
	EDGES_OUT- Energy channel edges in keV.
	EDGES_IN - Photon input energies for DRM in keV.
	DRM - detector response, counts/sec/cm2/keV per photon/keV/cm2.
	X1  - if set, then only response for GRS X1
	X2  - if set, then only response for GRS X2
	WDET- an 8 element vector identifying the rows coming from detector 1 or 2

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	The physical description of both Xray detectors is analyzed for energy loss
	as a function of incident energy through RESP_CALC.PRO which is designed
	for detectors in the low hard X-ray energy range.

 MODIFICATION HISTORY:
	Version 1, RAS, 26-Mar-1997
	Version 2, RAS, 19-May-1997, divided drm by output energy widths!