pymmcore-plus / useq-schema

An implementation agnostic schema for describing a sequence of events during a multi-dimensional imaging acquisition.
https://pymmcore-plus.github.io/useq-schema/
BSD 3-Clause "New" or "Revised" License
14 stars 5 forks source link

feat: add RelativePosition instead of GridPosition #169

Closed tlambert03 closed 2 weeks ago

tlambert03 commented 2 weeks ago

when looking at #166, I realized that GridPosition is pretty much only there to represent the concept of some "offset" relative to an absolute position. This PR renames GridPosition to RelativePosition, and uses it more braodly

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 96.15385% with 2 lines in your changes missing coverage. Please review.

Project coverage is 95.60%. Comparing base (c024a68) to head (886a57a).

Files Patch % Lines
src/useq/_position.py 92.30% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #169 +/- ## ========================================== - Coverage 95.65% 95.60% -0.05% ========================================== Files 15 15 Lines 1058 1069 +11 ========================================== + Hits 1012 1022 +10 - Misses 46 47 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tlambert03 commented 2 weeks ago

note @fdrgsp, this PR removes row/col from GridPosition, not for any particular reason, but that i realized it's not actually being used here anywhere... do you have thoughts on where if anywhere those were used?

tlambert03 commented 2 weeks ago

found it :)

________________________________________________________________________________
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_widgets/_mda/_grid_widget.py", line 554, in _move_to_row_col
    if pos.row == row and pos.col == col:
       ^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pydantic/main.py", line 827, in __getattr__
    raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'RelativePosition' object has no attribute 'row'
tlambert03 commented 2 weeks ago

i added back row/col ... they're not actually used anywhere, so I'm tempted to remove them, but we can leave that for another discussion. I like how this unifies the concept of positions used across useq, so would like to get this in before release. have a look when you can @fdrgsp