Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.naic.edu/~rminchin/idl/masonoffall.pro
Дата изменения: Wed Jun 18 19:05:46 2014
Дата индексирования: Sun Apr 10 06:11:04 2016
Кодировка:

Поисковые слова: m 5
pro masonoffall,flist,projid,date,b,sclcal=sclcal,sclJy=sclJy,avg=avg,median=median,side=side,dateroll=dateroll,verbose=verbose,nonorm=nonorm,dps=dps,flux=flux,board=board,bonrecs=bonrecs,boffrecs=boffrecs,smooff=smooff,getfiles=getfiles,ravg=ravg,float=float,double=double,blankcor=blankcor,normcal=normcal

; check if flist (if supplied as a list) s a string variable, if not
; assume it is a numeric list and add .fits.

if (n_elements(flist) EQ 4) then begin
if (size(flist,/type) NE 7) then begin
fnums = flist
flist = strarr(4)
for i = 0, 3 do begin
flist[i] = string((fnums[i]),format='(I05)')+'.fits'
endfor
endif
endif

if(arg_present(bonrecs)) then do_bon = 1 else do_bon = 0
if(arg_present(boffrecs)) then do_boff = 1 else do_boff = 0

;flist=strarr(4)
;for i = 0, 3 do begin
; flist[i]=string(fnum+(100*i),format='(I05)')+'.fits'
;endfor

if(n_elements(dateroll) EQ 0) then dateroll = intarr(4)
if(n_elements(date) EQ 4) then dodates = 0 else dodates = 1
if(n_elements(avg) EQ 0) then avg = 1
if(n_elements(dps) EQ 0) then dps = 0
if(n_elements(nonorm) EQ 0) then nonorm = 0
if(n_elements(getfiles) EQ 0) then getfiles = 0

if(dps) then nonorm = 0

if(getfiles) then begin
if (size(flist,/type) NE 7) then begin
fnum = flist[0]
flist = strarr(4)
for i = 0, 3 do begin
flist[i] = string((fnum),format='(I05)')+'.fits'
endfor
endif
endif

if (n_elements(flist) EQ 1) then begin
fnum = flist
flist =strarr(4)
masmakeflist,projid,date,fnum,flist,dateroll=dateroll,verbose=verbose,dps=dps
endif

if(n_elements(side) NE 1) then side = 1

if (n_elements(board) NE 1) then begin
for i = 0, 13 do begin

if (dodates) then begin
fbase='/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date,format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'

fbase2='/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date+1,format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'
endif

; masonoff2,flist,bout,fbase=fbase
;print,fbase,flist

files = strarr(4)
; for j = 0, 3 do files[j] = fbase+flist[j]

for j = 0, 3 do begin
if (dodates EQ 0) then begin
files[j] = '/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date[j],format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'+flist[j]
endif else if (dateroll[j]) then begin
files[j] = fbase2+flist[j]
endif else begin
files[j] = fbase+flist[j]
endelse
endfor

if (getfiles) then begin
desc=0
is=masgetfile(desc,bout,avg=avg,ravg=ravg,median=median,float=float,double=double,filename=files[0],blankcor=blankcor)
print, 'Doing GetFile'
endif else if (nonorm) then begin
masbpcal,files,bout,bonret,boffret,sclcal=sclcal,sclJy=sclJy,median=median,avg=avg,verbose=verbose,normcal=normcal
; print,'Doing BP Cal'
endif else if (dps) then begin
is=masdpsp(files,bout,flux=flux)
; print, 'Doing DPS'
endif else begin
is=masposonoff(files,bout,bonret,boffret,sclcal=sclcal,sclJy=sclJy,median=median,avg=avg,smooff=smoof)
; print, 'Doing On-Off'
endelse

if (i eq 0) then begin
; Things to be done on the first pass only
; First, setup b to receive the results of the reduction
b = replicate(bout[0],14,n_elements(bout))
if (do_bon) then bon = replicate(bonret[0],14,n_elements(bonret))
if (do_boff) then boff = replicate(boffret[0],14,n_elements(boffret))
; Second, find the number of file rows to apply the weighting later
nsum=masfilesum(files[0],fsum,/list)
nrows = fsum.nrows
endif

b[i] = bout
if (do_bon) then bon[i,*] = bonret[*]
if (do_boff) then boff[i,*] = boffret[*]

print,'done '+string(i+1,format='(I0)')+'/14'

endfor

restmulti = !p.multi

!p.multi = [0,4,4]

for i = 0, 13 do masplot,b[i]

!p.multi=restmulti

wait,5

endif else begin

i=board

if (dodates) then begin
fbase='/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date,format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'

fbase2='/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date+1,format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'
endif

; masonoff2,flist,bout,fbase=fbase
;print,fbase,flist

files = strarr(4)
; for j = 0, 3 do files[j] = fbase+flist[j]

for j = 0, 3 do begin
if (dodates EQ 0) then begin
files[j] = '/share/pdata'+string(i+1,format='(I0)')+'/pdev/'+projid+'.'+string(date[j],format='(I8)')+'.b'+string(i-7*fix(i/7),format='(I1)')+'s'+string(fix(side),format='(I1)')+'g'+string(fix(i/7),format='(I1)')+'.'+flist[j]
endif else if (dateroll[j]) then begin
files[j] = fbase2+flist[j]
endif else begin
files[j] = fbase+flist[j]
endelse
endfor

if (getfiles) then begin
desc=0
is=masgetfile(desc,bout,avg=avg,ravg=ravg,median=median,float=float,double=double,filename=files[0],blankcor=blankcor)
endif else if (nonorm) then begin
masbpcal,files,bout,bon,boff,sclcal=sclcal,sclJy=sclJy,median=median,avg=avg,verbose=verbose,normcal=normcal
endif else if (dps) then begin
is=masdpsp(files,bout,flux=flux)
endif else begin
is=masposonoff(files,bout,bon,boff,sclcal=sclcal,sclJy=sclJy,median=median,avg=avg,smooff=smooff)
print,avg
endelse

; if (i eq 0) then b = replicate(bout,14,n_elements(bout))

nsum=masfilesum(files[0],fsum,/list)
nrows = fsum.nrows

b = bout

print,'done single board reduction on board '+string(i,format='(I0)')

endelse

if (b[0].accum EQ 0) then begin
masaddwgt,b,nrows
endif

if (do_bon) then begin
if (avg) then n = masaccum(bon,bonrecs,/new,/mb) else bonrecs = bon
endif
if (do_boff) then begin
if (avg) then n = masaccum(boff,boffrecs,/new,/mb) else boffrecs = boff
endif

masplotall2,b

return
end