G_C $SSW/cgro/batse/idl/g_c.pro
[Previous] [Next]
  Name:
       G_C
c*************************************************************************
     pro g_c,energy,light,dlight

c    This is a subroutine to find the light output from the NaI crystal
c    for a given energy. The light output is  determined by a spline fit
c    to a series of points off a "best eye line"  through the energy 
c    loss-light out graph (L/E vs. log10(E)) of the crystal for energies 
c    less than 720 keV. For larger energies, L/E is set equal to the 
c    value of the spline at 720 keV. The spline data is stored in scoeff.dat.
c    Input:
c       energy--energy incident on the crystal, assumed to be an
c	           ascending vector in keV
c    Output:
c       light--Light emitted/energy normalized to 511 keV
c       dlight--d(light)/d(energy)
     Optional Output:
	light2 - light output with severe dip above 34 keV, 
		 The severe dip was removed from light and dlight so the
		 expression could be inverted.
c    written 10/16/91            last modified 12/6/91      LAF

c***************************************************************************
               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE
 CALLS:
 CALLED BY
	BATSE_SPEC_DRM, FCRYSTAL, FCRYSTAL1, GAIN_COR, HXT_CAL_DRM [1], HXT_CAL_DRM [2]


GAIN_COR $SSW/cgro/batse/idl/gain_cor.pro
[Previous] [Next]
  Name:
       GAIN_COR
c ****************************************************************************
c       pro gain_cor,ndet,nlines,chan,en,a,b,c,x0

c      Subroutine to calculate gain corrected coefficients for the calibration
c     equation. The fiducial  coefficients are read from the  file FCOEFF.DAT.
;c     Inputs:
c        ndet--detector number
c        nlines--number of lines used to calibrate
c        chan--vector of locations of lines in uncompressed channels
c        en--vector of locations of lines in energy

c     Outputs:
c        a,b,c,x0--coefficients used in calibration equation:
c
c           E*g_c = a + b*x + c*(x-x0)**2*H(x0-x)
c
c        where H(x0_x) is the Heaviside function and x is channel number.
c
c     written 11/8/91              last modified 12/6/91       LAF
c	ras, 28-mar-95
c*****************************************************************************
c
      
     
 CALLS:
 CALLED BY
	CALIBRATE [1], TEST_CAL


GAP_FILE $SSW/cgro/batse/idl/gap_file.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME: 
       GAP_FILE

 PURPOSE:
 GAP_FILE created and updates a file containing all times when BATSE
 was collecting data, i.e. the file is a record of data gaps (but it is
 good intervals that are recorded, not the gap intervals).  The gap 
 file has the following format:
    header record - bytes 0-7:   latest time in seconds since 79/1/1,0
                    bytes 8-11:  spare
                    bytes 12-15: number of data records following header
    data records  - bytes 0-7:   start time of observing interval
                    bytes 8-15:  end time of observing interval
 GAP_FILE reads the header record to determine start time, then opens
 each BDB file from that day up to and including the end day specified 
 in the calling argument, recording time intervals for which there is data.
 Gaps of less than one minute are ignored.

 This gap file must be updated in time order.
 Can be killed anytime, and the good intervals from the last bdb file 
 it finished will be recorded (after each bdb file, it writes the good 
 intervals, and rewrites the header record).


 CATEGORY:
       BATSE, CATALOG, DATABASE

 CALLING SEQUENCE:


 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], CONV_VAX_UNIX, GAP_FINDER
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], OS_FAMILY, TIME2FILE, USE_VAX_FLOAT
	UTIME [1], UTIME [2], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	concat_dir [4]
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	9-dec-1996, can only be used on SDAC to write new gap file

 PROCEDURE:
	none

 MODIFICATION HISTORY:
 Kim Tolbert  5/18/92
 RAS, 9-dec-1996, gap_file.dat converted to stream file for unix compatibility
 Version 3, richard.schwartz@gsfc.nasa.gov, 22-oct-1997.
	now uses read_dd to read the bdb file eliminating common block
	sec_array formerly in gap_file and gap_finder
 Version 4, richard.schwartz@gsfc.nasa.gov, 23-oct-1997.
	subtract 10 seconds from last 10 to be sure we're not crossing
	two day boundaries.
 Version 5, richard.schwartz@gsfc.nasa.gov, 24-jun-1998, forced old VAX float format on write.
 Version 6, richard.schwartz@gsfc.nasa.gov, 21-mar-2001, use SSWDB_BATSE for gap_file.dat


GAP_FINDER $SSW/cgro/batse/idl/gap_finder.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME: 
       GAP_FINDER

 PURPOSE:
 GAP_FINDER finds the time intervals for which there is data within
 a BDB file.  Gaps of less than 1 minute are ignored.


 CATEGORY:
       BATSE

 CALLING SEQUENCE:
       gap_finder, bdbfile, fileend, goodtimes, count

 CALLS: ***
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], read_dd
 INPUTS:
   bdbfile - input, bdb file name (without the BATSE_DATA part)

 OPTIONAL INPUTS:
	none

 OUTPUTS:
  fileend - output, end time of file in r*8 seconds relative to 79/1/1,0
   goodtimes - output, array of r*8 seconds relative to 79/1/1,0 giving
               the start and end of the good intervals.  Dimensioned
               (2,count)
   count - number of time intervals in array goodtimes

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 CALLED BY:
	GAP_FILE
 COMMON BLOCKS:
	sec_array

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
 Kim Tolbert  5/18/92
 Version 2, richard.schwartz@gsfc.nasa.gov, 22-oct-1997.
	now uses read_dd to read the bdb file.
 Version 3, richard.schwartz@gsfc.nasa.gov, 24-oct-1997.
	adjusted start and end of good times to real acc. edges. and
	fixed final record bug.


GEN_INDICES $SSW/cgro/batse/idl/gen_indices.pro
[Previous] [Next]

 NAME: 
       GEN_INDICES

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS:
	none
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:


GET_BATSE_POINTING $SSW/cgro/batse/idl/get_batse_pointing.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME: 
	GET_BATSE_POINTING

 PURPOSE:
	This procedure extracts the GRO attitude from a database file
	and returns the Z and X axis directions in degrees.
 CATEGORY:
	BATSE

 CALLING SEQUENCE:
	GET_BATSE_POINTING, date, zxradec

 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], anytim [1], anytim [2], anytim [3]
	anytim [4], anytim [5]
 INPUTS:
       date - Time readable by ANYTIM

 OPTIONAL INPUTS:
	none

 OUTPUTS:
 	Zxradec - GRO Z and X axis pointing in degrees.
	[Z ra, Z dec, X ra, X dec]

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	UT_OFF-Time of change in pointing within 1 orbit
 CALLED BY:
	GRO_POINT, OCC_FROM_FITS
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	Database file is only accurate to whole days, but spacecraft is
	pointed during the day.

 PROCEDURE:
	Uses database in SSWDB_BATSE, gro_pointing_cycle6.dat

 MODIFICATION HISTORY:
	RAS, 15-apr-1996
	RAS, 18-dec-1996, updated to gro_pointing_cycle6.dat, and finds
	time in day of pointing change
               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE
	VERSION 5, 17-aug-1997, changed default path to BATSE_DATA, 
		richard.schwartz@gsfc.nasa.gov


GET_DISCSP511 $SSW/cgro/batse/idl/get_discsp511.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME:
	GET_DISCSP511

 PURPOSE:
	Return linear channel number of the 511 line for a given time for
	the 8 BATSE detectors.  Returns value of 0. for times and channel
       if error.

 CATEGORY:
	BATSE, SPEC, calibration

 CALLING SEQUENCE:
	get_discsp511, intime, times, chans

 METHOD:
	Reads one of two databases of BATSE SPEC calibration lines:

	1.Reads compacted calibration line database. From calib_line files
	created at MSFC with fitted channel number for 511 keV line sampled
	several times per orbit for each detector.  Data has been filtered,
	smoothed, and compacted before entering secondary database in perm_data.
	If the time requested is beyond the end of the file, then database 2 is used.

	2.Extracted from IBDBs submitted to GSFC BSAS Processed Data Base
	Reads an ASCII file created by the routine mk_discsp_cal.  The file
	contains a time and the linear channel numbers for 8 detectors on
	each line.  mk_discsp_cal creates this file from a file created by 
	Sandhia.  The file will have to be updated at regular intervals 
	to contain the latest information.
	Each line may not contain information for every detector. For each
	detector, GET_DISCSP511 finds the closest time that is before the
	requested time that contains non-zero information for that det.
	If there is no calibration data within the gain interval, then
	the database is searched for the closest calibration data within
	a common gain interval

 INPUTS:
	Intime - Time to retrieve 511 line channels for in standard 
		"anytim" format seconds since 79/1/1.  
		GET_DISCSP511 will find the closest 
		time in the file that is after INTIME in method 2
		while in method 1, the closest time before the requested
		one is used.
		If INTIME is before start of file, earliest data in file
		will be returned.  If after last time of file, last data
		will be returned.

 KEYWORDS:
	BSASPDB - use database assembled from BSAS PDB, line numbers for
		  triggered events corresponding to the gain record.
	DET_ID  - Just return the calibration line for this SPEC DET ID.
	LASTTIMESTOP - If set and time entered after the BSASPDB and compressed 511 line
	databases then set error flag and return zeroes.
		  

 OUTPUTS:
	Outtimes - Times associated with the data returned
	Outchans - Linear channel number of the 511 line for 8 detectors
	

 SAMPLE CALL:  get_discsp511, '92/4/5,1200', times, chans

 CALLS: ***
	AVG [1], AVG [2], CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FCHECK
	GET_SPEC_GAIN, RD_BATSE_511CAL, READ_SEQFILE, TJD2YMD, UTIME [1], UTIME [2]
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], concat_dir [4]
 CALLED BY:
	BATSE_SPEC_GAIN_FDB, CAL_SHER, DISCSP_EDGES
 MODIFICATION HISTORY:
	Written:  Kim Tolbert  11/29/93
	Mod:      ras, 18-jan-94 changed requirement to select values
		                 after the input time.
       ras, 13-aug-95, increased search range for calibration line data
	ras, 30-nov-95, make calib_line database the default database
	ras, 29-dec-95, allow optional search for 1 detector values
	ras, 15-apr-96, make sure it uses bsaspdb when necessary
       RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE
	ras, 14-sep-1997, made routine more robust past the normal database.
	richard.schwartz@gsfc.nasa.gov, 30-mar-1998. added LASTTIMESTOP


GET_HXP $SSW/cgro/batse/idl/get_hxp.pro
[Previous] [Next]
 Project     : SDAC
                   
 Name        : GET_HXP
               
 Purpose     : This function returns the hxrbs password on umbra. 
               
 Category    : CGRO/BATSE 
               
 Explanation : It opens a read protected file.
               
 Use         : 
    
 Inputs      : 
               
 Opt. Inputs : None
               
 Outputs     : None

 Opt. Outputs: None
               
 Keywords    : 

 Calls       : ***
	OS_FAMILY
 CALLED BY:
	CREATE_GIF_HTML, CREATE_HTML, DO_ARCHIVEPLOTS, DO_PSPLOTS, FS_AUTO_LOG, MAIN_HTML
	batse_create_html, batse_sea_html
 Common      : None
               
 Restrictions: Must have read permission on vms, 3-dec-1997.
               
 Side effects: None.
               
 Prev. Hist  : 

 Modified    : 
	Version 1, richard.schwartz@gsfc.nasa.gov, 3-dec-1997.


GET_LAD_GAIN $SSW/cgro/batse/idl/get_lad_gain.pro
[Previous] [Next]
  Name:
       GET_LAD_GAIN

	for a date ut (sec sinc 79/1/1) return the lad gain
	coefficients for all eight detectors for the times
	closest to the input time. Extracted from perm_data:lad_gain.dat,
	the values are chosen for the event immediately preceding the
	time passed in ut.
	out_coef - 3x8 array of lad gain coefficients
	outtime  - 8 element array of times for each set of coefficients
	 	   seconds since 79/1/1
	ras, 9-feb-94
               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE
 CALLS:
 CALLED BY
	LAD_PHA_EDGES


GET_OCC_ONDAY $SSW/cgro/batse/idl/occults/get_occ_onday.pro
[Previous] [Next]

 NAME: 
       GET_OCC_ONDAY

 PURPOSE:
       Finds all the occultation times with good data on the input DATE for
       the input source location.

 CATEGORY:
	BATSE, OCCULTS

 CALLING SEQUENCE:
	get_occ_onday, date,  inradec=inradec, occout=occout, det_id=det_id	

 CALLS: ***
	CHECKVAR [1], CRAB_OCC_STR, DATATYPE [1], DATATYPE [2], DATATYPE [3], FCHECK
	FIND_GOOD_OCCS, OCC_FILETYPE, READ_OCC_DISCSP, anytim [1], anytim [2], anytim [3]
	anytim [4], anytim [5], checkvar [2]
 INPUTS:
       Date - Time in format readable by ANYTIM.

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	INRADEC- RA and DEC in degrees for source, J2000, [RA, DEC]
		default is the Crab ([83.516, 22.0197])
	OCCOUT - Structure array with information on each valid occultation.
	OCC_STR- structure for readout, default is structure for DISCSP
Must have these tags:
   UT_OCC:0.0d0  , $            ;time of occultation (by occ_time.pro        
   DAYNIGHT:0L      , $         ;0 for enter into crab night, 1 for enter into crab day
   DET_ID:0L        , $         ;SPEC detector id, 0-7 
   START_TIME:0.0d0 , $         ;valid interval start time  
   END_TIME:0.0d0  , $          ; valid interval end time  
   ZRADEC:fltarr(2) , $         ;gro z-axis ra and dec (degrees)        
   XRADEC:fltarr(2), $          ;gro x-axis ra and dec (degrees)
	UT_OCCS - Time of occultations for daily file, in seconds.
	OCC_TYPE- type of occultation 1 entering day, 0 entering night
 CALLED BY:
	MORE_OCCULTS
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	DISCSP AND HKG data must be online for date.	

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	Version 1, ras, August 1995


GET_OCCS $SSW/cgro/batse/idl/occults/find_good_occs.pro
[Previous] [Next]
 Project     : SDAC    
       	            
 Name        : GET_OCCS 
	               
 Purpose     : This procedure takes the spacecraft ephemeris in celestial coordinates
		and the source position to generate a visibility curve.  It finds the
		transitions, i.e. occultations, and determines the direction,
		becoming visible for day and blocked for night, and returns the
		the times and types of the occultations where the telemetry is good.
		
               
 Category    : BATSE, OCCULTATION
               
 Explanation : 
               
 Use         : 
    
 Inputs      : SC- spacecraft ephemeris in cartesian celestial coordinates, Nx3
		UT- Time in UT, seconds from 1-jan-1979, dblarr(N)
		INRADEC- Source RA and Dec in degrees
		MMASK- Telemetry quality mask, 1 is valid, 0 is bad.
               
 Opt. Inputs : None
               
 Outputs     : UT_OCCS  - Array of valid occultation times
		OCC_TYPE - Type of occultation, 1 for day, 0 for night
		SC_OCC   - Spacecraft coordinates at UT_OCCS

 Opt. Outputs: None
               
 Keywords    : ERROR- Returns 1 if no valid occultations in interval passed.

 Calls       : ***
	CHECKVAR [1], FIND_GOOD_OCCS, INTERPOL, OCC_PROFILE, ORBIT_FILL, READ_OCC_DISCSP
	SPHCART, anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], checkvar [2]
 CALLED BY:
	FIND_GOOD_OCCS
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : Documented RAS, 2-Jan-1997
	


GET_PENDLETON $SSW/cgro/batse/idl/get_pendleton.pro
[Previous] [Next]
  Name:
       GET_PENDLETON
	
 PURPOSE: 
	Returns the value in the CONT_EDGES_COM common block
	set by the SET_PENDLETON procedure.

 CATEGORY:
	BATSE	
 CALLING SEQUENCE:  value = get_pendleton()
	
 INPUTS:
	None
 OPTIONAL INPUTS:
	
 OUTPUTS:

 OPTIONAL OUTPUTS:

 CALLED BY:
	LAD_PHA_EDGES, read_batse_4_spex [1], read_batse_4_spex [2]
 PROCEDURE:
	Reads the common block and returns the value.  O means use Lestrade
	edges, 1 use Pendleton Edges., 2 use Lestrade with Preece modification.
 CALLS: ***
	SET_PENDLETON
 COMMON BLOCKS:
	cont_edges_com
 RESTRICTIONS:

 MODIFICATION HISTORY:
	richard.schwartz@gsfc.nasa.gov, 23-jul-1997
	Version 1, RAS


GET_PRAT_TCOUN $SSW/cgro/batse/idl/get_prat_tcoun.pro
[Previous] [Next]

 NAME: 
       GET_PRAT_TCOUN

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	Aluminum, GETUTBASE [1], GETUTBASE [2], POLY, POLY_FIT
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 CALLED BY:
	FS_AUTO_LOG
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:


GET_SLLD $SSW/cgro/batse/idl/get_slld.pro
[Previous] [Next]

 NAME: 
	GET_SLLD

 PURPOSE:
	Find the SPEC LLD values from the database closest to the input time.

 CATEGORY:
	BATSE

 CALLING SEQUENCE:
        sllds = GET_SLLD( Ut )

 CALLED BY:


 CALLS: ***
	LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], READ_SEQFILE, UNIQ [1], UNIQ [2], UNIQ [3]
	UTIME [1], UTIME [2], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
 INPUTS:
       Ut - time in ANYTIM format

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       The result is 
	Sllds - The SPEC LLD for each of the 8 BATSE SPECs

 OPTIONAL OUTPUTS:
	Ut_slld - returns the time (anytim format) and slld's in a structure
	with tags UT and SLLD

 CALLED BY:
	CAL_SHER, DISCSP_EDGES, LLD_CHAN, Shers_load [1]
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:

	for a date ut return the 8 spec lld values
	for the event.  Extracted from perm_data:batse_slld.dat,
	the values are chosen for the event immediately preceding the
	time passed in ut.

 MODIFICATION HISTORY:
	fully revised, ras, 27-dec-1995
	ras, 2-jan-1996, revised to use batse_slld2.dat
	ras, 2-dec-1996, added ut_slld output structure
               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE


GET_SPEC_CAL $SSW/cgro/batse/idl/get_spec_cal.pro
[Previous] [Next]
 NAME:
	GET_SPEC_CAL

 PURPOSE:
	Return linear channel number of the 511 line for a given time for
	the 8 BATSE detectors as well as width64 values.  Obtained by
	active calibration using LOAD_SHER, ...,/just_cal.
	Values are loaded into the file using the write keyword.
	If the intime is equal to an existing time, the existing
	values are overwritten and a message is issued.

 CALLING SEQUENCE:
	get_spec_cal, intime, times, chans, widths [,/write]

 CALLS: ***
	ATIME [1], ATIME [2], CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], READ_SEQFILE
	UTIME [1], UTIME [2], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	concat_dir [4]
 RESTRICTIONS:
	Reads an ASCII file loaded using the routine load_sher.  The file
	contains a time and the linear channel numbers and the value of
	width64 for 8 detectors on
	each line.  The file will have to be updated at regular intervals 
	to contain the latest information.
	Each line may not contain information for every detector. For each
	detector, GET_SPEC_CAL finds the closest time that is before the
	requested time that contains non-zero information for that det.

 INPUTS:
	INTIME - Time to retrieve 511 line channels for in string format or
		seconds since 79/1/1.  GET_SPEC_CAL will find the closest 
		time in the file to INTIME.  If there is no time within
		5000 seconds, a complaint message will be issued.
		If INTIME is before start of file, earliest data in file
		will be returned.  If after last time of file, last data
		will be returned.

	Optional - /write 
		New values are written into the table
 OUTPUTS:
	TIMES - Times associated with the data returned
	CHANS - Linear channel number of the 511 line for 8 detectors
	WIDTHS- WIDTH64 for each detector

 SAMPLE CALL:  get_spec_cal, '92/4/5,1200', times, chans, widths

 MODIFICATION HISTORY:
	Written:  RAS, 1-dec-93

               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE


GET_SPEC_GAIN $SSW/cgro/batse/idl/get_spec_gain.pro
[Previous] [Next]
 NAME:
	GET_SPEC_GAIN

 PURPOSE:
	Return the gain command value and date for the 8 BATSE detectors.
       If error, gain and date are returned as 0.

 CALLING SEQUENCE:
	get_spec_gain, intime, times, gain [, det=det ]

 CALLS: ***
	CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FCHECK, PARSE_COMLINE
	READ_SEQFILE, TJD2YMD, anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	concat_dir [4]
 CALLED BY:
	BATSE_SPEC_GAIN_FDB, CAL_SHER, DET_COSINES, FS_ACC_DISCSP, GET_DISCSP511
	RESOLVE_NEW_OBS
 RESTRICTIONS:
	Reads an ASCII file created from data extracted from the MSFC
	BATSE INGRES database.  The file
	contains a command time and gain value for 8 detectors on
	each line.  The file is created by Chip Meegan and the
	information must be updated by hand to contain the latest information.
	Each line containsinformation for only one detector. For each
	detector, GET_SPEC_GAIN finds the closest time that is before the
	requested time that contains information for that det.

 INPUTS:
	INTIME - Time to retrieve 511 line channels for in string format or
		seconds since 79/1/1.  GET_SPEC_GAIN will find the closest 
		time in the file that is before INTIME.
		If INTIME is before start of file, earliest data in file
		will be returned.  If after last time of file, last data
		will be returned.
		if intime is a time interval, then "times" is returned
		as the start of the interval, followed by the time of any gain changes,
		and gain is given for each of "times" for the specified detector (def=0)
       DET    - optional, if used then the outputs will be changed, and gain
		is interpreted as an input value, intime is ignored.
		returns the times for all intervals (2xn) for detector DET
		for the specified gain value 
 OUTPUTS:
	TIMES - 2x8 array of start/end times associated with the data returned
	        if time is beyond last time in the data file of gains, last time
		returned will be 1-jan-2010, beyond projected lifetime of BATSE mission
	GAIN  - Hex gain value, e.g. 0.4, 1.0, 4.0, 5.0, 7.0, 8.0
	

 SAMPLE CALL:  get_spec_gain, '92/4/5,1200', times, gain

 MODIFICATION HISTORY:
	Written:  ras, 18-jan-94
	Mod. AKT 1/25/94. Made output array TIMES 2x8 to return range of times,
          also return 0 value if time not in range.
	mod. ras, 21-feb-94, return values if after last entry in file, fixed bug
	mod. ras, 11-jul-94, read new format of gain file
	ras, 19 jun 1995, eliminated null lines
	ras, 13 aug 1995, added capability to retrieve all gain intervals,X, for a detector I
	ras, 14 aug 1995, added capability to retrieve all gain intervals within a time interval
		for a particular detector
	ras, 8 sep 1995, data file is parsed line by line using parse_comline
		because of danger in str2arr
	ras, 18-oct-1995, made the parsing more robust, can be blanks at start of line
               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE


GET_TRIG $SSW/cgro/batse/idl/get_trig.pro
[Previous] [Next]

 NAME: 
       GET_TRIG

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	ALPHA_PAGE [1], ALPHA_PAGE [2], CHECKVAR [1], batse_read_cat, checkvar [2]
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 CALLED BY:
	FS_ARCHIVE_DRAW, FS_GRAPH
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:


GET_W64 $SSW/cgro/batse/idl/get_w64.pro
[Previous] [Next]
  Name:
       GET_W64
 w64 = get_w64( sher )

 Input - Sher - raw sher rates, not divided by channel widths.
 Output - W64 - extra width in channel 64 in 16th channel units

w64 is the width of channel 64 (0-64) of the BATSE SPECs
It is arbitrary and ranges from 1 to 2 linear channels in steps of 1/16
The width is found by taking the value of the number of steps which
best satisfies continuity in the derivative of the count rate/wrt channel.

 CALLED BY
	CAL_SHER


GETFLARE $SSW/cgro/batse/idl/getflare.pro
[Previous] [Next]

 NAME: 
       GETFLARE

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	CHECKVAR [1], PARSE_ATIME [1], PARSE_COMLINE, REVERSE, UTIME [1], UTIME [2]
	batse_read_cat, checkvar [2], parse_atime [2]
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:


goesdata $SSW/cgro/batse/idl/goesdata.pro
[Previous] [Next]
 Make hardcopies of the four GOES plots and event listing for the day in
 bdbfile.  GOES plots are on SELVAX::SYS$USERROOT:[MAX91] in files
 named, for example, 
   07jul91a_xr.plot    plots of xray data
   07jul91a_xrop.plot  plots of xray data and optical identification display
 a,b,c,d refer to the four 6 hour intervals in a day.
 We normally want the xrop plots.  To get the xr plots, pass the keyword
 parameter /xr.
 Calling arguments: 
   bdb_file - (input) name of bdb_file containing day we want GOES plots for
   xr       - (input) =1 means get the xr plots, not the xrop plots.

 Kim Tolbert  4/91
 Modifications:
	3/27/95 Amy Skowronek - Radically modified.  Data now being
	anonymously ftp'd from unix machine ftp.sel.noaa.gov.  Instead of
	DECNET copy, write ftp script, execute through spawn, and then
  	rename files through spawn.
	10/2/95 AES - changed address to nascom domain
       Version 4 AES GSFC/SDAC 16-oct-1997 Only get daily events list
	from noaa.  Create goes tek plots here from GOES fits files.
       Also change format of goesdate - noaa now names files 
       yymmdd_events.text
       Version 5 AES GSFC/SDAC 10-dec-1999 changed noaa address from
       sel to sec domain.
 CALLS:


GRAB_DISCSP_HKG $SSW/cgro/batse/idl/occults/grab_discsp_hkg.pro
[Previous] [Next]

 NAME: 
       GRAB_DISCSP_HKG

 PURPOSE:
       The purpose of this main program is to extract needed discsp and hkg
        data from the BATSE jukebox at MSFC

 CATEGORY:
       BATSE, OCCULTS

 CALLING SEQUENCE:


 CALLS:
	none
 INPUTS:
       Controlled through a file called 'occ_process.dat' with variables (e.g.):
% RESTORE: Restored variable: JBOX_INFO.
% RESTORE: Restored variable: STJD.
% RESTORE: Restored variable: ETJD.
ETJD            INT       = Array(33)
JBOX_INFO       STRUCT    = -> JUKEBOX Array(33)
STJD            INT       = Array(33)
;
** Structure JUKEBOX, 2 tags, length=8:
   SIDE_AB         INT       Array(2)	;0 or 1 for  A devices (set dua%) or B (set duab%)
   START_END       INT       Array(2)	;tjd of first and last daily data set on platter


 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	The Jbox is mounted, files are extracted and copied to OUT_DIR

 RESTRICTIONS:
 	VMS specific.  Designed to extract data from the jbox at
	MSFC to SDAC directories.	The logical 'out_dir' must be
	defined and point to a specific directory.

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	Version 1 , ras august 1995


GRABDATA $SSW/cgro/batse/idl/grabdata.pro
[Previous] [Next]
  Name:
       GRABDATA
 this routine was used to grab all of the cont and discsp data from the
 jukeboxes at Marshall for all of the flares we have till now (4358).
 It tries to do all the flares that are on one of their optical disks
 at a time, and then moves to the next optical disk.  After each o.d. it
 copies the files it makes to SDAC.  On SDAC a job was continually running
 that looked for these files and created our cont and discsp files from
 them (by merging the pointing info from the FDB files with them).
 To keep up with new flares, we will run ?
 Kim Tolbert 2/94
 CALLS:


GRABFLARE $SSW/cgro/batse/idl/grabflare.pro
[Previous] [Next]
  Name:
       GRABFLARE
 This procedure is run on node SDAC from MSFC to extract continuous
 and discsp data from their jukebox for flares in the SDAC BATSE
 archive that have FDB files, but no corresponding cont and discsp
 file.  It finds a list of needed flares from SDAC.  For each needed 
 flare, it selects a time interval from 2 minutes before the earliest 
 flare or background to 2 minutes after the latest (times are found by 
 reading the BATSE flare catalog on SDAC over the network from GIBSON),
 and runs QAA to extract that time interval.  It then renames the files
 (QAA names them continous_data.dat and discsp_data.dat) to 
 flare_xxx.cont_msfc and flare_xxx.discsp_msfc and copies them to SDAC, 
 then deletes them from GIBSON.

 Kim Tolbert 3/94  (original)

  Modified 9/21/94 Amy Skowronek:  Now accepts list of flares we need,
  copied over from SDAC.  Added keywords for seconds of background wanted
  before and after flare.  Standard is 120 seconds.  If more is desired,
  for instance five minutes before, then add keywords before=180.d0, 
  after=180.d0 
   example call:  grabflare, before=120.d0, after=120.d0  
  This calls grabflare with a total of four minutes of data on either side
  of the flare.  Must be in xxx.dx format.
  Modified 1/4/95 by AES copies previous log to sdac rather than current,
  because current log is open by user.
  Mod 3/21/95 by AES corrected documentation to reflect the fact that
  the routine is run from SDAC, rather than from GIBSON.  
  Mod 4/3/95 by AES - included alternate statements to use pscratch
  space on gibson, rather than giscratch space, for when giscratch is
  full.  routine check_disk now checks animaldsk1, and if it's not
  working right, for whatever reason, assigns usrdk9 to the diskname
  instead.
  11-oct-1995, ras, get passwords from environment variables
  needed software installed on gibson for speed


GRABTIME $SSW/cgro/batse/idl/grabtime.pro
[Previous] [Next]
  Name:
       GRABTIME
 pro grabtime

 This procedure is run on node SDAC from MSFC to extract continuous
 and discsp data from their jukebox for requested time intervals.
 For each interval it runs QAA to extract that time interval.  It then 
 renames the files
 (QAA names them continous_data.dat and discsp_data.dat) to 
 yymmdd_hhss.cont_msfc and yymmdd_hhss.discsp_msfc and copies them to SDAC, 
 then deletes them from GIBSON.

  Grabtime gets requested time intervals from file times.tmp, which
  must be copied over to gibson before grabtime is run.
  file should be in format:
  yy/mm/dd,hh:mm:ss  yy/mm/dd,hh:mm:ss
  yy/mm/dd,hh:mm:ss  und so weiter..
  First time on the line is the beginning time of requested interval,
  second time on the line is the ending time of requested interval
  up to 100 intervals.

  Alternatively, grabtime may be run with the begintime and endtime
  keywords, in the same format.

 Example calls:

  grabtime                  (if times.tmp exists)

  grabtime, begintime='92/04/05,04:30:00', endtime='92/04/05,05:30:00'



 Kim Tolbert 3/94  (original)
 Amy Skowronek 5/95 (modified from grabflare.pro)
  Modified 1/4/95 by AES copies previous log to sdac rather than current,
  because current log is open by user.
  Mod 3/21/95 by AES corrected documentation to reflect the fact that
  the routine is run from SDAC, rather than from GIBSON.  
  Mod 4/3/95 by AES - included alternate statements to use pscratch
  space on gibson, rather than giscratch space, for when giscratch is
  full.  routine check_disk now checks animaldsk1, and if it's not
  working right, for whatever reason, assigns usrdk9 to the diskname
  instead.
  Mod 5/8/95 by AES from grabflare to get specified time intervals, ignoring 
  where flares may be.
  Mod 5/15/95 by AES to copy files directly to batse_cont_time, etc,
  rather than to batse_cont                    
  11-oct-1995, ras, get passwords from environment variables
  needed software installed on gibson for speed
 CALLS:


GRO_POINT $SSW/cgro/batse/idl/gro_point.pro
[Previous] [Next]

 NAME: 
	GRO_POINT

 PURPOSE:  
	Returns the LAD and SPEC direction cosines to any
	source as a function of the spacecraft attitude


 CATEGORY: 
	BATSE


 CALLING SEQUENCE: gro_point, inzxradec, inradec, cos_lad, cos_spec


 CALLED BY: 


 CALLS: ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3], F_CROSSP, GET_BATSE_POINTING, SPHCART
 INPUTS:
	Inzxradec - the GRO Z and X axis ra and dec in degrees
		    [Zra,Zdec,Xra,Xdec]
	or inzxradec in direct integer format in BATSE housekeeping data
	see MSFC_HKG_STR.PRO
	If Inzxradec is a string, then get_batse_pointing is used
	to extract the GRO attitude from a database file with 1 day
	accuracy.
	Inradec   - [Source_ra, Source_dec] in celestial coord., degrees

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       Cos_lad - 8 detector cosines for BATSE LADs
	Cos_spec- 8 detector cosines for BATSE SPECs

 OPTIONAL OUTPUTS:
	NONE
 KEYWORDS:
	ERROR- set for bad input type.
	INZX - return the GRO Z AND X axis pointing in ra and dec in degrees
 CALLED BY:
	OCC_AVG, OCC_FROM_FITS, PICK_POINTING, Pointing_Change, READ_DISCLA
	RESOLVE_NEW_OBS, spex_batse_preview [1], spex_batse_preview [2]
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	Convert to Cartesian coordinates and use vector algebra to solve.

 MODIFICATION HISTORY:
 	ras, 26-jun-1992
	ras, 26-dec-1995, accepts vector (4xn) input for inzxradec


GROUP_INTERVALS $SSW/cgro/batse/idl/group_intervals.pro
[Previous] [Next]

 NAME: 
       GROUP_INTERVALS

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS:
	none
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 CALLED BY:
	DET_POINT
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY: