How to Fit Data

Data Format

Increasing time points in first column (xdata), and ydata in adjacent columns (no wavelengths). The point is used as decimal separator. Any format can be used that Matlab can import (check this for your format). The most common formats are space, tab or comma separated, and the default extension is .dat. It is possible to use your own wavelength calibration file, by creating a separate file containing a row of wavelengths corresponding to the columns given in the data file (See Calibration section). The time units are defined by your dataset.

Load Data

Press the 'Load Data' button to select your data file, and a 3D preview of the data is shown. It is not necessary to navigate to the data directory with the Matlab main window. Explore all angles of your data after pressing the Rotate 3D icon (or select Tools>Rotate 3D in the menu structure), click on the graph and drag the mouse around. In addition, a second figure allows for the exploration of the data. A surface plot of the data is shown. A mouse click inside the surface plot activates a cross-hair, which can be pointed to a specific data point. A slice in time (i.e. the spectrum), and wavelength (i.e. the time trace) is shown. Depending on the toggle button in the Plotting panel of the gui, the time axis is logarithmic (default), or linear. Obviously, negative times cannot be displayed by a logarithmic scale. Switch therefore to linear for the full time scale.

Model Selection

A model can be loaded only if time constants are defined in the Fitting Parameters section. The time constants are based on Mass Action kinetics, and represent the (average) time in which a population halves over time. The basis function is an exponential. Using SbioDesktop, it is possible to graphically create different kinetic models. Note that the time constant is defined in 1/s units. Parallel and sequential models for up to 6 defined time constants are supplied with the software, so that one quickly can scan through different models. The user can define a model graphically with any desired connectivities. The number of defined time constants must match the number in the created model.

Fitting Parameters

Two algorithms can be used: non-linear fitting via the Least-Squares method, and 'Pattern Search' (see Matlab's documentation). Although the pattern search option takes significantly longer, it is useful in determining if the found minimum is a global minimum, and not a local one. For the least-squares method, Matlab uses a default convergence criterion (1e-6). More resticted convergence can be obtained by selecting the 'Better accuracy' option. After fitting the time constants can be 'grabbed' into the gui from the optimised values. Advanced fitting is possible by constraining certain parameters. It is possible to fix one or more time constants by activating the contraints first, and then stating which (indexed) rate needs to be fixed, so '2 4' for the second and fourth values. Leave '0' for none. A spectrum that belongs to a certain time constant can be fixed to the spectrum of another component, again by stating the indices in pairs, and starting by the highest index. For example: '3 2' symbolises that the third and second time constants have equal spectra. More pairs can be given by colon separation (i.e. '3 2;5 4').

Calibration

The data is displayed as function of time and wavelength. The column index is taken as the wavelength, but a specific wavelength file can be loaded that represents the exact measured values for the wavelengths. Pressing the Calibrate button opens up a file search box that needs to point to the calibration file. This can have a different location from the data file. The calibration file should contain the values in a single line.

Dispersion estimation and instrument response function

Ultrafast spectroscopy measurements may exhibit a wavelength-dependent shift of time zero (chirp, dispersion). The shift in time zero is fitted with an empirical formula that models its order (linear corresponds to first order, quadratic to second order, etc. until n-th order). Set starting parameters for the dispersion relation first, and fit the onset of the signal. The onset is estimated by calculating the cross-correlation between each signal and an impulse or instrument response function (IRF). The maximum gradient between a step-function IRF (note that this IRF is not the same as the IRF which can be defined in the gui) and each channel is then fitted. To increase the speed of this method an interpolation function is used. This is required since the function used to calculated the cross correlation does not accept irregularly time-spaced intervals. The interpolation requires that the dispersion needs to be estimated separately, and cannot be done fully automatically since the time bases may differ for each experiment. The procedure is that one zooms into the time region where the signal starts. This method works best if the first appearance of any signal in your dataset is around 0 (zero). This can be done inside the gui by using the 'Time shift' parameter (which is an absolute value). In addition, your dataset must contain time zero, because otherwise the IRF step-function has no amplitude (it is centered at time zero). Two (sub)plots that are generated after fitting, which show the dispersion curve superimposed on the data and the 'raw' results from the cross-correlation method described. A robust fit method is employed to minimise the influence of outliers due to lack of signal in specific regions (hence producing a false cross-correlation value). If the dispersion is modelled satisfactorily, it is possible to fit the results (save figures and data), and select the 'Apply?' toggle to use it straight away for a global analysis session. Check the screenshots section for an example on how to use dispersion fitting. An IRF is also separately available for data fitting. The convolution of an exponential decay function and the IRF is done via an analytical expression (as in van Stokkum et al. BBA, 2004, 1657, p.82-104). Give starting values (full width half maximum FWHM and time zero), and fix them if desired.

Plotting

After a fit has completed, a number of figures are automatically generated. It is also possible to reload the results of a previous fitting session. This to prevent clutter of you screen with too many figures. Close all figures first with 'Close figures', and press 'Replot'. It is also possible to just reload generated figures, by using the 'Open figs' button. Visualise as many figures as you want by selecting the desired figures, in combination with the Shift and Ctrl buttons of your keyboard. It is recommended to save each satisfactory fitting session for every used model in a seperate folder.

Saving data and figures

All visible figures are saved to the current directory (check and/or change this in the main Matlab window). The fitted data is saved as well, and an overview file that contains the most important information about your model and its fitting parameters. The information it writes to this file is shown in the Command Window after each fitting session. The parameters are appended to the file if it already exist to prevent the cancellation of previous succesful runs.

Saving settings

An input file can be saved for future use and replication of results. You can easily continue a fitting session where you last left off, by loading a previously saved input file (see Recall settings).

Recalling settings

A previously saved input file can be loaded and used straight away. The fields in the GUI are updated accordingly.

Demos and Screenshots A more hands-on approach is also available. Check out the screenshots section.

See Also