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

 PURPOSE:
	This function reports the SPEC DISCSP edges using a 2nd order fit to the
	reported high voltage in the BATSE SPEC detectors.

 CATEGORY:
	BATSE

 CALLING SEQUENCE:
	edges = edges_hvspec( arg )

 CALLS: ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3], DISCSP_EDGES, FS_OPEN [1], FS_OPEN [2]
	HKG_MODULE, LOC_FILE [1], LOC_FILE [2], LOC_FILE [3], PATH_DIR, POLY, SYS2UT
	TAG_EXIST [1], TAG_EXIST [2], rd_tfile [1], rd_tfile [2], read_dd
 INPUTS:
       Arg - As an structure with two tags, HV and SLLD, or N511 and SLLD, each integer vectors 
		with 8 elements, interpreted as the HighVoltage and SPEC LLD for the SPECs from the
	      module housekeeping data and table.See HKG_MODULE.PRO
	      Or the two tags can be N511, an 8 element fltarr,  the position of the 511 line 
	      in linear channel space and SLLD.
	      As a structure, with tags FILE, START, ENDT, used as input to read_dd.
	      As a scalar integer, interpreted as a flare number for which an fdb file should exist.
	      As a string, first interpreted as a file name, for input to read_dd to obtain
	      hv for the SPEC detectors.
	      
	     

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORD INPUTS:
	DET
 KEYWORD OUTPUTS:
	N511
	SLLD
 CALLED BY:
	DISCSP_EDGES
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	
 PROCEDURE:
	none

 MODIFICATION HISTORY:
	Version 1, richard.schwartz@gsfc.nasa.gov, 27-mar-1998. 


EDIT_LOG $SSW/cgro/batse/idl/edit_log.pro
[Previous] [Next]

 NAME: 
       EDIT_LOG

 PURPOSE:


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	EDITOC, batse_read_cat
 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:
	Should be used to write only on VMS machines!

 PROCEDURE:
	none

 MODIFICATION HISTORY:


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

 PURPOSE: 
	This procedure is used to edit the BATSE flare catalog.

 CALLED BY:
	EDIT_LOG
 PROCEDURE:
 editoc is called by edit_log.  editoc lists the current values in the 
 BATSE catalog for the selected flare and allows the user to change any
 of them.  If the user enters the command WRITE, the new values are written
 in the flare catalog file.  If the user QUITs or EXITs without typing
 WRITE, no changes are made to the flare catalog file.


 CATEGORY:
       BATSE

 CALLING SEQUENCE:


 CALLS: ***
	ATIME [1], ATIME [2], CONV_VAX_UNIX, GETUT [1], GETUT [2], SETUT [1], SETUT [2]
	SIZE_STRUCT, USE_VAX_FLOAT
 INPUTS:
       none explicit, only through commons;

 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	none
 COMMON BLOCKS:
	flare_catalog

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none


 MODIFICATION HISTORY:
 Kim Tolbert  4/14/91
	version 2, richard.schwartz@gsfc.nasa.gov, 3-sep-1997, now reads stream files.
       Version 3, richard.schwartz@gsfc.nasa.gov, 24-jun-1998, forced old VAX float format on write and
	convert to IEEE float on 5.1 VMS.


Enorm_drm $SSW/cgro/batse/idl/add_scatter_drm.pro
[Previous] [Next]

 NAME: Enorm_drm

 PURPOSE: Scale the DRM output rows from energy units to units of
	   the peak of the DRM row.  This is an intermediate routine
	   for scaling scattering matrices to the edges of the direct
	   matrices

 CATEGORY:
	Spectral Analysis

 CALLING SEQUENCE:
       DRM = $
	 ENORM_DRM( IN_DRM=IN_DRM, IN_E_OUT=IN_E_OUT, ENORM=ENORM,$
		ESCALE=ESCALE, USESPLINE=USESPLINE )

 CALLS TO:
	INTERPOL, SPLINE

 INPUTS:
       IN_DRM 	 - Response matrix in cnts/energy
	IN_E_OUT - Output energy edges for IN_DRM,  2 x N, Lo_edge, Hi_edge
	USESPLINE   - If set, use spline interpolation.

 OUTPUTS:
	ENORM    - Normalized energy scale for output rows
	ESCALE   - Scaling energy used in each row
 CALLS: ***
	ADD_SCATTER_DRM, CHECKVAR [1], GAUSSFIT [1], GAUSSFIT [2], GAUSSFIT [3]
	GAUSSFIT [4], GAUSSFIT [5], INTERPOL, SPLINE, X_EOUT_DRM [1], X_EOUT_DRM [2]
	checkvar [2]
 CALLED BY:
	ADD_SCATTER_DRM
 PROCEDURE:
	Uses INTERPOL, SPLINE, and GAUSSFIT to find the energy at the peak
	of an output row, then interpolates the row into channels in units of
	the peak energy.

 MODIFICATION HISTORY:
	Written 19-Aug-1993, RAS


EVAL_SHERB $SSW/cgro/batse/idl/eval_sherb.pro
[Previous] [Next]
  Name:
       EVAL_SHERB
************************************************************************ 
 Pro	READ_SHERB, filename, det_id, data, start_time, end_time, 
	dselected=dselected, error=error, file_type=file_type, head=head,
	fits=fits, burst_str=burst_str, sched=sched, dstrct_in=dstrct_in,
	burst_time=base_time
       

 Inputs:	Filename - full file descriptor for file in native
		format.  Corrected data may be used.  If the extension
		is ".fits", then fits readers are used.
		Must contain the substrings 'herb' or 'sherb'. 
		Otherwise, these strings may be input
		through FILE_TYPE.
		det_id - id (0-7) of the detector to select.

 Optional Keywords
		file_type - string containing the substrings which specify
		the data structure to be read.
		fits - if set, then fits reader used.
		head - only read the first data record to return the 
			burst selected detector ids, dselected and base_time
 Outputs:	Data - Count data unpacked as whole numbers into 
			 fltarr( nch, nspec)
				nch - number of energy bins
				nspec - number os spectra in memory for
					dselected
			 
		Start_time - time in s from 79/1/1 for each time interval
			  dblarr( nrep, nspec)
		End_time - time in s from 79/1/1 for each time interval
			  dblarr( nrep, nspec)

 Optional Outputs
		dselected - The ids (0-7) of the four detectors selected
		burst_str - data structure from the first record read.
               sched     - schedule of readouts in data file and data
			    if det_id is not one of dselected.  To
			    return all of the spectra for all of the
			    detetectors, select det_id > 7.
		dstrct_in - raw packets read in
		burst_time - burst time in seconds from 79/1/1
 CALLS: ***
	ARR2STR [1], ATIME [1], ATIME [2], Arr2Str [2], BREAK_FILE [1], BREAK_FILE [2]
	BREAK_FILE [3], BURST_FLARE, CHECKVAR [1], CONCAT_DIR [1], CONCAT_DIR [2]
	CONCAT_DIR [3], CONT_READ, DET_COSINES, DISCSP_EDGES, DISCSP_READ, GETUTBASE [1]
	GETUTBASE [2], HEADFITS [1], HEADFITS [2], HEADFITS [3], PS [1], PS [2]
	READFITS [1], READFITS [2], READFITS [3], READ_FLARE, READ_SEQFILE, READ_SHERB
	SC_SECONDS_ED, SETUTBASE [1], SETUTBASE [2], TJD2YMD, UTPLOT [1], UTPLOT [2]
	UTPLOT [3], UTPLOT [4], UTPLOT [5], UTPLOT [6], X [1], X [2], break_file [4]
	checkvar [2], concat_dir [4], load_struct, printx [1], printx [2]
 Restrictions:  File name must contain the words Her or Sher and 
		 the word Cor for corrected data.  Otherwise the
		 correct data structure must be provided.
		 File Definition Record
		 includes NUM_AUDIT_REC tag name specifying the
		 number of data records.  

 ras, 93/10/17
 ras, 21-dec-93, only valid for sherb
 ras, 31-jan-94, used load_struct and conv_vax_unix2 to make
	machine independent
 ras, 18-feb-94, head option
 ras, 3-mar-94, corrected time conversion to include no packet offset 
		 and use burst load time not burst start time
************************************************************************


EXTRACT_SLLD $SSW/cgro/batse/idl/extract_slld.pro
[Previous] [Next]

 NAME: 
	EXTRACT_SLLD

 PURPOSE: 
	read in raw BATSE housekeeping files from MSFC,
	and extract hkgmtb words containing slld values

 CATEGORY: 
	BATSE

 CALLING SEQUENCE: 
	EXTRACT_SLLD, infile, outdat, sctime, slld


 CALLED BY:


 CALLS:
	none
 INPUTS:
       Infile - Full path name of housekeeping file.

 OUTPUTS:

	Sctime - time of start of full slld readout in param table
		 as an intarr(3 x nsamples)
	Slld   - SLLD values for each full readout in param table
		 organized as a bytarr(8 x nsamples)

 OPTIONAL OUTPUTS:
	none

 COMMON BLOCKS:
	extract_slld, outdat

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY:
	ras, 28-jun-95


EXTRACT_TRIGGERS $SSW/cgro/batse/idl/extract_triggers.pro
[Previous] [Next]
 NAME:
	EXTRACT_TRIGGERS

 PURPOSE:
	Extracts the times of BATSE flare triggers from the trigger file
	obtained from the BATSE PI team at Marshall Space Flight Center.

 CATEGORY:
	BATSE

 CALLING SEQUENCE:
	EXTRACT_TRIGGERS, B_num, B_tjd, B_secs

 INPUTS:
	None - reads database file Burst_trigger.lst on BATSE_DATA

 OUTPUTS:
	B_num: Trigger number from spacecraft and MSFC
	B_tjd: Truncated Julian Day of trigger
	B_secs: Seconds in day of trigger

 CALLS: ***
	CHECKVAR [1], CHKLOG [1], CHKLOG [2], CONCAT_DIR [1], CONCAT_DIR [2]
	CONCAT_DIR [3], READ_SEQFILE, checkvar [2], concat_dir [4]
 CALLED BY:
	MERGE_BURSTS
 PROCEDURE:
	Read the database file and parse it.
Trigger List has a format like the following :

 Burst Trunc  Sec  Comments
  No.   JD  of day
   146  8380 65642 Single peak lasting 30 s, with some structure.  Channel 3.
                   GOES C flare.
   151  8382 58292 Single peak with structure lasting 15 seconds.  Channel 2.
                   GOES C flare.
   155  8382 84146 Multiple. Triggered on precursor lasting about 20 s.  Main
                   peak lasting 300 s, came 200 s later.  Channel 2.

 MODIFICATION HISTORY:
 	Written by:	RAS
	December, 1995
       Modified by:   AES 97/02/18  Checked for mail-generated trailers
		at the end of burst_trigger.lst.  Assumed anything after
		the trailer would be bogus.