Check if fit flag is set, otherwise return
Make a private copy of the dataset
Apply qz-shift, energy-shift, scaling and translation to the datasets energy table and qz table.
Apply post-modifications to the dataset.
Check, which type of dataset this is. This depends on the data in the dataset. The priority is reflectivity > asymmetry > Rp and Rm. Separate datasets if you want to calculate the different curves.
Calculate the corresponding curve for the same datapoints as the measurement. (This is equivalent to the “use dataset points for simulatio”
Calculate Chi^2 between dataset and simulation.