Skip to content

Conversation

KyleQianliMa
Copy link
Contributor

@KyleQianliMa KyleQianliMa commented Jul 3, 2025

Description of work

It appears the issue that crashes colorfill plot is a keyword "specNum" being passed in plot_kwargs while carrying a "None" value.

The fix is implemented by removeing it if that happens. "specNum" should not be removed if it carries actual numbers (1,2,3..etc).

Summary of work

Fixes #39618 .

Further detail of work

To test:

Run the following script to load MAR11060. Test normalisation, error bar in tiled plots doesn't crash. Then right click on the workspace and plot in colorfill mode and test normalisation does not crash

from mantid.simpleapi import *
import matplotlib.pyplot as plt
from mantid.plots.utility import MantidAxType

MAR11060 = Load('MAR11060')

fig, axes = plt.subplots(edgecolor='#ffffff', ncols=2, nrows=2, num='MAR11060-1', subplot_kw={'projection': 'mantid'})
axes[0][0].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 1', wkspIndex=0)
axes[0][0].set_xlabel('Time-of-flight ($\\mu s$)')
axes[0][0].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[0][0].legend(fontsize=8.0) #.set_draggable(True).legend # uncomment to set the legend draggable

axes[0][1].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 2', wkspIndex=1)
axes[0][1].set_xlabel('Time-of-flight ($\\mu s$)')
axes[0][1].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[0][1].legend(fontsize=8.0) #.set_draggable(True).legend # uncomment to set the legend draggable

axes[1][0].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 3', wkspIndex=2)
axes[1][0].set_xlabel('Time-of-flight ($\\mu s$)')
axes[1][0].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[1][0].legend(fontsize=8.0) #.set_draggable(True).legend # uncomment to set the legend draggable

axes[1][1].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 4', wkspIndex=3)
axes[1][1].set_xlabel('Time-of-flight ($\\mu s$)')
axes[1][1].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[1][1].legend(fontsize=8.0) #.set_draggable(True).legend # uncomment to set the legend draggable

fig.show()

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@KyleQianliMa KyleQianliMa added this to the Release 6.13 milestone Jul 3, 2025
@KyleQianliMa KyleQianliMa self-assigned this Jul 3, 2025
@KyleQianliMa KyleQianliMa added High Priority An issue or pull request that if not addressed is severe enough to postponse a release. Framework Issues and pull requests related to components in the Framework ORNL Team Issues and pull requests managed by the ORNL development team labels Jul 3, 2025
@KyleQianliMa KyleQianliMa changed the base branch from main to release-next July 3, 2025 14:09
Copy link
Contributor

@jhaigh0 jhaigh0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to have fixed the problem when normalising Colorfill / Contour plots 👍

Copy link
Contributor

@warunawickramasingha warunawickramasingha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the fix - the crash is no longer there! Happy to approve.

Copy link
Contributor

@thomashampson thomashampson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does resolve the problem

@thomashampson thomashampson enabled auto-merge (squash) July 3, 2025 15:38
@thomashampson thomashampson merged commit 722b60a into release-next Jul 3, 2025
10 checks passed
@thomashampson thomashampson deleted the crosshair_colorfill_normalisation_fix_release_next branch July 3, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Issues and pull requests related to components in the Framework High Priority An issue or pull request that if not addressed is severe enough to postponse a release. ORNL Team Issues and pull requests managed by the ORNL development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mantid crashed when normalization is changed on a Colorfill plot with crosshair enabled
4 participants