Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.stsci.edu/~mperrin/software/sources/medarr2.pro
Дата изменения: Sat Aug 11 03:00:44 2007
Дата индексирования: Sat Mar 1 14:05:53 2014
Кодировка:
;+
; NAME: medarr2
;
; PURPOSE:
; Like medarr, except you can specify a set of exposure times to scale
; the images by before taking their medians.
;
; INPUTS:
; inarr,outarr,mask,output_mask same as for medarr.
; KEYWORDS:
; exptimes array of exposure times
; /minimum return min at each pixel, not median
; threshhold= mask out all values above this number of counts per second.
; (to block out stars)
; OUTPUTS:
; If exptimes not set, returns the median image.
; If exptimes is set, returns the median image scaled to a 1 second exposure.
;
; HISTORY:
; Began 2004-04-13 20:28:15 by Marshall Perrin
; 2006-06-20 added /minimum
;-

PRO medarr2, inarr, outarr, mask, output_mask,exptimes=exptimes,$
minimum=minimum,threshhold=threshhold

if keyword_set(exptimes) then begin
inarr2 = inarr
sz = size(inarr)
if (sz[3] ne n_elements(exptimes)) then $
message,"Number of exptimes must equal number of images!:"+n_elements(exptimes)+sz[3]

for i=0L,sz[3]-1 do begin
inarr2[*,*,i] /= exptimes[i]
endfor

if keyword_set(threshhold) then begin
for i=0L,sz[3]-1 do begin
whigh = where(inarr2[*,*,i] gt threshhold, count)
if count gt 0 then inarr2[whigh+sz[1]*sz[2]*i] = !values.f_nan
endfor
endif

if keyword_set(minimum) then outarr = min(inarr2,dim=3) else $
medarr,inarr2,outarr,mask,output_mask
endif else begin
inarr2=inarr
sz = size(inarr)
if keyword_set(threshhold) then begin
for i=0L,sz[3]-1 do begin
whigh = where(inarr2[*,*,i] gt threshhold, count)
if count gt 0 then inarr2[whigh+sz[1]*sz[2]*i] = !values.f_nan
endfor
endif


if keyword_set(minimum) then outarr = min(inarr2,dim=3) else $
medarr,inarr2,outarr,mask,output_mask
endelse


end