Program OVN_bg ! Image of a Gaussian noise A.Bijaoui 15/07/02 ! Modified 03/11/09 Character(Len=80) String,Mouch,Ifs Character(Len=60) Comment Character(Len=100) Option(50) Integer Lu,Nc,Nl,Np,Bp,Status,Ns,Is,Ip,Nseed Integer Ikeys,Nkeys,Err Real Xd,Yd,Dx,Dy,Ran,X,Y,Pi2,Sigma Real, dimension(:), Allocatable :: V Call Getline(Nkeys,Option) Pi2=8.*Atan(1.) Lu=1 Ifs='bg1.fit' Sigma=1. Mouch='mouch.lis' Nc=1024 Nl=1024 Nseed=2002 Dx=1. Dy=1. Xd=0. Yd=0. Bp=-32 If(Nkeys.eq.0) then Write(*,*) 'Syntax : -o Image_noise -c Number_Columns -l Number_Lines' Write(*,*) ' -n Seed -s Noise_sd -m logfile' Write(*,*) 'Image of a Gaussian noise' Write(*,*) '-o Image_Noise : Image of the Gaussian noise (bg1.fit)' Write(*,*) '-c Number_Columns: number of columns / line (1024)' Write(*,*) '-l Number_Lines: number of lines / line (1024)' Write(*,*) '-n Seed: Seed for the radomizer (2002)' Write(*,*) '-s Noise_sd: standard deviation of the noise (1.)' Write(*,*) '-m logfile : name of the log file (mouch.lis)' Stop Endif Do Ikeys=1,Nkeys,2 if(Option(Ikeys).eq.'-i') Ifs =Option(Ikeys+1) if(Option(Ikeys).eq.'-c') Read(Option(Ikeys+1),*) Nc if(Option(Ikeys).eq.'-l') Read(Option(Ikeys+1),*) Nl if(Option(Ikeys).eq.'-n') Read(Option(Ikeys+1),*) Seed if(Option(Ikeys).eq.'-s') Read(Option(Ikeys+1),*) Sigma if(Option(Ikeys).eq.'-m') Mouch =Option(Ikeys+1) Enddo Call Debut('OVN_bg',Mouch) Call WC('Image of a white Gaussian noise') Call WI('Number of Columns',Nc,1) Call WI('Number of Lines ',Nl,1) Call WI('Seed ',Nseed,1) Call WR('Sigma ',Sigma,1) Np=Nc*Nl Allocate(V(Np),stat=err) ; If(err/=0) Stop "Allocation problem" Do Ip=1,Np X=sqrt(-2.*Alog(Ran(Nseed)))*cos(Pi2*Ran(Nseed)) V(Ip)=Sigma*X Enddo CALL WC('Resulting Image : '//Ifs) Comment='Gaussian noise' Call CFits(Ifs,Lu,Comment,Nc,Nl,Dx,Dy,Xd,Yd,BP) Call FtpprE(Lu,0,1,Np,V,Status) Call FTClos(Lu,Status) CALL LAFIN('OVN_bg') END Program OVN_bg