
;+
; NAME: bfits_burst
;	
; PURPOSE: read in BATSE bfits time history for bursts
;	
; CALLING SEQUENCE: 
;  bfits_burst, filename, t, rate, erate=erate, edges=edges, head=head, burst=burst
;	
; INPUTS:
;	filename - bfits filename
;	
; OPTIONAL INPUTS:
;	
; OUTPUTS:
;	t - 2xnsamples, times relative to burst trigger time in seconds
;	rate - count rate (/s) in each channel, (nchans x nsamples)
;	
; OPTIONAL OUTPUTS:
;	erate - uncertainty on rate, NaN for bad samples
;	edges - nominal energy channels (2 x nchans) in keV
;	head  - composite fits headers
;	burst - burst trigger numbers
; PROCEDURE:
;
; CALLS:
; 	extensive calls to astronomy library binary table reader
;	fits_spectra
; COMMON BLOCKS:
;
; RESTRICTIONS:
;
; MODIFICATION HISTORY:
;	ras, 13-feb-95	
;-
;
pro bfits_burst, filename, t, rate, edges=edges, erate=erate, head=head, burst=burst

file = (findfile(filename, count=count))(0)

if count eq 0 then message, 'Could not find '+filename

fits_spectra, file, t, rate, erate=erate, live=live, edges=edges, head=head
;edges = edges(*,0:3)


t= t - utime(tjd2ymd(fxpar(head,'basetime')))
burst=fxpar(head,'batse_tr')
print,'This is the data for burst number ',burst
help, t, rate, edges

end
