function momentcube,incube ;------------------------------------------ ;Generates a cube of the moments of a set of data, INCUBE ;See help in IDL on the MOMENT function for more detail. The ;routine takes the moments for data with constant third dimension. ;------------------------------------------ outcube=fltarr(4,16) for q=0,15 do begin if n_elements(size(incube))-3 eq 3 then cub=incube(*,*,q) else cub=incube(*,q) pointer=where((cub ne 99999.0)*finite(cub)*(cub eq cub)) if total(pointer) eq -1 then begin ; print,'No Valid SCF Data selected.' outcube(*,q)=99999.0 goto,skipout endif data=cub(pointer) data1=data(sort(data)) ndata=n_elements(data1) center=data1(long(0.1*ndata):long(0.90*ndata)) moments=moment(center) mn=moments(0) disp=sqrt(moments(1)) data=data(where((data gt mn-20*disp) and (data lt mn+20*disp))) outcube(*,q)=moment(data) outcube(1,q)=sqrt(outcube(1,q)) skipout: endfor return,outcube end