Skip to content
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

Return "Outside atlas" rather than key error #299

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

adamltyson
Copy link
Member

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
When querying for structures as ID from coordinates, out of bounds coordinates return 0, but when asking for an acronym, it raises a KeyError value.

What does this PR do?
Rather than a key error, "Outside atlas" is returned

References

Closes #157

How has this PR been tested?

New tests added & checked manually

Is this a breaking change?

Nope

Does this PR require an update to the documentation?

Don't think so

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

@adamltyson adamltyson requested a review from a team May 17, 2024 14:22
@adamltyson adamltyson changed the title Return out of brain rather than key error Return "Outside atlas" rather than key error May 17, 2024
Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

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

Minor style point, otherwise LGTM

@@ -102,6 +102,22 @@ def test_data_from_coords(atlas, coords):
)


def test_data_from_coords_out_of_brain(
atlas, coords=(1, 1, 1), key_error_string="Outside atlas"
Copy link
Member

Choose a reason for hiding this comment

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

What's the reason for coords and key_error_string to be arguments of the test function?

I think they should just be defined in the test function body?

Copy link
Member Author

Choose a reason for hiding this comment

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

No reason. I think I usually do it so anything that may need to be changed is at the top of the function. Will move it into the function.

@alessandrofelder alessandrofelder merged commit ca58fb1 into main May 17, 2024
11 checks passed
@alessandrofelder alessandrofelder deleted the out-of-brain branch May 17, 2024 16:13
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.

[Feature] Add an "Out of brain" acronym for the ID 0
2 participants