Skip to content

Include spectrum number in sequential fit output workspaces names #39605

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

MohamedAlmaki
Copy link
Contributor

@MohamedAlmaki MohamedAlmaki commented Jul 1, 2025

Description of work

This PR updates the names of the PlotPeakByLogValue output workspaces to include the spectrum number, clarifying which workspace corresponds to each spectrum. The naming convention was approved by Spencer.

Fixes #39294

Further detail of work

The implementation involves enabling the alwaysStoreInAds option in the child Fit algorithms. It turned out that because this option was not enabled, the output workspace returned by the Fit algorithm was an empty string. This is why the output names are the same as the group workspace name, numbered by their position.

To test:

1- Load any data (e.g. iris26176_graphite002_red)
2- Go to Plot Spectrum and click Fit
3- Add a peak (e.g. Lorentzian)
4- Press Sequential Fit, and a dialogue will open
5- Check the Create Output check box
6- In the table view, set Range to any preferred workspace index range (e.g. 4-6)
7- Press Fit
8- You will see 3 output group workspaces suffixed with "_Parameters", "_NormalisedCovarianceMatrices" and "_Workspaces"
9- Each group workspace will have the same number of spectra in the selected range
10- You can see that each workspace name includes the spectrum number and is suffixed with "_Parameters", "_NormalisedCovarianceMatrix" and "_Workspace" in each group, respectively (e.g. iris26176_graphite002_red_res_3_Parameters)


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.

@MohamedAlmaki MohamedAlmaki changed the title Include spectrum number in sequential fit output workspace names Include spectrum number in sequential fit output workspaces names Jul 1, 2025
@MohamedAlmaki MohamedAlmaki added ISIS: Core Issue and pull requests at ISIS that relate to Core features and functions Reported By User Issues that were found or highlighted by a user/scientist labels Jul 1, 2025
@MohamedAlmaki MohamedAlmaki added this to the Release 6.14 milestone Jul 1, 2025
@MohamedAlmaki MohamedAlmaki marked this pull request as ready for review July 1, 2025 12:01
@MialLewis
Copy link
Contributor

MialLewis commented Jul 17, 2025

Sorry for taking so long to review this.

I've just done some functional testing, and it's not clear to me what the numbers appended to each workspace are.

You say in the PR that they are spectrum numbers. The range input into the table appears to be workspace index.

If I do a range of 4:6, I see workspaces appended 3, 4 and 5. I would have expected 4, 5, 6.

Are the numbers in the table in spectrum number, and the numbers appended to the workspace in workspace index?

It makes sense to me to align these.

@MohamedAlmaki
Copy link
Contributor Author

MohamedAlmaki commented Jul 17, 2025

Yes, the range in the table is workspace index, and numbers appended to the output names are the spectrum numbers. It is implemented like that because the Fit algorithm output uses spectrum numbers. Either we change the interface workspace index to be spectrum numbers, or maybe modify the Fit algorithm to include the workspace index instead. I could add a new property for the name mode to either the workspace index or the spectrum number to the algorithm

@MialLewis
Copy link
Contributor

Yes, the range in the table is workspace index, and numbers appended to the output names are the spectrum numbers

I don't think this is working in that way.

Intentionally or not, the numbers in the table are spectrum numbers. The logic is here:

The numbers then appended to the workspace are the workspace index.

The tool tip in the SequentialFitDialog window is unclear, can we improve it?

It references a numeric axes, which the underlying algorithm PlotPeakByLogValue is set up to handle. At least the test workspace we used here does not have a numeric axis, is actually at all relevant to the SequentialFitDiag?

@SpencerHowells
Copy link

@MialLewis The sequential fit dialogue & tooltip appears to be written for several workspaces. For a single workspace with many spectra they are incomprehensible. Hence my request!

@MohamedAlmaki
Copy link
Contributor Author

Yes, you are correct, thanks for spotting that. I got confused and switched the two numbers. I will unify the number used in the interface with the one appended to the names. The tests were mainly written to test if the output names are correct, but I will add a test to cover the numeric axis case

@MohamedAlmaki
Copy link
Contributor Author

Currently in PlotPeakByLogValue, the user can specify the range of fitting using three different indices: either workspace index, spectrum index or numeric value. I have added logic to include the type and value of each one in the output names.
New updates:

  • Handles all types of ranges, spectra, numeric and workspace index, where these abbreviations (sp, v, i) are used as prefixes for each, respectively.
  • Append the full range to the group output name, too.
  • Match the sequential fit interface output with the range provided; the range in the interface could either be a range of spectra numbers or a range of numeric values (sp is used for spectra and v for numeric values)
  • Add a note to the tooltip that the numeric axis could be a spectrum axis
  • Update tests to handle all three cases

@MohamedAlmaki MohamedAlmaki force-pushed the 39294_improve_output_names branch 5 times, most recently from 37f9131 to 92d9204 Compare August 11, 2025 15:24
@MohamedAlmaki MohamedAlmaki force-pushed the 39294_improve_output_names branch from 92d9204 to b5d312c Compare August 13, 2025 08:58
@MohamedAlmaki MohamedAlmaki force-pushed the 39294_improve_output_names branch from b2a71d1 to c018f74 Compare August 21, 2025 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: Core Issue and pull requests at ISIS that relate to Core features and functions Reported By User Issues that were found or highlighted by a user/scientist
Projects
Status: No status
Status: No status
Development

Successfully merging this pull request may close these issues.

Improve the naming of Sequential Fit output
3 participants