LAD_2_SPEC $SSW/cgro/batse/idl/lad_2_spec.pro
[Previous] [Next]

  Name:
       LAD_2_SPEC


 PURPOSE: convert BATSE LAD direction cosines to BATSE SPEC cosines


 CATEGORY: CGRO/BATSE


 CALLING SEQUENCE:  cos_spec = lad_2_spec(cos_lad)


 CALLED BY:


 CALLS:
	none
 INPUTS:
       cos_lad - direction cosines for BATSE LADs

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 CALLED BY:
	PLOTBATSE_QL
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	RAS, 13-SEP-1995


LAD_DRM $SSW/cgro/batse/idl/lad_drm.pro
[Previous] [Next]

  Name:
       LAD_DRM


 PURPOSE: generate a BATSE LAD response matrix for direct interactions
	   for any direction cosine between 0.5 and 1.0, or up to 60 degrees
	   off of the detector axis.


 CATEGORY:  Spectral analysis, fitting.
       BATSE

 CALLING SEQUENCE: drm = lad_drm( cosine=cosine, chan_edges=chan_edges, $
			e_in = e_in [,filename=filename] $
			[,scatterfile=scatterfile])

 CALLS TO: x_eout_drm
	

 INPUTS:
       keywords:
		cosine - direction cosine to source with respect to LAD front
			 surface normal, default is cosine=0.0

		chan_edges - 2 by n array of low and high energy edges, keV
                            default is the edges of the data file, 100x100
		filename - if a filename is passed, this file is read instead
			   of the interpolated drm
	        scatterfile - name of file containing scatter matrix
			     will be added to the drm using add_scatter_drm
 OUTPUTS:
       keywords:
		e_in - 2 by m array of low and high energy edges for input
		       energy bins of incident photons, keV
               area - detector normal area, 2025 cm^2 for LAD

 CALLS: ***
	ADD_SCATTER_DRM, CHECKVAR [1], LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	READ_BDAS_DRM, X_EOUT_DRM [1], X_EOUT_DRM [2], checkvar [2]
 RESTRICTIONS: 0.5 < cosine < 1.0, This procedure is considered obsolete.

 PROCEDURE: values are interpolated from a stored table of 100x100x12
		output energies x input energies x cosines

 MODIFICATION HISTORY: ras, 24 Sept. 1993

               RAS, 7-Jul-1997, changed PERM_DATA to SSWDB_BATSE
	10-feb-1998, use loc_file to find because need translation of environmental
	without spawn in find_with_def,  richard.schwartz@gsfc.


LAD_PHA_EDGES $SSW/cgro/batse/idl/lad_pha_edges.pro
[Previous] [Next]
 Project     : SDAC

 Name        : LAD_PHA_EDGES

 Purpose     : This function returns the LAD PHA edges in keV for the indicated detector.

 Category    : BATSE

 Explanation : The nominal edges are calculated using the LESTRADE coefficients and
	the offsets computed by Rob Preece.

 Syntax      : edges = lad_pha_edges( det_id, ut)

 CALLED BY:
	CONT_EDGES, DISCLA_EDGES, Shers_load [1]
 Examples    :

 Inputs      : Det_id- detector id, 0-7
		Ut    - time in anytim format, used to obtain coefficients.
		Xvec - 2x128 linear channel edges

 Opt. Inputs :

 Outputs     :
		This function returns a 2X128 array of edges in keV.
	
 Opt. Outputs:

 Keyword Inputs: 
		NO_OFF- Return nominal LESTRADE edges without PREECE(MOD BY SCHWARTZ) offsets.
		PATH  - Find the "bin_offsets_det#.dat" files here.
 Keyword Outputs: 
		
 CALLS: ***
	FCHECK, GET_LAD_GAIN, GET_PENDLETON, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3]
	READ_SEQFILE, curdir [1], curdir [2], edge_products
 Common      :

 Restrictions:

 Side effects:

 History     : Adapted from SHERS_LOAD on 23-jul-1997, integrated with PREECE offsets.
		Version 2, richard.schwartz, 8-feb-1998, added LLD cutoff channel and energy.
		Version 2.1, 6-oct-1998, added protection on file search for bin offsets files.
		There may be two versions in the database for a detector, and that was causing
		problems that adding the wildcard should have fixed in the call to loc_file.
 Contact     : Richard.Schwartz@gsfc.nasa.gov


LAD_RESP $SSW/cgro/batse/idl/lad_resp.pro
[Previous] [Next]
 NAME:
	LAD_RESP

 PURPOSE:
	Return the count rate response of the LAD to a model spectrum
	based on angle and energy boundaries.

 CATEGORY:
	BATSE, SPEX

 CALLING SEQUENCE:
	LAD_RESP, Edges, Theta, Apar, Resp, SCALE=SCALE

 INPUTS:
	Edges: Lower and upper edge in keV for 1 channel.
		if more than 1 channel, should be an array [lo,hi] x Number_channels
	Theta: Angle between source and detector axis in degreees.
	Apar:  Parameters needed for spectral model function.
	
 KEYWORD PARAMETERS:
	MODEL: String name of spectral model, default, "F_BPOW"

 OUTPUTS:
   	Resp: Count rate in interval.

 CALLS: ***
	BATSE_LAD_DRM, CHECKVAR [1], CHKLOG [1], CHKLOG [2], CONCAT_DIR [1]
	CONCAT_DIR [2], CONCAT_DIR [3], EXIST, FCHECK, INTERPOL, PARCHECK, checkvar [2]
	concat_dir [4], edge_products
 COMMON BLOCKS:
	LAD_RESP:	edges_out, adrm, e_in, atheta, adrm, scale_save

 PROCEDURE:
	Builds a grid of response matrices, computes count rates, then interpolates.

 RESTRICTIONS:
	Edges should be between 10. and 2000. keV
 EXAMPLE:
	IDL> print,apar                           
   	0.00250560      2.12000     0.000000     0.000000
	IDL> discsp_resp, [5.,300],20.,apar, resp &print,resp
	      50.6533

 MODIFICATION HISTORY:
	ras, 10-oct-1996 adapted from discsp_resp
	ras, 16-dec-1996 fixed bug with edges intervals too small
       Version 3, RAS, 25-Jul-1997, changed PERM_DATA to SSWDB_BATSE


LISTQUAL $SSW/cgro/batse/idl/listqual.pro
[Previous] [Next]

 NAME: 
       LISTQUAL

 PURPOSE:

 Routine to read the quality file passed in argument 'file', and print
 it on the screen and in file qual.out, changing the times from day and
 seconds of day to our standard (more easily readable) yy/mm/dd,hhmm:ss


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	ATIME [1], ATIME [2], READQUAL
 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:
	file is read using readqual, then reformatted for output and display.

 MODIFICATION HISTORY:
 	Kim Tolbert 6/5/91
	Mod. 03/27/97 by RCJ. Fix structure reading.
	ras, 16-oct-1997, use the new readqual.


LIVETIME [1] $SSW/cgro/batse/idl/livetime.pro
[Previous] [Next]

  Name:
       LIVETIME

 PURPOSE: Return BATSE discriminator livetime fraction

 CATEGORY: Data reduction, analysis, time histories, spectroscopy
       BATSE
 CALLING SEQUENCE: fraction = livetime( countrate [,tau] )

 CALLS TO: Interpol

 INPUTS:
	Counts - Array of counts in first four DISCLA channels by time
		 organized nchan x nbin 

 OPTIONAL INPUTS:
	Tau       - gate recovery time per event
		  - default is value for .68e-6 seconds
                 - must be scalar or same number of elements as countrate
        det_id   - detector id (0-7)
 OUTPUTS:  livetime fraction

 CALLS: ***
	BATSE_DEADTM, CHECKVAR [1], DISCLA_EDGES, LIMITS, checkvar [2], edge_products
 CALLED BY:
	FDBREAD, FS_ACC, READ_DISCLA, READ_DISCSC
 PROCEDURE: Use BATSE_DEADTM to compute the livetime fraction for a
		counter with paralyzable and non-paralyzable components.

 MODIFICATION HISTORY: ras, 3 Sep 93
	fixed at low count rate, 26 Sep 93, ras
	Complete overhaul using BATSE_DEADTM and PARA_LIVETIME, 4 Dec 93, ras
       AES 94/07/12 changed comment about omni data - channel numbers have
       all been moved down, so old channel 1 is now channel 0


Livetime [2] $SSW/cgro/batse/idl/old_livetime.pro
[Previous] [Next]

 NAME:  Livetime

 PURPOSE: Return livetime fraction

 CATEGORY: Data reduction, analysis, time histories, spectroscopy
       BATSE
 CALLING SEQUENCE: fraction = livetime( countrate [,tau] )

 CALLS TO: Interpol

 INPUTS:
	Countrate - Counts/sec: Total counts / realtime second.

 OPTIONAL INPUTS:
	Tau       - Scalar or vector recovery time per event
		  - default is value for DISCLA, 1.1e-6 seconds
                 - must be scalar or same number of elements as countrate

 OUTPUTS:  livetime fraction

 CALLED BY:
	FDBREAD, FS_ACC, READ_DISCLA, READ_DISCSC
 PROCEDURE: Inverts the equation n*tau = r*tau exp(-(r*tau)) where
		r is the true rate, and n is the observed rate
		The livetime fraction is defined as n/r.  This algorithm
		only inverts one side of the equation which has two
		values of r for each value of n.

 MODIFICATION HISTORY: ras, 3 Sep 93
	fixed at low count rate, 26 Sep 93, ras


LLD_CHAN $SSW/cgro/batse/idl/lld_chan.pro
[Previous] [Next]

 NAME: 
	LLD_CHAN

 PURPOSE:
	This function returns the LLD channel in PHA space as a function of
	the commanded SLLD level for the BATSE SPEC detectors.

 CATEGORY:
	BATSE

 CALLING SEQUENCE:
        lld_chan( ut, ndet,  s=s, p=p, f0=lld_fid0, f1=lld_fid1)
	Channels = LLD_CHAN( Ut, Ndet )

 CALLS: ***
	CHECKVAR [1], GET_SLLD, checkvar [2]
 INPUTS:
       Ut - date in ANYTIM format
	Ndet - detector number

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORD INPUTS:
	SCHWARTZ- his fiducials
	PREECE  - his fiducials
	SKELTON - his fiducials
	f0  - preece fiducials
	f1  - schwartz fiducials
	f2  - skelton fiducials
	SPEC_LLD - 8 SLLD values from housekeeping. overrides date.
 CALLED BY:
	CALIBRATE [1], TEST_CAL
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	Use the SLLD/LLD linear relationship with the coefficients of choice.

 MODIFICATION HISTORY:
	Version 1, RAS, 26-Nov-1996
	Version 2, richard.schwartz@gsfc.nasa.gov, added SPEC_LLD keyword, 1-apr-1998.


Load_sher $SSW/cgro/batse/idl/load_sher.pro
[Previous] [Next]

 NAME: 
	Load_sher

 PURPOSE:
	Read SHER and SHERB into a single data structure, calibrate the
	energy scale, read the DRMs for a single chosen solar burst,
	correct for overflow, and convert to counts/sec/cm2/keV
	or optionally just calibrate and save calibration info

 CATEGORY: I/O
       BATSE

 CALLING SEQUENCE:
   	load_sher, flare=flare, detids=detids, rsher=rsher, $
	drm_sp=drm_sp, dsel=dsel, prob_dsel=prob_dsel, $
	drm_files = drm_files, sdrm_files= sdrm_files, sher_files=sher_files,$
	sherb_file = sherb_file

 INPUTS:
	flare - SDAC archive number
	detids - detectors to include in the calibration/accumulation
	sher_files - sher filenames
	sherb_file - sherb filename
	drm_files - direct drm filenames
	sdrm_files - scattering drm filenames
	/prob_dsel - return the probable detectors used in the memory accum.
	/auto	  - calibrate without interaction
	/noplot	  - no plotting in calibration run 	
 OUTPUTS:
	rsher - structure with sher and sherb spectra and time intervals      
       drm_sp- structure with response matrix
	dsel - IDs of the detectors in the memory (0-7)

 CALLS: ***
	ADD_SCATTER_DRM, ATIME [1], ATIME [2], BREAK_FILE [1], BREAK_FILE [2]
	BREAK_FILE [3], CHECKVAR [1], FDBREAD, F_DIV, READ_BDAS_DRM, REVERSE, Shers_load [1]
	Shers_load [2], TJD2YMD, UTIME [1], UTIME [2], X_EOUT_DRM [1], X_EOUT_DRM [2]
	anytim [1], anytim [2], anytim [3], anytim [4], anytim [5], batse_read_cat
	break_file [4], checkvar [2], edge_products, printx [1], printx [2]
 MODIFICATION HISTORY: 
	ras, 18-Nov-93


LOG_HDR_STRUCT $SSW/cgro/batse/idl/log_hdr_struct.pro
[Previous] [Next]

 NAME: 
       LOG_HDR_STRUCT

 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:


LOG_MENU $SSW/cgro/batse/idl/log_menu.pro
[Previous] [Next]

 NAME: 
       LOG_MENU

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	ALPHA_PAGE [1], ALPHA_PAGE [2], GRAPHICS_PAGE
 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:


LOG_STRUCT $SSW/cgro/batse/idl/log_struct.pro
[Previous] [Next]

 NAME: 
       LOG_STRUCT

 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: