;+
; Project     : SDAC
;                   
; Name        : FAST_SPEC_DRM
;               
; Purpose     : This function returns an interpolated DRM from a coarse grid.
;               
; Category    : BATSE
;               
; Explanation : Suitable for evaluation of low energy response (<100 keV), a table
;	of DRMs for the BATSE SPECs is interpolated in angle and energy.
;               
; Use         : drm = fast_spec_drm( edges, theta, edges_in)
;    
; Inputs      : Edges- PHA edges in keV, 2 X Numer_of_channels
;		suitable for closely spaced values.  not accurate for 
;		integrating over large channels.  For those, sum over
;		smaller spacings.
;               Theta- zenith angle in degrees.
; Opt. Inputs : None
;               
; Outputs     : Edges_in - photon energies for matrix
;		Function returns standard BATSE SPEC response matrix 
;		in units of cnts/cm2/keV per photon/cm2
;
; Opt. Outputs: None
;               
;
; Common      : None
;               
; Restrictions: 
;               
; Side effects: None.
;               
; Prev. Hist  :
;
; Modified    : Version 1, RAS, 25-sep-1997 
;
;-            
;==============================================================================
function fast_spec_drm, edges, theta, edges_in

common discsp_resp, edges_out, adrm, e_in, atheta, scale_save

if not exist(edges_out) then begin
        file=findfile(concat_dir((chklog('SSWDB_BATSE'))(0), 'discsp_resp.sav'),count=fcount)
        if fcount ge 1 then restore, file(0) else return, 0
endif
ie = interpol( findgen(n_elements(edges_out(0,*))), avg(edges_out,0), avg(edges,0))
ith = interpol( findgen(n_elements(atheta)), atheta, theta )
edges_in = e_in
return, reform( interpolate(/grid, adrm, ie, findgen(n_elements(e_in(0,*))), ith))

end
