Skip to content

Fix test that failed due to reliance on randomness#631

Merged
alessandrofelder merged 1 commit into
brainglobe:mainfrom
matham:norm
Jul 13, 2026
Merged

Fix test that failed due to reliance on randomness#631
alessandrofelder merged 1 commit into
brainglobe:mainfrom
matham:norm

Conversation

@matham

@matham matham commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?

To test that cube normalization worked, I had a test that created a volume using a normal distribution and then I tested that after normalization the mean was zero and std was 1, within some bounds. The problem is that this test failed in this unrelated PR https://github.com/brainglobe/cellfinder/actions/runs/27896437125/job/82548769409?pr=628. That's because when taking cuboids of the volume, their mean/std was out of the testing bounds simply due to randomness leading to test failure.

What does this PR do?

This creates the volume without relying on randomness, making it so that every cuboid should have similar mean/std. We do it by alternating the values around the mean by +/- std.

References

https://github.com/brainglobe/cellfinder/actions/runs/27896437125/job/82548769409?pr=628

How has this PR been tested?

The test works.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@alessandrofelder alessandrofelder left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @matham - I just had a test spuriously fail for this reason on a different PR which motivated me to get this merged sooner 😂

@alessandrofelder alessandrofelder merged commit 4818388 into brainglobe:main Jul 13, 2026
17 of 18 checks passed
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.

2 participants