Skip to content

Commit

Permalink
fix: setting bad fit range lead to ValueError during plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 30, 2020
1 parent 39e1bb5 commit ed62c35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.7.2
- fix: setting bad fit range lead to ValueError during plotting
0.7.1
- fix: wrong SI units assigend to fit results parameters
- setup: bump afmformats from 0.9.0 to 0.10.0
Expand Down
11 changes: 7 additions & 4 deletions pyjibe/fd/mpl_indent.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ def update(self, fdist, rescale_x=None, rescale_y=None):
self.axis_res.set_ylabel("residuals [{}]".format(yunit))
self.axis_main.set_ylabel("{} [{}]".format(yaxis, yunit))

if "fit" in fdist.data:
if "fit" in fdist.data and np.sum(fdist["fit range"]):
self.plots["residuals"].set_visible(True)
self.plots["fit"].set_visible(True)
self.plots["fit range"].set_visible(True)

self.plots["fit"].set_data(fdist["tip position"]*xscale,
fdist["fit"]*yscale)
Expand All @@ -101,12 +102,14 @@ def update(self, fdist, rescale_x=None, rescale_y=None):
xy[:, 0] = fitmax
xy[2:4, 0] = fitmin
self.plots["fit range"].set_xy(xy)

self.update_plot(rescale_x=rescale_x,
rescale_y=rescale_y)
else:
self.plots["residuals"].set_visible(False)
self.plots["fit"].set_visible(False)

self.update_plot(rescale_x=rescale_x,
rescale_y=rescale_y)
self.plots["fit range"].set_visible(False)
self.canvas.draw()

def update_plot(self, rescale_x=None, rescale_y=None):
"""Update plot data range"""
Expand Down

0 comments on commit ed62c35

Please sign in to comment.