Skip to content

FastXRFLinearFit ignores "use_limit" #1128

@woutdenolf

Description

@woutdenolf

In FastXRFLinearFit I see that the reference spectrum is also set with an explicit xmin and xmax value which come from the config if FastXRFLinearFit.fitMultipleSpectra did not receive xmin/xmax.

if xmin is None:
    xmin = config['fit']['xmin']
if xmax is None:
    xmax = config['fit']['xmax']
self._mcaTheory.setData(x=x, y=yref, xmin=xmin, xmax=xmax)

In ClassMcaTheory.setData I see this:

xmin = self.config['fit']['xmin']
if not self.config['fit']['use_limit']:
    if 'xmin' in kw:
        xmin=kw['xmin']
        if xmin is not None:
            self.config['fit']['xmin'] = xmin
        else:
            xmin=min(self.xdata)
    elif len(self.xdata):
        xmin=min(self.xdata)

xmax = self.config['fit']['xmax']
if not self.config['fit']['use_limit']:
    if 'xmax' in kw:
        xmax=kw['xmax']
        if xmax is not None:
            self.config['fit']['xmax'] = xmax
        else:
            xmax=max(self.xdata)
    elif len(self.xdata):
            xmax=max(self.xdata)
use_limit Passed xmin/xmax? Actual xmin/xmax used
True Doesn't matter From config['fit']['xmin/xmax']
False Yes Uses passed values (*)
False No Uses min/max of data (xdata)

(*) This is the case for FastXRFLinearFit. The passed values however are config['fit']['xmin/xmax'] when FastXRFLinearFit.fitMultipleSpectra did not receive xmin/xmax. In other words, use_limit is effectively ignored when doing fast fitting. This is a bug imo (limits are always applied).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions