Skip to content

Commit af4d0e0

Browse files
committed
Use the azimuthal lineout range in WPPF difference
This gives a better feel for how much error there is, on a first glance. The difference plot is always *at least* the same as the lineout range, but the top and bottom are stretched to contain the whole difference plot. Fixes a subissue in #1926 Signed-off-by: Patrick Avery <[email protected]>
1 parent b70947d commit af4d0e0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

hexrdgui/image_canvas.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,13 @@ def update_wppf_plot(self):
18231823

18241824
last_lineout = HexrdConfig().last_unscaled_azimuthal_integral_data
18251825
diff_axis = self.wppf_difference_axis
1826+
1827+
# Rescale.
1828+
# This actually ignores the scatter plot data when rescaling,
1829+
# which is fine. We will stay zoomed in on the line.
1830+
axis.relim()
1831+
axis.autoscale_view(scalex=False)
1832+
18261833
if diff_axis and wppf_data and last_lineout:
18271834
style = {
18281835
'c': '#000000',
@@ -1841,15 +1848,15 @@ def update_wppf_plot(self):
18411848
diff_axis.relim()
18421849
diff_axis.autoscale_view(scalex=False)
18431850

1851+
# When the difference plot resets, always set it to be
1852+
# initially the same y range as the azimuthal.
1853+
new_ymin = min(diff_axis.get_ylim()[0], axis.get_ylim()[0])
1854+
new_ymax = max(diff_axis.get_ylim()[1], axis.get_ylim()[1])
1855+
diff_axis.set_ylim((new_ymin, new_ymax))
1856+
18441857
# Update the difference label even if there's no data
18451858
self.update_wppf_difference_labels()
18461859

1847-
# Rescale.
1848-
# This actually ignores the scatter plot data when rescaling,
1849-
# which is fine. We will stay zoomed in on the line.
1850-
axis.relim()
1851-
axis.autoscale_view(scalex=False)
1852-
18531860
def update_wppf_difference_labels(self):
18541861
axis = self.wppf_difference_axis
18551862
if not axis:

0 commit comments

Comments
 (0)