Re: [PyMca] Documentation for FastXRFLinearFit
Brought to you by:
vasole
From: PyMca g. p. m. list. <pym...@li...> - 2019-12-11 14:37:02
|
Dear Armando, This is a very useful explanation. As I now understand the algorithm, you are finding the least-squares solution to the classic Ax=b problem. This also seems to be what Chris Ryan and the Geopixie software suite is doing with their 'Dynamic Analysis'. I am, however, still confused about how the uncertainty weights are applied to the 'Design Matrix'. Is there a separate matrix of weights? How are these weights predetermined? Is their physical basis really counting statistics as you suggest? It would be useful if you could provide a little more mathematical description of this aspect of the Fast Linear XRF fit algorithm. Thanks! And Happy Holidays! Best, Marc On Fri, Dec 6, 2019 at 10:58 AM PyMca general purpose mailing list. < pym...@li...> wrote: > Dear Marc, > > What follows is a copy-paste of the text from the slides I use for > training: > > """ > As you may have found out with the standard fit, maximum speeds can be > achieved when you can afford a linear fit: > > - Non linear parameters have been previously determined and kept fixed > - No pile up is considered (remember: pile up is not the same on each > pixel and average pile up has no meaning > > On a linear fit, the signal can be written as a matrix product: > > Measured Signal B = Design Matrix * A > > In other words, the measured spectrum B is obtained as a linear > combination of the columns of the Design Matrix and we have to find the > coefficients A on that basis. > > The uncertainties on the measured data enter as weights in the Design > Matrix that has n_channels rows and m_model_parameters columns. > > Therefore, in the linear fit we need the "equivalent of a matrix inversion > and a matrix multiplication" to obtain the A parameters. > > If we assume that the uncertainty associated to the counts in a channel is > the same on all the measured spectra, the Design Matrix will be the same in > every point and only one matrix inversion equivalent is needed. > > That corresponds to: > > - Using No Weight (assume uncertainty is 1 everywhere) or > - Use an average Weight (derive channel uncertainty from the sum spectrum) > > All that is achievable from the GUI or from the command line (no GUI) in > source installation of PyMca: > > python -m PyMca5.PyMcaPhysics.xrf.FastXRFLinearFit > --cfg=configuration_file --weight=0 --tif=1 --concentrations=0 --refit=0 > hdf5_file_name::dataset_path > > """ > > Concerning your specific question: The background is accounted for or not > following what you requested via the fit configuration file. Remember that > all the non-linear parameters will be fixed to their values in the fit > configuration file. If they are wrong they will remain wrong. To help on > that, the fit configuration window allows you to load the parameters of the > last fit into the configuration ("Load from Fit"). > > Best regards, > > Armando > _______________________________________________ > PyMca-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymca-users > |