#check of 1 sphere MeO1 test simplified, r space, k_weight=2, kaizer window. Without restraint #set variables, now without norms for simplifying unguess guess(N_MeO1=7) guess(R_MeO1=2.10) guess(Sig_MeO1=0.004) guess(E_MeO1=0) S02=0.921 #set path Hf-O1 path(index=1, feff='feff0001.dat', label='MeO1', s02=S02*N_MeO1/degen, delr=R_MeO1-reff, sigma2=Sig_MeO1, e0=E_MeO1) noise_FT=3.92e-3 #reading the spectrum, interpolating, k range #spectrum is 1 sphere hfo1 from the same feff with e1=5.1523,n1=7.0612,r1=2.1107,s1=7.4408e-3, the same S02 #generated in viper so could be some deviation, the result of fitting here is normal read_data(file=hfo1.chi, group=Me_chi_nonaligned,type=chi,title_lines=1) Me_chi.k=range(0,ceil(Me_chi_nonaligned.k),0.05) Me_chi.chi=interp(Me_chi_nonaligned.k,Me_chi_nonaligned.chi,Me_chi.k) kmin_Me_chi=floor(Me_chi_nonaligned.k) kmax_Me_chi=ceil(Me_chi_nonaligned.k) #fit feffit(1,k=Me_chi.k,chi=Me_chi.chi,group=fit, kmin=kmin_Me_chi,kmax=kmax_Me_chi, rmin=0,rmax=2.4,kwindow=kaizer, dk=2, epsilon_k=noise_FT,kweight=2,fit_space=r) show @variables #calculate chi_square by formula manually. Use mag**2=re**2+im**2 # N_pts_Me_chi=npts(fit.chir_mag)*2 N_pts_Me_chi=npts(slice(Me_chi.r,nofx(Me_chi.r,rmin),nofx(Me_chi.r,rmax))) datmodel.mag=(Me_chi.chir_mag-fit.chir_mag)**2 datmodel_sliced.mag=slice(datmodel.mag,nofx(Me_chi.r,rmin),nofx(Me_chi.r,rmax)) chi_square_calc=N_idp/N_pts_Me_chi*vsum(datmodel.mag)/epsilon_r**2 #compare manual calculation with program value show chi_square_calc, chi_square