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

Replace MacroMotor with PseudoPositioner #81

Open
teddyrendahl opened this issue Apr 17, 2018 · 3 comments
Open

Replace MacroMotor with PseudoPositioner #81

teddyrendahl opened this issue Apr 17, 2018 · 3 comments
Assignees
Labels
Replace Feature Replace feature with solution from external library

Comments

@teddyrendahl
Copy link
Contributor

Ophyd has a way to abstract multiple axes into a single object with a scientific unit.

@teddyrendahl teddyrendahl added the Replace Feature Replace feature with solution from external library label Apr 17, 2018
@ZLLentz
Copy link
Member

ZLLentz commented Apr 17, 2018

Ophyd docs at http://nsls-ii.github.io/ophyd/positioners.html#pseudopositioner

PsuedoPositioner basic examples from my testing:

from ophyd.device import Component as Cpt
from ophyd.positioner import SoftPositioner
from ophyd.pseudopos import (PseudoPositioner, PseudoSingle,
                            pseudo_position_argument,
                            real_position_argument)


class Test(PseudoPositioner):
   energy = Cpt(PseudoSingle, limits=(0, 1000))
   motor = Cpt(SoftPositioner, limits=(0, 100), init_pos=10)

   @pseudo_position_argument
   def forward(self, pseudo_pos):
       return self.RealPosition(motor=pseudo_pos.energy/10)

   @real_position_argument
   def inverse(self, real_pos):
       return self.PseudoPosition(energy=real_pos.motor*10)
In [14]: t.position
Out[14]: TestPseudoPos(energy=4.0)

In [15]: t.position.energy
Out[15]: 4.0

In [16]: t.energy.move(40)
Out[16]: MoveStatus(done=True, pos=test, elapsed=0.0, success=True, settle_time=0.0)

In [17]: t.energy.position
Out[17]: 40.0

@ZryletTC
Copy link
Contributor

@klauer this looks familiar 🤔

@ZryletTC ZryletTC self-assigned this Oct 10, 2020
@klauer
Copy link
Contributor

klauer commented Oct 10, 2020

Hah! Indeed it does...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Replace Feature Replace feature with solution from external library
Projects
None yet
Development

No branches or pull requests

4 participants