Skip to content

Add loadOptions support for event filtering in BIOSANS and GPSANS#1092

Merged
darshdinger merged 2 commits intonextfrom
ewm14352_add_finely_time_slice_with_loadOptions
Feb 5, 2026
Merged

Add loadOptions support for event filtering in BIOSANS and GPSANS#1092
darshdinger merged 2 commits intonextfrom
ewm14352_add_finely_time_slice_with_loadOptions

Conversation

@darshdinger
Copy link
Contributor

Description of work:

This PR implements support for fine-grained event filtering via loadOptions for HFIR SANS instruments (BIOSANS and GPSANS). Users can now specify FilterByTimeStart and FilterByTimeStop parameters in the sample configuration to filter events by time during data loading, similar to the existing functionality in EQSANS.

The implementation extracts loadOptions from the sample configuration and merges them with loading parameters, ensuring the time filtering options are passed through to the Mantid LoadEventAsWorkspace2D algorithm.

Check all that apply:

  • updated documentation and checked that it looks correct in the pull request preview
  • Source added/refactored
  • Added unit tests
  • Added integration tests
  • Included a manual test for the reviewer
  • Verified that tests requiring the /SNS and /HFIR filesystems pass without fail

References:

  • Links to IBM EWM items: EWM # 14352
  • Links to related issues or pull requests: N/A

⚠️ Manual test for the reviewer

To test the event filtering functionality, run the integration tests with the data repository:

pixi shell
pytest tests/integration/drtsans/mono/biosans/test_loadoptions.py -v
pytest tests/integration/drtsans/mono/gpsans/test_loadoptions.py -v
exit

All 6 integration tests should pass (3 for BIOSANS, 3 for GPSANS), testing:

  • Loading with both FilterByTimeStart and FilterByTimeStop
  • Loading without time filtering (baseline)
  • Loading with partial time range (only one filter parameter)

You can also verify the feature works in a reduction script by adding loadOptions to your sample configuration:

reduction_input = {
    "sample": {
        "runNumber": "1322",
        "loadOptions": {
            "FilterByTimeStart": 0.0,
            "FilterByTimeStop": 10.0
        }
    },
    # ... other configuration
}

Check list for the reviewer

  • best software practices
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date and looks correct in the pull request preview
  • code comments added when explaining intent

Execution of tests requiring the /SNS and /HFIR filesystems

It is strongly encouraged that the reviewer runs the following tests in their local machine
because these tests are not run by the GitLab CI. It is assumed that the reviewer has the /SNS and /HFIR filesystems
remotely mounted in their machine.

cd /path/to/my/local/drtsans/repo/
git fetch origin merge-requests/<MERGE_REQUEST_NUMBER>/head:mr<MERGE_REQUEST_NUMBER>
git switch mr<MERGE_REQUEST_NUMBER>
pixi shell  # activate the environment
pytest -m mount_eqsans ./tests/unit/ ./tests/integration/
exit  # exit the environment

In the above code snippet, substitute <MERGE_REQUEST_NUMBER> for the actual merge request number. Also substitute
<my_drtsans_dev_environment> with the name of the conda environment you use for development. It is critical that
you have installed the repo in this conda environment in editable mode with pip install -e . or conda develop .

@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.05%. Comparing base (c18f8f2) to head (d33f5c5).
⚠️ Report is 3 commits behind head on next.

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #1092   +/-   ##
=======================================
  Coverage   86.05%   86.05%           
=======================================
  Files         102      102           
  Lines       11508    11512    +4     
=======================================
+ Hits         9903     9907    +4     
  Misses       1605     1605           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This comment was marked as resolved.

@jmborr

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@neutrons neutrons deleted a comment from coderabbitai bot Feb 5, 2026
Copy link
Member

@jmborr jmborr left a comment

Choose a reason for hiding this comment

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

I left one suggestion to check that the filter is applied. Perhaps you want to include this check in the other test functions

@darshdinger darshdinger requested a review from jmborr February 5, 2026 19:48
Copy link
Member

@jmborr jmborr left a comment

Choose a reason for hiding this comment

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

👌

@darshdinger darshdinger merged commit a3bbd05 into next Feb 5, 2026
6 checks passed
@darshdinger darshdinger deleted the ewm14352_add_finely_time_slice_with_loadOptions branch February 5, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants