# 2. Basic Concepts¶

## 2.1. Data¶

The data is stored in a tree-like structure. The root element is the project. The next lower level is that of the plots, each of which can hold an arbitrary number of sets. A set is a 2d array containing the x-y data, where the x-data is ordered (typical for spectroscopic data). This data structure is represented by the tree view on the right side of the main window. In addition to the plain x-y data, a set can have various objects attached, such as transformations (trafo), a fit model and weights.

Unlike many other data analysis programs, peak-o-mat allows for data manipulation/transformation on a higher level than operating on the raw data through a spreadsheet like interface. As peak-o-mat is especially designed to work with spectroscopic data, arithmetics on sets will do what you would expect intuitively, e.g. adding two sets will only add the y-data, while interpolating the x-axes in case they differ. Those kind of manipulations can be done using the ‘Set operations’ module. If you need to do more complicate operations, you can still copy the data to a data grid and manipulate the data there by means of a python shell.

## 2.2. Models¶

A model describes the relation between independent and response variable of the data set. It may be described by

• a valid python expression, where x stands for the set’s x-values. You can use arbitrary variable names containing alphanumeric characters, e.g. “a*x-b0*x**2”. Also, all mathematical functions, which are defined in the toplevel namespace of the python numpy package are avilable. In the model expression the function name has to be prefixed by np., e.g. “amp*np.exp(-x/beta)”. In case the model is too complicated to be entered in a single line, or you just need more flexibility, you can use your own python functions as model. Physical constants are available through prefixing their common name by ‘c_’, e.g. ‘c_e’ referes to the elementary charge. See the ‘customisation’ section for how to define custom functions and add constants.
• a space separated list of pre-defined symbols, here called tokens, which represent common background and peak shapes. The function values represented by the tokens are finally added, e.g. “CB LO GA LO” represents a model with a constant background, one gaussian peak and two lorenzian peak shapes. You can append a number to any token to be able to distinguish them later, e.g. “CB LO1 GA LO2”. Instead of the whitespace between the tokens, the ‘+’ operator can be used. In some rare cases you might want to multiply the function represented by the tokens. This can be achieved by using the ‘*’ operator. The model is evaluated from left to right and the usual sign rules do not apply. You may define customs tokens similar to the definition of custom functions. See the ‘customisation’ section for details.

Once a model has been fitted to a data set, the model including the fitted parameters is attached to the set and whenever the set is selected, the model is evaluated and displayed together with the data.