Architecture of SATLAS2

Architecture of SATLAS2#

The SATLAS2 architecture has been streamlined and differs enormously from SATLAS. For a way to mostly reuse old SATLAS code, see the interface tutorial. Help

In SATLAS2, the main object to work with is the Fitter object. This object can be assigned one or more Source objects through the addSource method. This Source object should be seen as a source for the cost-function calculation, rather than strictly associated with a data source. Each Source can itself contain one or more Model objects, which calculate a response based on parameters and an input. Models that are assigned to the same Source will be added together to generate the total response.

When a Fitter object has multiple Source objects, the total cost function will be calculated by concatenating, essentially performing a simultaneous fit of models to different datasets. The Fitter object uses the LMFIT library for the fitting, for which a Parameters object containing the parameters of all the models is created. This structure allows a very easy way of using the powerful LMFIT expressions to constrain parameters to be shared. For ease of use, the Fitter object contains the shareModelParams and shareParams to set parameters to be shared across models with the same name in different Sources, or simply across all models respectively. The method setExpr can be used to set the expression of a parameter directly.

The architecture can be summarized in the following picture featuring an example:

satlas2_diagram SATLAS2 architecture overview Fitter Fitter Datasource1 Source 1 Name=scan001 Contains x, y, yerr, model response Fitter->Datasource1 Calculates fit from Datasource2 Source 2 Name=scan002 Contains x, y, yerr, model response Fitter->Datasource2 Model1 HFS model Name=Pb208 Contains hyperfine spectrum Datasource1->Model1 Sums together Model2 Background model Name=bkg1 Contains constant background Datasource1->Model2 Model3 HFS model Name=Pb208 Contains hyperfine spectrum Datasource2->Model3 Model4 Background model Name=bkg2 Contains constant background Datasource2->Model4 Model3:s->Model1:s Shares selected parameters with

In this example, a Source with the name scan001 contains two models: the HFS model with the name Pb208, and a background model named bkg1. Also included in the source is some data with x, y and uncertainty of y. A second source with the name scan002 contains another HFS model with the same name, but the background has a different name. Since the HFS models have the same name, shareModelParams can be used on the Fitter object to link desired parameters together, such as the hyperfine parameters. When performing the fit, the Fitter will fit the models in Source 1 to the data in Source 1, and the models in Source 2 to the data in Source 2 simultaneously.

This architecture is a big deviation from the architecture in SATLAS, where the paradigm was that special SumModels and LinkedModels would be created for such occasions. Instead, in SATLAS2, by implementing that models assigned to the same source are summed together and assigning different sources causes a simultaneous fit, several bugs present in SATLAS are avoided simply by reducing the coding complexity. As a bonus, with this standardized implementation, speedups of a factor 20 to 200 can be achieved, as is shown in the benchmark.