OCC_AVG $SSW/cgro/batse/idl/occults/occ_avg.pro
[Previous] [Next]
 Project     : SDAC    
                   
 Name        : OCC_AVG
               
 Purpose     : This procedures sums over matching occultation intervals.
               
 Category    : BATSE, OCCULTATIONS
               
 Explanation : The available occultation results database is read, grouped
		by spacecraft attitude, for discsp for slld and 511 keV position.
		Then the grouped data are averaged and the standard deviation
		of the count rate vs channel and angle are reported.
               
 Use         : OCC_AVG, Ftype, Occ_avg
    
 Inputs      : Ftype_in- Occultation data type, '.discsp','.bdb','cont
               
 Opt. Inputs : None
               
 Outputs     : Occ_avg- Structure with averaged values

 Opt. Outputs: None
               
 Keywords    : RESISTANT_CUT- Data cut for averaging, this many sigma about mean
		INRADEC -Ra and Dec (degrees) of the source, default, Crab J2000.
		SELECT_BY_TIME- Do initial selection for each interval by length of occ 
		interval,  selection on the basis of an integer (nominally 0-2) corresponding
		to the intervals used in MORE_OCCULTS.PRO, nominally 30, 60, and 90 seconds
		on each side of the occultation.
		A0535-Exclude observations during times of intense flux from AO535+26 which is
		too close to the Crab
		FILPATH - filepath to pass onto read_resulst2 onto occ_dbase
		DAYNIGHT- A control code
			-1: Average Day and Night separately, return combined average, default
			 0: Just average Nights
			 1: Just average Days
			 2: Average all together irrespective of day and night
		LOG_ENERGY_BIN- Bin size for histogram grouping by common energy
 Calls       : ***
	AVG [1], AVG [2], BATSE_CRAB_RESP, CHECKVAR [1], CONT_EDGES, DATATYPE [1]
	DATATYPE [2], DATATYPE [3], DISCLA_EDGES, DOC_LIBRARY, FCHECK, F_DIV, GRO_POINT
	MINMAX [1], MINMAX [2], OCC_FROM_FITS, PICK_POINTING, READ_RESULTS2
	RESISTANT_Mean [3], Resistant_Mean [1], Resistant_Mean [2], SET_PENDLETON
	TJD2YMD, checkvar [2]
 Common      : None
               
 Restrictions: Only implemented for the CRAB and types .discsp and .bdb. and .cont
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : VERSION 1, RAS, 13-JAN-1996
	Version 2, RAS, 26-dec-1996, added known a0535 exclusions
	Version 3, RAS, 2-jan-1995, added filpath


OCC_DBASE $SSW/cgro/batse/idl/occults/occ_dbase.pro
[Previous] [Next]
 PROJECT:
	SDAC
 NAME: 
	OCC_DBASE

 PURPOSE:
	This function locates the specified occultation database 
	files.
	occ_discsp_!yymmdd!.dat_!det_id! !yymmdd!.bdb hkg_data.dat_!tjd! discsp_msfc.dat_!tjd!
	 !yymmdd!.discsp
	The locations on SDAC are in the file OCC_DISCSP.TXT
	
 CATEGORY:
	BATSE, OCCULTS

 CALLING SEQUENCE:
	file_names = occ_dbase( filetype, date, det_id)

 CALLS: ***
	ARR2STR [1], Arr2Str [2], BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3]
	BUILD_FNAME [1], BUILD_FNAME [2], CHECKVAR [1], LOC_FILE [1], LOC_FILE [2]
	LOC_FILE [3], MORE [1], MORE [2], STR2ARR [1], STR2ARR [2], TJD2YMD, UNIQ [1]
	UNIQ [2], UNIQ [3], YMD2TJD, anytim [1], anytim [2], anytim [3], anytim [4]
	anytim [5], break_file [4], checkvar [2], curdir [1], curdir [2], uniqo [1]
	uniqo [2]
 INPUTS:
       filetype- e.g. 'occ_discsp','bdb', 'hkg','discsp_msfc','discsp'
	date_in - time in anytim readable format or '*'
	det_id - BATSE detector id (0-7) or '*'
 OPTIONAL INPUTS:
	none

 OUTPUTS:
       none explicit, only through commons;

 OPTIONAL OUTPUTS:
	none

 KEYWORDS:
	DATE_OUT- Date of each file parsed from filename
	ERROR   - If set, couldn't find file.
	QUIET   - If set, don't report error messages
	EXTRACT - If set, use extracted data sets, not set don't
 CALLED BY:
	PLOTBATSE_QL, READ_OCC_DISCSP, READ_RESULTS2, xzchange
 COMMON BLOCKS:

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	Designed for SDAC, sdac and umbra
	first implemented for occ_discsp database

 PROCEDURE:
	none

 MODIFICATION HISTORY:
   	ras, 11-June-1996
	ras, 13-sep-1996, use /all on loc_file
	ras, 16-sep-1996, use comprehensive use of occ_dbase.txt
	ras, 15-oct-1996, revamped database locations and method
	ras, 30-dec-1996, added smm_data0:[data.discsp] do database locations
	richard.schwartz@gsfc.nasa.gov, 8-aug-1997, added batse_bdb to file path
	richard.schwartz@gsfc.nasa.gov, 3-sep-1997, mount points changed on umbra


OCC_FILETYPE $SSW/cgro/batse/idl/occults/occ_filetype.pro
[Previous] [Next]

  Name:
       OCC_FILETYPE


 PURPOSE:  
	This function examines the input filename and returns the filetype
	'.bdb','.cont','.discsp','cont_data','discsp_msfc', etc
	

 CATEGORY: 
	BATSE, OCCULTS

 CALLING SEQUENCE:
	filetype = occ_filetype(filename)

 CALLED BY:


 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], break_file [4]
 INPUTS:
	filename - data filename
 OPTIONAL INPUTS:

 OUTPUTS:
       Returns a string with the filetype
 OPTIONAL OUTPUTS:

 KEYWORDS:

 CALLED BY:
	GET_OCC_ONDAY, PLOT_OCCS, READ_OCC_DISCSP, xzchange
 COMMON BLOCKS:
	none

 SIDE EFFECTS:
	none

 RESTRICTIONS:
	none

 PROCEDURE:
	none

 MODIFICATION HISTORY: 
	ras, 27-sep-1996


OCC_FROM_FITS $SSW/cgro/batse/idl/occults/occ_from_fits.pro
[Previous] [Next]
 Project     : SDAC    
                   
 Name        : OCC_FROM_FITS
               
 Purpose     : This procedure takes an MSFC occultation history file and produces
		an occultation structure from crab_occ_str.
               
 Category    : BATSE, OCCULTATION
               
 Explanation : First the file is read using MRDFITS, the occ structure is created
		and filled in.
               
 Use         : 
    
 Inputs      : Filename- BATSE Occultation results FITS file name, full path.
               
 Opt. Inputs : None
               
 Outputs     : Oc- Reformatted occultation structure from CRAB_OCC_STR

 Opt. Outputs: Header- FITS header 
               
 Keywords    : INRADEC - ra and dec of source, degrees, default Crab Ra and DEC

 Calls       : ***
	AVG [1], AVG [2], CHECKVAR [1], CRAB_OCC_STR, GET_BATSE_POINTING, GRO_POINT
	MINMAX [1], MINMAX [2], MRDFITS [1], MRDFITS [2], TJD2YMD, bits2, checkvar [2]
 CALLED BY:
	OCC_AVG
 Common      : None
               
 Restrictions: 
               
 Side effects: None.
               
 Prev. Hist  :

 Modified    : Version 1, RAS, 4-JAN-1997


OCCTIME $SSW/cgro/batse/idl/occtime.pro
[Previous] [Next]
 NAME:
	OCCTIME

 PURPOSE:
	This procedure computes the times of X-ray occultation of a source
	cosmic or solar during a BATSE orbit.

 CATEGORY:
	CGRO/BATSE

 CALLING SEQUENCE:
	OCCTIME,SPACECRAFT=SC,UTIME=UT,DAYMARKS=DAY,NIGHTMARKS=NIGHT,$
	S_ANGLE=S_ANGLE,O_ANGLE=O_ANGLE,NTRANS=NTRANS, XYZ_ORBIT=XYZ_ORBIT,$
	INRADEC=INRADEC, D_PERIOD=D_PERIOD, BAD_DATA=BAD_DATA

 INPUTS:
	SPACECRAFT:  spacecraft vector in 0.25 units, x,y,z in celestial J2000 coords.
	UTIME:       time of spacecraft vector, anytim units.
	XYZ_ORBIT:3x3 array describing orbit in inertial coordinates, normalized
           first 3 elements, x vector giving s/c vector at ut(good(0))
	    second 3 elements, y vector in orbital plane
	    third 3 elements, z vector normal to orbital plane
	D_PERIOD:	orbital period in seconds 

 OPTIONAL INPUTS:
	INRADEC: Input source RA and DEC in decimal degrees, J2000
	
 OUTPUTS:
	DAYMARKS: times of start of spacecraft xray day in sec since 1-jan-1979
	NIGHTMARKS: times of start of spacecraft xray night
	S_ANGLE:angle formed by dotting earth-sun and earth-sc vectors, 
	O_ANGLE: occultation angle as a function of time
	NTRANS: dummy argument, no longer used, input will be set to 0
	BAD_DATA: set if data is too bad to find occultations

 CALLS: ***
	AVG [1], AVG [2], FIND_TANGENT, HORIZONANGLE, SOLEPHUT, SPHCART, SUN_EARTH_SC
 CALLED BY:
	DN_TRANS
 COMMON BLOCKS:

 SIDE EFFECTS:

 RESTRICTIONS:

 PROCEDURE:

 MODIFICATION HISTORY:
 	VERSION 2, ras, 29-mar-1996
	Version 3, ras, 3-June-1996, changed minimum o_angle to 100 from 105 degrees


ORBIT $SSW/cgro/batse/idl/orbit.pro
[Previous] [Next]
  Name:
       ORBIT
  Calling sequence:
	 orbit, ut, x_pos,y_pos,z_pos, period=period, 
 	next_night=night,next_day=day,bad_data=bad_data
  Purpose and Procedure:
	given a small number of samples (~100) of the time and position vectors from
	the spacecraft ephemeris, determine the orbital period, and the times of the
	next passage into night and the next passage into day after night.  
	While this routine will find the period and day/night transitions from
	a small data set, it works best with sufficient data to actually cover the
	day/night transitions.
 Category:
	BATSE
 Inputs:
	ut
	x(yz)_pos
	
 Calls: ***
	DN_TRANS
 Outputs:
	period- orbital period in seconds
	next_night
	next_day
	bad_data- set to 1 if there is insufficient valid orbital data
 CALLED BY:
	QLARCHIVE
 History:
	Version 1, RAS 1991
	AKT, 1992
	Version 3, RAS 9 June 1996, added documentation


ORBIT_FILL $SSW/cgro/batse/idl/orbit_fill.pro
[Previous] [Next]

 NAME:
	ORBIT_FILL

 PURPOSE:
	This procedure determines rudimentary orbital elements for the spacecraft
	orbit.  If the BATSE DISCLA packets contain bad or null spacecraft coordinates,
	this procedures replaces those coodinates with coordinates computed
	by assuming circular rotation in the plane defined by the remaining valid
	coordinates.  This procedure will work even with data gaps provided the 
	set of coordinates is all contained within a single orbital time period of
	order 95 minutes.  At least 10 good coordinates must be passed or the 
	procedure rejects the data.


 CATEGORY:
	BATSE

 CALLING SEQUENCE:
	 orbit_fill,ut,sc_new=sc,sc_old=sc_old,bad_data=bad_data,c_period=period,$
	 d_period=d_period, xyz_orbit=xyz_orbit

 CALLS: ***
	AVG [1], AVG [2], F_CROSSP
 INPUTS:
	SC_OLD - SPACECRAFT POSITION IN INERTIAL COORDINATES (CELESTIAL), INPUT

	UT - TIME IN SECONDS CORRESPONDING TO THE POSITION VECTOR SC

 OPTIONAL INPUTS:
       none

 OUTPUTS:
	SC_NEW (SC) - CORRECTED SPACECRAFT POSITION.  IF TELEMETRY IS CORRECT THIS
	       SHOULD BE THE SAME AS SC_OLD.  
	XYZ_ORBIT= 3X3 ARRAY DESCRIBING ORBIT IN INERTIAL COORDINATES, NORMALIZED 
	FIRST 3 ELEMENTS, X VECTOR GIVING S/C VECTOR AT UT(GOOD(0))  
	SECOND 3 ELEMENTS, Y VECTOR IN ORBITAL PLANE 
	THIRD 3 ELEMENTS, Z VECTOR NORMAL TO ORBITAL PLANE
	XYZ_ORBIT MUST BE COMPUTED BECAUSE IT IS NEEDED IN OTHER ROUTINES
	SUCH AS OCCTIME.

	BAD_DATA - SET TO 1 IF THERE ARE TOO FEW ACCEPTABLE COORDINATES TO
	CALCULATE THE ORBITAL ELEMENTS.
 
	C_PERIOD=PERIOD , ORBITAL PERIOD CALCULATED FROM RADIUS OF ORBIT 
	D_PERIOD=PERIOD , ORBITAL PERIOD CALCULATED FROM ANGULAR CHANGES IN THE
	SPACECRAFT POSITIONS (SC)
 OPTIONAL OUTPUTS:
       none

 KEYWORDS:
       none
 CALLED BY:
	DN_TRANS, FIND_GOOD_OCCS, GET_OCCS
 COMMON BLOCKS:
       none

 SIDE EFFECTS:
       none

 RESTRICTIONS:
       none

 PROCEDURE:
       none

 Modification History:
	MODIFIED BY RAS, 92/09/15, TO RETURN XYZ_ORBIT 
       Mod by AES, 95/06/22, to use f_crossp rather than crossp


OUT_ARR $SSW/cgro/batse/idl/out_arr.pro
[Previous] [Next]

 NAME: 
       OUT_ARR

 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: