# Fityk 0.7.8 ### syntax testing ### this script doesn't assume location of any other files (ie. no data files ### are read, and produces only file in current directory, which start with ### `tmp_' prefix, eg. tmp_foo.xy # first set some options useful for testing set exit-on-warning = 1 set autoplot = never set pseudo-random-seed = 174924 set verbosity = verbose # ... and then issue as many commands as possible, checking for sytax errors # predefined data transformations M=500 x=n/100 M=500; x=n/100; y=sin(x); s=1 Y[1...] = Y[n-1] + y[n];S = sqrt(max2(1,y)) Y[...-1] = (y[n+1]-y[n])/(x[n+1]-x[n]);X[...-1] = (x[n+1]+x[n])/2 M=M-1;S = sqrt(max2(1,y)) S = s / sum(n > 0 ? (x[n] - x[n-1]) * (y[n-1] + y[n])/2 : 0); Y = y / sum(n > 0 ? (x[n] - x[n-1]) * (y[n-1] + y[n])/2 : 0) X[...-1] = (x[n]+x[n+1])/2;Y[...-1] = y[n]+y[n+1]; S[...-1] = sqrt(s[n]^2+s[n]^2); delete(n%2==1) Y=max2(y,0) delete(not a) Y=x , X=y , S=sqrt(max2(1,Y)) Y=-y a=true X = 4*pi * sin(x/2*pi/180) / 1.54051 X = asin(x/(4*pi)*1.54051) * 2*180/pi X = x[0] + n * (x[M-1]-x[0]) / (M-1), Y = y[x=X], S = s[x=X], A = a[x=X] del @0 @0.title = 'Title X' @+ @1.title = TitleY M = 400 in @1 X=n/M*3*pi in @1 Y=sin(x) in @1 plot in @1 sleep 0.3 M = 800 in @0 X = 10 + n/M*90 in @0 delete @1 Y = 30 Y = y + 3000 * exp(-((x-21.2)/0.3)^2) # Gaussian Y = y + 2450 / (1 + ((x-41.4)/0.3)^2) #Lorentzian $height=1901; $center=75.313; $hwhm=0.5; $shape=2.4 Y = y + $height/(1+((x-$center)/$hwhm)^2*(2^(1/$shape)-1))^$shape #Pearson VII S = sqrt(max2(1, y)) Y = randnormal(y, s) #noise plot in @0 sleep 0.3 %p = guess Lorentzian center=~75 plot in @0 sleep 0.2 del %p guess Gaussian %lo = guess SplitGaussian [38:] plot in @0 sleep 0.3 %lo = guess LorentzianA [38:44] %pe = Pearson7(height=~1901, center=~75.313, hwhm=~1/2, shape=2.4) F += %pe %ble = copy(%pe) dele %pe F += Pearson7(~2000, ~75, ~0.6, ~2) fit 2 in @0 fit+ 15 with fitting-method=Nelder-Mead-simplex fit 10 with fitting-method=Genetic-Algorithms fit 10 %fun = copy(%_1) i+ %ble, %lo $a = %ble.shape $a = %ble.shape + %lo.hwhm $b = ~{%ble.shape} + {%lo.hwhm} $abc = F[0].hwhm + 1 $abc = {F[0].hwhm + 0.1} @0.F[0].hwhm = $abc F.hwhm = $abc F.hwhm = ~{F[0].hwhm + 0.1} %lo_cp = copy(@0.F[1]) del %lo_cp fit fit history 0 fit h -1 f u f redo fi undo fi re fit history clear info version info variables i $a, $_11 inf types i functions i %fun(3), %ble(2 + 5*sin(2/3*pi) + %fun(3.3)) i %fun, %ble i datasets i commands i view i @0.F i @0.F[0], @0.F[-1] i @0.Z i formula in @0 i @0.dF(12*3) i @0 i @0.filename, @0.title i fit i fit-history i set i errors i guess in @0 i guess [10:40] in @0 i ((3+5) * (2.1+pi) * exp(5)/cos(ln(3)))^2 in @0 i GaussianA, Gaussian, Linear i SplitGaussian i formula i min(y), max(s) i min(y if 20 avg(y)) i darea(y-@0.F(x) if 15 tmp_log.fit commands+ > tmp_log.fit commands > /dev/null commands < tmp_log.fit # it's an empty file (with some comments) info commands[0:4] >tmp_foo.fit info+ commands[0] >>tmp_foo.fit @0 > tmp_foo1.xy @0 (x, y, s) > tmp_foo2.xy @0 (x, y, a) > tmp_foo3.xy @0 (x, y, s, @0.F(x), *F(x), (y-@0.F(x))/s, a) > tmp_foo4.xy info peaks in @0 > tmp_foo5.xy info+ peaks in @0 > tmp_foo6.xy info formula in @0 > tmp_foo7.xy info+ formula in @0 > tmp_foo8.xy info+ peaks in @* > tmp_foo9.xy dump > tmp_dump.fit # settings set can-cancel-guess # only shows info set can-cancel-guess = 1 set cut-function-level = 0 set fitting-method = Levenberg-Marquardt set formula-export-style = normal set guess-at-center-pm = 1 set height-correction = 1 set lm-lambda-down-factor = 10 set lm-lambda-start = 0.001 set lm-lambda-up-factor = 10 set lm-max-lambda = 1e+15 set lm-stop-rel-change = 0.0001 set max-wssr-evaluations = 1000 set nm-convergence = 0.0001 set nm-distribution = bound set nm-move-all = 0 set nm-move-factor = 1 set variable-domain-percent = 30 set width-correction = 1 set epsilon = 1e-12 set data-default-sigma=one set data-default-sigma=sqrt set verbosity = debug set verbosity = normal set verbosity = quiet set verbosity = verbose set exit-on-warning = 0 reset #quit