Skip to content

newport

borealis.controller.newport

Created on Wed Mar 15 16:42:03 2023.

@author: A. Vancraeyenest

NewportXPS(ip_address, alias='', port=5001, timeout=1000)

Bases: Controller

Class to communicate with Newport controller.

Initialise the connection to the device.

Source code in borealis/controller/newport.py
24
25
26
27
28
29
30
31
32
def __init__(self, ip_address: str, alias: str = "", port: int = 5001, timeout: int = 1000):
    """Initialise the connection to the device."""
    self._xps = xps.XPS()
    ans = self._xps.OpenInstrument(ip_address, port, timeout)
    LOGGER.debug("Opening connection on port %d at IP address %s with timeout %d)",
                 port, ip_address, timeout)
    alias = alias if alias != '' else f'NewportXPS {ans}'
    super().__init__(alias=alias)
    LOGGER.info("%s successfully initialised", self)

get_axis_position(axis_id)

ABC method to retrieve position of a single axis (derived must override).

Parameters:

Name Type Description Default
axis_id str

Axis ID as used by the controller.

required

Returns:

Name Type Description
position float

Current position (dial) of the axis.

Source code in borealis/controller/newport.py
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def get_axis_position(self, axis_id: str):
    """
    ABC method to retrieve position of a single axis (derived must override).

    Parameters
    ----------
    axis_id : str
        Axis ID as used by the controller.

    Returns
    -------
    position : float
        Current position (dial) of the axis.

    """
    answer, positions, err_str = self._xps.GroupPositionCurrentGet(axis_id, [], 1)
    positions = [pos for pos in positions]

    return positions[0]

is_axis_ready(axis_id)

Check that a given axis is ready (idle).

Source code in borealis/controller/newport.py
64
65
66
def is_axis_ready(self, axis_id: str):
    """Check that a given axis is ready (idle)."""
    return True

is_limit_switch_activated(axis_id)

Check if limit switch is active.

Source code in borealis/controller/newport.py
72
73
74
def is_limit_switch_activated(self, axis_id: str):
    """Check if limit switch is active."""
    return False

move_axis(axis_id, target=0.0)

Send instruction to move an axis to a target position.

Source code in borealis/controller/newport.py
39
40
41
42
def move_axis(self, axis_id: str, target: float = 0.):
    """Send instruction to move an axis to a target position."""
    self._xps.GroupMoveAbsolute(axis_id, [target, ], 1)
    self.wait_motion_end(axis_id, target)

set_axis_to_zero(axis_id)

Set the axis position to zero.

Source code in borealis/controller/newport.py
68
69
70
def set_axis_to_zero(self, axis_id: str):
    """Set the axis position to zero."""
    raise NotImplementedError