pro linload,filename,imgs,bias,tint ; program to load linearity frames give ; a file listing the set of linearity frames (FITS files) ; a bias frame to subtract (IDL array) ; it normalizes counts to counts/coadd and subtracts the bias ; very slow ; ; 6/23/94 MCL ; ; changes so determines number of files by scanning the input file and ; also changed order of array accessing -> faster ; 7/03/94 if keyword_set(filename) eq 0 then begin print,'pro linload,filename,imgs,bias,tint' return endif file = ' ' head = ' ' ; figure out how many images, not counting blank lines openr,unit0,filename,/get_lun n = 0 while eof(unit0) ne 1 do begin readf,unit0,file if (strlen(file) ne 0) then n = n+1 endwhile free_lun,unit0 tint = fltarr(n) ; size the bias frame and check if coadd divided bsz = size(bias) print,'bias frame is ',strc(bsz(1)),' x ',strc(bsz(2)) bm = total(bias)/(bsz(1)*bsz(2)) if (bm gt 40000.) then begin print,'bias average is ',bm print,'did you remember to divide by # of coadds?' return endif print,'-- loading linearity frames --' openr,unit0,filename,/get_lun for i=0,n-1 do begin readf,unit0,file print,format='($,"opening ",A," ")',file img = readfits(file,head,/silent) ; for 1st frame, initalize imgs to proper size if (i eq 0) then begin ; print,' first file' sz = size(img) if (sz(1) ne bsz(1) and sz(2) ne bsz(2)) then begin print,'bias frames and image frames not the same size!' return endif imgs = fltarr(sz(1),sz(2),n,/nozero) endif ; divide by number of coadds, subtract bias print,' processing' ; print,format='($," extracting header, ") extract_head,head,'TINT',t extract_head,head,'M56COAD0',coadd tint(i) = float(t) ; print,'normalizing and subtracting bias' imgs(*,*,i) = img/float(coadd) - bias endfor free_lun,unit0 end