Skip to content

isis_powder generate_run_numbers() support plus signs in filename list#40833

Merged
SilkeSchomann merged 1 commit intorelease-nextfrom
40648-polaris-plus-filenames
Feb 10, 2026
Merged

isis_powder generate_run_numbers() support plus signs in filename list#40833
SilkeSchomann merged 1 commit intorelease-nextfrom
40648-polaris-plus-filenames

Conversation

@samtygier-stfc
Copy link
Contributor

@samtygier-stfc samtygier-stfc commented Feb 5, 2026

For POLARIS total scattering it is sometimes useful to sum non consecutive runs, e.g. 146554+146603 or 146554+146603-146609. This PR ensures that the POLARIS scripts can handle the plus operator to match Load behaviour.

Description of work

In the ISIS powder POLARIS script, the focus method need to get a flat list of all the file included in a filename string. It does not need the full filename parsing that exists in Load, so it has its own simple implementation. For this comma and plus operators are equivalent.

Converts '+' to ',' so that the existing parsing in IntArrayProperty will work correctly.

Adds tests

Closes #40648

To test:

Test script at:
#40648 (comment)
If it succeeds it will generate a workspace called test


Reviewer

Your comments will be used as part of the gatekeeper process. Comment clearly on what you have checked and tested during your review. Provide an audit trail for any changes requested.

As per the review guidelines:

  • Is the code of an acceptable quality? (Code standards/GUI standards)
  • Has a thorough functional test been performed? Do the changes handle unexpected input/situations?
  • Are appropriately scoped unit and/or system tests provided?
  • Do the release notes conform to the guidelines and describe the changes appropriately?
  • Has the relevant (user and developer) documentation been added/updated?
  • If the PR author isn’t in the mantid-developers or mantid-contributors teams, add a review comment rerun ci to authorize/rerun the CI

Gatekeeper

As per the gatekeeping guidelines:

  • Has a thorough first line review been conducted, including functional testing?
  • At a high-level, is the code quality sufficient?
  • Are the base, milestone and labels correct?

@samtygier-stfc samtygier-stfc added ISIS: Diffraction Issue and pull requests relating to Diffraction at ISIS Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) labels Feb 5, 2026
@samtygier-stfc samtygier-stfc changed the base branch from main to release-next February 5, 2026 14:52
@samtygier-stfc samtygier-stfc marked this pull request as ready for review February 5, 2026 16:07
@sf1919 sf1919 modified the milestone: Release 6.15 Feb 5, 2026
@RichardWaiteSTFC RichardWaiteSTFC self-assigned this Feb 9, 2026
Copy link
Contributor

@RichardWaiteSTFC RichardWaiteSTFC left a comment

Choose a reason for hiding this comment

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

Maybe I'm doing something wrong - but I get the following error for the run number string "139966,139970-139973"

AttributeError: 'tuple' object has no attribute 'strip'

  File "C:\mantid-conda\mantid\scripts\Diffraction\isis_powder\routines\common.py", line 295, in get_first_run_number
    run_numbers = generate_run_numbers(run_number_string=run_number_string)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\mantid-conda\mantid\scripts\Diffraction\isis_powder\routines\common.py", line 208, in generate_run_numbers
    run_number_string = run_number_string.strip()

But when I call the function directly it seems to work...

generate_run_numbers("139966,139970-139973")
Out[2]: [139966, 139970, 139971, 139972, 139973]

Also I think there could be a unit test in this file

# NScD Oak Ridge National Laboratory, European Spallation Source,

@samtygier-stfc
Copy link
Contributor Author

Maybe I'm doing something wrong - but I get the following error for the run number string "139966,139970-139973"

Are you sure you don't have something like:
sample_run_numbers = 139966,139970-139973
that would give you a tuple instead of a string, so strip() would fail.

Also, with a comma, it will still fail in generate_ts_pdf() because that can't handle a WorkspaceGroup. I could add a message for this (now I remember we discussed that.)

In the isis powder POLARIS script, the focus method need to get a flat list of all the file included in a filename string. It does not need the full filename parsing that exists in Load, so it has its own simple implementation. For this comma and plus operators are equivalent.
@samtygier-stfc samtygier-stfc force-pushed the 40648-polaris-plus-filenames branch from fc92296 to 8b8d7e8 Compare February 9, 2026 15:47
Copy link
Contributor

@RichardWaiteSTFC RichardWaiteSTFC 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 test and handling error with group workspace. The error I saw was indeed a typo in my test script - thanks for spotting that! Happy to approve!

@SilkeSchomann SilkeSchomann self-assigned this Feb 10, 2026
@SilkeSchomann SilkeSchomann merged commit 9a6d23e into release-next Feb 10, 2026
10 checks passed
@SilkeSchomann SilkeSchomann deleted the 40648-polaris-plus-filenames branch February 10, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Issues and pull requests that are regressions or would be considered a bug by users (e.g. crashing) ISIS: Diffraction Issue and pull requests relating to Diffraction at ISIS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POLARIS bug processing non-sequential run numbers

4 participants

Comments