; docformat='rst'
;+
; This procedure reads a single fits file in multiaccum format
;-
;+
; Reads a single fits file in multiaccum format
;
; :categories:
; JWST Data Processing - NIRCam Cryo tests
; :examples:
; IDL> read_one_ramp, data0
; :Params:
; data0: out, required, type="fltarr(2048,2048,Ngroup)"
; ramp datacube to be extracted
; :uses: COMMON DETECTOR_PARAMS,gain,h,h1mask,h2mask,h3mask,h4mask
; :description:
; This routine is used to read a single file, identified inside (editing needed);
; convenient for debugging
; :Author:
; M. Robberto, created 25 Apr. 201
; :todo: the COMMON is needed to pass the gain value: add a check on the existence of the gain parameter, if missing set gain=1
;-
PRO READ_ONE_RAMP,data0
;to test: find and read only one file
COMMON DETECTOR_PARAMS,gain,h,h1mask,h2mask,h3mask,h4mask
st=systime(1)
print,'begin reading ramp: ',st,' sec ',memory(/high)/1e9,' GB'
Cross_correlation = 0
;
;if there is no gain transmitted in common, assumes gain=1
if n_elements(gain) EQ 0 THEN gain=1
;
DATA_PATH= '/Volumes/witserv'
DATA_PATH = DATA_PATH+'/witserv/data14/nrc/nrc_cryo2'
cd, DATA_PATH
OBS_ID = 'NRC_2D6-DARK'
DETECTOR = '486'
file = FILE_SEARCH(OBS_ID+'*'+'/*'+DETECTOR+'*.fits',count=nfiles)
;
;read datacube
jf = 0
data0 = float(readfits(file[jf],/silent))*gain
print,' end reading ramp: ',systime(1)-st,' sec ',memory(/high)/1e9,' GB'
END