Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/instruments/newport/newportesp301.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def velocity(self):

@velocity.setter
def velocity(self, velocity):
velocity = abs(velocity)
Copy link
Contributor

Choose a reason for hiding this comment

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

why take abs here?

velocity = float(
assume_units(velocity, self._units / (u.s))
.to(self._units / u.s)
Expand Down Expand Up @@ -868,11 +869,13 @@ def move_to_hardware_limit(self):
"""
self._newport_cmd("MT", target=self.axis_id)

def move_indefinitely(self):
def move_indefinitely(self, direction: str = "+"):
"""
Move until told to stop
Move until told to stop in the direction ("+" or "-") passed.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of magic strings as arguments. I would rather see an enum, or just forward/reverse booleans.

"""
self._newport_cmd("MV", target=self.axis_id)
if direction not in ("+", "-"):
raise ValueError("Direction must be '+' or '-'")
self._newport_cmd(f"MV{direction}", target=self.axis_id)

def abort_motion(self):
"""
Expand Down