## How to use the calculator toolbox?

Both fitter and plotter modules have an adjacent box (just below the data box) that can be used to write commands for processing the data inserted in the data box.

Here are some instructions on how to use this tool.

## Organizing your data in the data box

Your data must be arranged in three columns "x y ey" separated by blank spaces. Here, "ey" represents the experimental error in your dependent variable y. In case you don’t know the value of "ey", you can write 1.0 for all input lines. Please note that the third column can't be left blank.

## Data processing with the calculator toolbox

Each column in the Data box is represented by the character "c" and the order of the columns by successive numbers such as "c1" represents the first column, "c2" represents the second column, and so on. These column notations must also be separated by white spaces. At this moment, fitteia's fitter module does not support the insertion of more than three columns. The following are some examples of performing different operations on your data by using the calculator tool.

### 1- Arithmetic operations on data columns

• c1 c2 1.0 # keeps col1 and col2 as it is but creates a 3rd column in which all numbers have a value of 1.0.

• c1 c2 0.05*c2 # keeps col1 and col2 as it is but creates a 3rd column by multiplying the col2 by 0.05, e.g. col3=col2*0.05.

• cln c1 c2 c3 # 1st col is line number

• 3-6 c1 c2 1.0 # This operation keeps col1 and col2 the same and sets c3=1.0 for lines n=3 to n=6 only.

• 3- c1 c2 1.0 # Starting from the 3rd line till the end of the data, this operation keeps col1 and col2 the same and sets c3=1.0.

• -6 c1 c2 C2*2.0 # Starting from the 1st line till the 6th, this operation keeps col1 and col2 the same but creates a 3rd column by multiplying the col2 by 2.0.

• 5 c1 c2 c2*3.0 # This operation applies just for the line 5.

• c1*a+b*x c3 # Uses the values of fitting parameters a and b from the fitting function where x is your independent variable.

• c1 "c2 + 1" c3 # This operation allows the user to use (induce) blank spaces in the expressions.????????

• -10:3.1:100 # Creates a column with numbers from -10 to 100 in increments of 3.1

• c1 _BPP(c1,a,tau) # Calls the specific library function BPP with the c1 values and fitting parameters a and tau.

• Following is an example of a sequence of commands that generates a simulated data set with 512 points, performs a fast Fourier transform (fft), extracts the real part of the Fourier transform and adds a third column with a fixed value.

• 0:1:511

• c1*0.001

• c1 cos(c1*2*pi/0.005)*exp(-20*c1*c1)

• fft

• c1 c2 1e-6

(Check one by one the output results).

### 2- Getting the average, maxima, minima and zeros of your data

• maxima and minima or maxima and minima # selective select the lines with c2 maxima and minima of a ordered table around the mean value of c2

• average # This command calculates the average of columns 2, 3. . . sharing the same c1 values. When used with "sdv" of "mdv" such as "average sdv" or "average mdv" the mean standard deviation, or the average of the deviations with respect to the average are also calculated, respectively (also works for empty lines, although as a side effect). ???????

### 3- Fancy data selection

• sort/rsort # To sort the data table in ascending or descending order, respectively. For data blocks use "for * sort"

• selif c1 > 1 and c2 < 10, 2 # Selects all lines where c1 is larger than 1.0 and smaller than 10 in steps of 2.0.

• Fancy selection ex: "select 2:3:end-1, i c1 and i+2 c2" # Generates a table with two columns where the elements of col1 are from the col1 of line i and the elements of col2 are from the col2 of line i+2. The selection starts from line 2 in steps of 3 until one line before the end of the data.

### 4- Derivation/integration

1. Derivative

• dci/dcj # Calculates the derivative of column i with respect to column j.

2. Integration

• Ic2dc1: # Calculates the integral through the trapezoidal rule by using the col2 data with respect to the col1. Try this in the plotter module:

• 0:0.01:1

• c1*2*pi

• c1 sin(c1)

• c1 c2 Ic2dc1

You will get a 3 columns table including angle, sin(angle), integral_0^sin(angle).

### 5- Fast Fourier Transform

• fft # This command performs a fast Fourier transform on a two 2^n x y data set table.

### 6- DATA Block operations

• for <block number> operations....; for TAG <string> operations.....

Variants:

• for TAG <string> c1 c2 0.01*c2

Searches hashtag TAG and <string> in that line. For each DATA block whose TAG contains the string it applies the column operations

"for TAG uploaded c1 ....." after a "Data Upload"

• for ALL sort

(character * can be used instead of "ALL" or "all")

for * sort

applies sort to all data blocks (NOTE the difference if you try to use only "sort")

• for 3 c1 c2 sqrt(1.34)

applies the column operations to data set block 3 alone

## The list of existing commands

The following is the list of all calculator toolbox commands:

average | clean | dci/dcj | fft | Icidcj | maxima | minima | rsort/isort | remove | rm | selif | select | !rm/sel | sort | split | xcoord | zeros | for | plot tags