Skip to content

Conversation

@Villtord
Copy link
Contributor

@Villtord Villtord commented Jan 14, 2026

Fixes #1818
IT might be handy to have it - specifically I will use it in the upcoming Apple Knot class which has rectangular exclusion zones.

Instructions to reviewer on how to test:

  1. Do look at the class
  2. Confirm tests path

Checks for reviewer

  • Would the PR title make sense to a scientist on a set of release notes
  • If a new device has been added does it follow the standards
  • If changing the API for a pre-existing device, ensure that any beamlines using this device have updated their Bluesky plans accordingly
  • Have the connection tests for the relevant beamline(s) been run via dodal connect ${BEAMLINE}

@Villtord Villtord self-assigned this Jan 14, 2026
@Villtord Villtord marked this pull request as ready for review January 14, 2026 14:52
@Villtord Villtord requested a review from a team as a code owner January 14, 2026 14:52
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.05%. Comparing base (905cd1f) to head (c43b3f1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1815      +/-   ##
==========================================
+ Coverage   99.04%   99.05%   +0.01%     
==========================================
  Files         289      289              
  Lines       10986    11000      +14     
==========================================
+ Hits        10881    10896      +15     
+ Misses        105      104       -1     

☔ 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.

Copy link
Contributor

@oliwenmandiamond oliwenmandiamond left a comment

Choose a reason for hiding this comment

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

This seems like something that scanspec achieves. Have you had a look at from scanspecs.regions import Rectangle for example?

@Villtord
Copy link
Contributor Author

Emm, no - I didn't, but for such simple thing I don't think it's necessary to rely on "yet another external python package" which can change with time

@Villtord Villtord enabled auto-merge (squash) January 14, 2026 15:04
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

Emm, no - I didn't, but for such simple thing I don't think it's necessary to rely on "yet another external python package" which can change with time

I disagree, scanspec is:

  • Already in the bluesky ecosystem
  • Actively maintained by people inside DLS
  • Already imported by dodal

If it doesn't fit the usecase that's fine but then can you link to a PR/issue explaining the usecase? I'm worried that this is a slippery slope to reinventing existing python libraries (which is particularly egregious if we're reinventing something written in the next office to ours)

@Villtord
Copy link
Contributor Author

Villtord commented Jan 14, 2026

With all respect - having a package in bluesky ecosystem does not guarantee it won't break downstream packages in a next release as proven countless times by dependent packages in bluesky ecosystem (ophyd-async - dodal - daq-server and so on)

Also, I don't see what can be slippery in writing a simplest possible internal util Rectangle class. Sometimes reinventing simple things is not bad and gives more control and stability.

With this being said - I don't think scanspec.region.Rectangle class fit into my simple purpose - I will write an issue explaining why. Thanks for looking at this PR!

@Villtord Villtord linked an issue Jan 14, 2026 that may be closed by this pull request
@Villtord
Copy link
Contributor Author

Added issue #1818

@Villtord
Copy link
Contributor Author

As a follow up on this discussion - regions.py was deleted from scanspec in this recent PR:
bluesky/scanspec@159f25f
and Rectangle class do not exist anymore - probably replaced by Polygon but I am not sure.

...

@Villtord Villtord requested a review from DominicOram January 16, 2026 09:47
Copy link
Contributor

@DominicOram DominicOram left a comment

Choose a reason for hiding this comment

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

With all respect - having a package in bluesky ecosystem does not guarantee it won't break downstream packages in a next release as proven countless times by dependent packages in bluesky ecosystem (ophyd-async - dodal - daq-server and so on)

Also, I don't see what can be slippery in writing a simplest possible internal util Rectangle class. Sometimes reinventing simple things is not bad and gives more control and stability.

With this being said - I don't think scanspec.region.Rectangle class fit into my simple purpose - I will write an issue explaining why. Thanks for looking at this PR!

Ok, you've convinced me. Thank you for adding the issue

@Villtord Villtord merged commit d245f0a into main Jan 16, 2026
17 of 18 checks passed
@Villtord Villtord deleted the math_add_rectangle_class branch January 16, 2026 17:04
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.

Make a helper rectangle class

5 participants