Skip to content
wojdyr edited this page Jan 29, 2012 · 8 revisions

Syntax Changes in 0.9.5

In version 0.9.5 the old parser based on Boost::Spirit is replaced with a new hand-crafted parser. Large part of the libfityk library has been rewritten. The GUI should work like in previous versions.

Users who maintain fityk scripts may use this converter (written in Python): https://gist.github.com/794253 to update the scripts. After using the converter scripts may require manual tweaking.

As usually, feedback is welcome.

datasets specification

  • cmd in @2@2: cmd
  • cmd in @2, @3@2 @3: cmd
  • cmd in @*@*: cmd

Datasets before : are handled in a generic way. If multiple datasets are given, the command is executed multiple times, one time for each datasets.

This:

@0 @0 @0: fit 5

performs fitting of the same dataset three times, every time 5 iterations.

Commands fit and plot can take dataset also as an argument:

@*: fit # fit all datasets one by one
fit @*  # fit all datasets together (it can be slower)

plot [] @* # given datasets are used only to determine min_[xy] and max_[xy]

If dataset is omitted, the default one is used. The default dataset can be changed with a new command use @n. Initially, @0 is default.

info

There are three printing commands now: info, print and debug.

  • debug is used mostly for testing the program itself and most of the users will not need it.
  • print is mainly used to output numbers (expression values)
  • info is used for everything else

The print command is followed by a comma-separated list of expressions and/or strings:

=-> p pi, pi^2, pi^3
3.14159 9.8696 31.0063
=-> with numeric_format='%.15f' print pi
3.141592653589793
=-> p '2+3 =', 2+3
2+3 = 5

The other valid arguments are filename and title. They are useful for listing the same values for multiple datasets, e.g.:

=-> @*: print filename, F[0].area, F[0].area.error

print can also print a list where each line corresponds to one data point:

=-> print all: x, y
[a list with all points is printed]
=-> print all: x, y, F(x), abs(y-F(x))
...

It is possible to select which points are to be printed by replacing all with if followed by a condition:

=-> print if a: x, y # only active points are printed
...
=-> print if x > 30 and x < 40: x, y
...

info arguments are keywords (listed in the manual), functions (%f), variables ($v), and function types.

=-> i version
Fityk 0.9.5
=-> i formula
66424*exp(-ln(2)*(((x)-24.7118)/0.1354)^2)+6000/(1+(((x)-34.926)/0.19345)^2)
=-> i simplified_formula 
66424*exp(-37.8084*(x-24.7118)^2)+6000/(1+26.7216*(x-34.926)^2)
=-> i Linear
Linear(a0=intercept, a1=slope) = a0 + a1 * x

Some keyword arguments require sub-arguments.

Variable values can be shown with both info and print:

=-> i $_1
$_1 = ~66424 = 66424  [auto]
=-> p $_1
66424

Both info and print can be redirected to a file by appending >> filename or >filename:

=-> print all: x, y >> foo.dat # export data
=-> info state >> foo.fit      # save session

With one exception: print expression > filename does not work if the filename is not enclosed in single quotes. That is because the parser interprets > as a part of the expression. The workaround is to use quotes: print 2+3 > 'filename'. The same result can be achieved with two commands: delete file filename; print 2+3 >> filename.

set

  • all keyword values are lowercase
  • removed formula_export_style (there are separate info arguments for different styles: info formula and info gnuplot_formula
  • removed guess_at_center_pm and can_cancel_guess
  • info_numeric_formatnumeric_format
  • instead of 3 possible values of autoplot, there are now two boolean options: autoplot and fit_replot.
  • verbosity takes integer values (-1 .. 2) instead of keywords
  • set @0.title = ...@0: title = ...
  • new options logfile and log_full

guess

  • parameter center in not special anymore
  • guess Func [20:40] center=30guess Func(center=30) [20:40]
  • %f = guess Func in @0guess %f=Func in @0

other changes

  • commands > fileset logfile file
  • commands < fileexec file
  • commands ! shell-commandexec ! shell-command
  • dump > fileinfo state > file
  • numarea(%f, 10, 30, 100)%f.numarea(10, 30, 100)
  • numarea(F, 10, 30, 100)F.numarea(10, 30, 100)
  • F -= %f → not possible (use delete %f or F = ...)
  • F.param = $variable -> F[*].param = $variable
  • Added delete file filename. It is not an error to try to delete a non-existing file.
  • error in script stops the script now