Skip to content

Tidy up PinTipDetection#1880

Merged
DominicOram merged 18 commits intomainfrom
i19-post-pin-tip-cleanup
Feb 6, 2026
Merged

Tidy up PinTipDetection#1880
DominicOram merged 18 commits intomainfrom
i19-post-pin-tip-cleanup

Conversation

@noemifrisina
Copy link
Copy Markdown
Collaborator

Part of i19-bluesky#116

  • Tidy up pin tip detection utils following I19 testing
  • Have the scan direction as input argument instead of reading json file

Instructions to reviewer on how to test:

  1. Run tests

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}

@noemifrisina noemifrisina requested a review from a team as a code owner February 2, 2026 17:26
@noemifrisina noemifrisina changed the title I19 post pin tip cleanup Tidy up PinTipDetection Feb 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.03%. Comparing base (1d5983f) to head (17a5d60).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1880   +/-   ##
=======================================
  Coverage   99.03%   99.03%           
=======================================
  Files         305      305           
  Lines       11519    11522    +3     
=======================================
+ Hits        11408    11411    +3     
  Misses        111      111           

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

Thanks, some suggestions. Basically this goes half way to decoupling it but not finishing the job, which sort of feels worse

@@ -235,22 +235,24 @@ def _locate_sample(self, edge_arr: np.ndarray) -> SampleLocation:

# Choose our starting point - i.e. first column with non-narrow width for positive scan, last one for negative scan.
if self.scan_direction == ScanDirections.FORWARD:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could: If we're going to do this then we might as well decouple it entirely and set the enum to be:

class ScanDirections(Enum):
    FORWARD = auto()
    REVERSE = auto()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could: You can just set the type of this to be ScanDirections then you don't need to do the cast below

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I tried that in the first instance and got turned around by various typing issues - which is also how a random #type: ignore appeared and was forgotten. Trying again after I address the rest of the comments

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: This is still relying on the value of the enum so if we want to decouple them it should be if self.scan_direction == ScanDirections.FORWARD

def setup_pin_tip_detection_params(
pin_tip_detect_device: PinTipDetection,
parameters: OAVParameters,
scan_direction: ScanDirections = ScanDirections.FORWARD, # type: ignore
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should: Why the type ignore here?

Copy link
Copy Markdown
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.

Great, thank you!

@DominicOram DominicOram merged commit daee0a7 into main Feb 6, 2026
10 checks passed
@DominicOram DominicOram deleted the i19-post-pin-tip-cleanup branch February 6, 2026 14:57
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