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

Get moveonclick to work #194

Merged
merged 15 commits into from
Sep 9, 2024
Merged

Get moveonclick to work #194

merged 15 commits into from
Sep 9, 2024

Conversation

noemifrisina
Copy link
Contributor

@noemifrisina noemifrisina commented Aug 30, 2024

Multiple moveonclick fixes/changes:

  • Work out a value for zoomcalibrator from fitting curve: so far this value has been fixed to an empirically determined constant that didn't work well for all zoom levels. This adds a way to work out a correct value depending on the zoom level currently in use. Closes I24 SSX: Take into account zoom in click to move #44
  • Fix mouse callback: problem was that using yield from bps.abs_set(pmac.pmac_string, ymovepmacstring, wait=True) in onMouse made it a generator, which couldn't work in setMouseCallback
  • Run the viewer outside of the RunEngine instead of inside.

@noemifrisina noemifrisina marked this pull request as draft August 30, 2024 16:09
@noemifrisina noemifrisina added the I24 serial Issues relating to ssx on I24 label Aug 30, 2024
@noemifrisina noemifrisina changed the title Work out a value for zoomcalibrator in moveonclick Get moveonclick to work Sep 2, 2024
@noemifrisina noemifrisina marked this pull request as ready for review September 2, 2024 16:53
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.

Thanks, just one comment

Comment on lines 54 to 60
zoomcalibrator = RE(_calculate_zoom_calibrator(oav)).plan_result # type: ignore
xmove = -1 * (beamX - x) * zoomcalibrator
ymove = -1 * (beamY - y) * zoomcalibrator
logger.info(f"Moving X and Y {xmove} {ymove}")
xmovepmacstring = "#1J:" + str(xmove)
ymovepmacstring = "#2J:" + str(ymove)
yield from bps.abs_set(pmac.pmac_string, xmovepmacstring, wait=True)
yield from bps.abs_set(pmac.pmac_string, ymovepmacstring, wait=True)
RE(_move_to_position(pmac, xmovepmacstring, ymovepmacstring))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: Instead of calling the run engine twice we could just have a plan that calculates the zoom calibration then moves

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.

Just one comment, sorry.

Comment on lines +61 to +62
yield from bps.abs_set(pmac.pmac_string, xmovepmacstring, wait=True)
yield from bps.abs_set(pmac.pmac_string, ymovepmacstring, wait=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should: Can you either use _move_to_position here or remove the unused function?

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.

Great, thank you!

@DominicOram DominicOram merged commit 08e69ef into main Sep 9, 2024
17 checks passed
@DominicOram DominicOram deleted the 44_zoomcalibrator branch September 9, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I24 serial Issues relating to ssx on I24
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I24 SSX: Take into account zoom in click to move
3 participants