Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fitter.custom_plot fails if roi is not defined #256

Open
cosama opened this issue Apr 5, 2021 · 1 comment
Open

Fitter.custom_plot fails if roi is not defined #256

cosama opened this issue Apr 5, 2021 · 1 comment

Comments

@cosama
Copy link
Contributor

cosama commented Apr 5, 2021

I currently get this error:

becquerel/core/fitting.py in custom_plot(self, title, savefname, title_fontsize, title_fontweight, residual_type, **kwargs)
    913                     param_name, v, e, np.abs(e / v))
    914         # Add info about the ROI and units
--> 915         s += 'ROI: [{0:.3f}, {1:.3f}]\n'.format(*self.roi)
    916         s += 'X units: {:s}\n'.format(self.xmode if self.xmode else 'None')
    917         s += 'Y units: {:s}\n'.format(self.ymode if self.ymode else 'None')

TypeError: format() argument after * must be an iterable, not NoneType

if I don't provide the roi kwarg to Fitter.__init__. Temporary fix is to use roi=[0, np.inf]. Seems like by adding ROI to the custom_plot output we require this to be populated.

@jvavrek
Copy link
Contributor

jvavrek commented Apr 5, 2021

Ah, I see, it's the 0:.3f formatting that breaks it. I guess a full if would be more complete:

if self.roi:
    s += 'ROI: [{0:.3f}, {1:.3f}]\n'.format(*self.roi)
else:
    s += 'ROI: None\n'

Edit: even then, if self.roi = (None, None), this doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants