pro randomize2 ;------------------------------------ ; Randomizes the positions of spectra in the INCUBE input. ; As a word of warning, the program also randomizes the FITPARAMS cube ; This is the second version of the randomize program which leaves ; rejected/empty pixels where they were. ;------------------------------------ @varld.cb sz=size(data0) sx=sz(1) sy=sz(2) sv=sz(3) print,'Randomizing Data Cube...' i=0 rej_mat=fitparams(*,*,5) target=where(rej_mat eq 0.) x0=target mod sx y0=floor(target/sx) rand=randomu(seed,total(1-fitparams(*,*,5))) newindx=sort(rand) x1=x0(newindx) y1=y0(newindx) outcube=fltarr(sx,sy,sv) outfit=fltarr(sx,sy,9)+99999.0 for i=0,total(rej_mat eq 0)-1 do begin outcube(x1(i),y1(i),*)=data0(x0(i),y0(i),*) outfit(x1(i),y1(i),*)=fitparams(x0(i),y0(i),*) endfor fitparams=outfit data0=outcube end