yorick banner

Home

Manual

Packages

Global Index

Keywords

Quick Reference

functions in randfield.i - g

 
 
 
genrandfield1D


            UMENT genrandfield(n);  
 
        generates Gaussian Random Field of dims [1,n]  
        which obeys the power spectrum given by fun (default k^-5/3)  
          
        EXAMPLE compute correlation function in 1D  
        include, "Eric/histo.i";  
        nm=512; ns=512;  
        z=genrandfield1D(ns,fun=PS); zr=float(fft(z,-1));  
        z2=float(fft(z*conj(z),-1));  
        zc=array(0.,ns); for(i=1;i<=nm;i++){z=genrandfield1D(ns,fun=PS); z2=z*conj(z);zc+=z2/float(nm);};  
        logxy,1,1;   
        kk=2*pi*(indgen(ns)-1)/float(ns);  
        plg,float(zc),kk; plg, PS(kk),kk,color="blue",width=4;  
        write, " power spectrum slope",(log(float(zc)(5:125))(dif)/log(indgen(ns)(5:125))(dif))(avg)  
interpreted function, defined at contrib/randfield.i   line 193  
SEE ALSO,   fft_indgen,,   fft.  
 
 
 
genrandfield2D


            UMENT genrandfield(n);  
 
        generates Gaussian Random Field of dims [2,n,n]  
        which obeys the power spectrum given by fun (default k^-5/3)  
        EXAMPLE  
        include, "Eric/histo.i";   
        ns=128;  
        z=genrandfield2D(ns); zr=float(fft(z,[-1,-1])); //pli,zr;   
        z2=float(fft(z*conj(z),[-1,-1])); // pli,z2;  
        zc=array(0.,ns,ns); for(i=1;i<=50;i++){z=genrandfield2D(ns); z2=z*conj(z);zc+=float(z2)/50.;}; //fft_pli,zc;  
        x1=(indgen(ns)-1)*2*pi/float(ns);   
        y1=(indgen(ns)-1)*2*pi/float(ns);   
        r1= abs(x1, y1(-,));   
        py= histo2(r1, px, weight=zc, average=1, interp=1,binsize=r1(dif)(min));   
        plg, py(2:), px(2:), color="red"; //azimuthal average  
        plg, PS(px(2:)),px(2:),color="blue",width=4; logxy,1,1;  
        write," power spectrum slope",(log(py(5:25))(dif)/log(px(5:25))(dif))(2:12:10)(avg)  
interpreted function, defined at contrib/randfield.i   line 140  
SEE ALSO,   fft_indgen,,   fft.