Skip to content

npxpy.nodes.misc.StageMove

Bases: Node

A class to represent a stage move node with a specified stage position.

Attributes:

Name Type Description
target_position List[float]

The target position of the stage [x, y, z].

Source code in npxpy/nodes/misc.py
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
class StageMove(Node):
    """
    A class to represent a stage move node with a specified stage position.

    Attributes:
        target_position (List[float]): The target position of the stage [x, y, z].
    """

    def __init__(
        self,
        name: str = "Stage move",
        stage_position: List[float] = [0.0, 0.0, 0.0],
    ):
        """
        Initialize the stage move node.

        Parameters:
            name (str): Name of the stage move node.
            stage_position (List[float]): Target position of the stage [x, y, z].
        """
        super().__init__(node_type="stage_move", name=name)
        self.stage_position = stage_position

    @property
    def stage_position(self):
        """Get the stage position."""
        return self._stage_position

    @stage_position.setter
    def stage_position(self, value: List[float]):
        """
        Set the stage position.

        Parameters:
            value (List[float]): The target stage position [x, y, z].

        Raises:
            TypeError: If stage_position is not a list of three numbers.
        """
        if len(value) != 3 or not all(
            isinstance(val, (float, int)) for val in value
        ):
            raise TypeError("stage_position must be a list of three numbers.")
        self._stage_position = value

    def to_dict(self) -> Dict[str, Any]:
        """
        Convert the StageMove object into a dictionary.

        Returns:
            Dict[str, Any]: Dictionary representation of the object.
        """
        node_dict = super().to_dict()  # Get the basic dict from Node
        node_dict["target_position"] = self.stage_position
        return node_dict

stage_position property writable

Get the stage position.

__init__(name='Stage move', stage_position=[0.0, 0.0, 0.0])

Initialize the stage move node.

Parameters:

Name Type Description Default
name str

Name of the stage move node.

'Stage move'
stage_position List[float]

Target position of the stage [x, y, z].

[0.0, 0.0, 0.0]
Source code in npxpy/nodes/misc.py
315
316
317
318
319
320
321
322
323
324
325
326
327
328
def __init__(
    self,
    name: str = "Stage move",
    stage_position: List[float] = [0.0, 0.0, 0.0],
):
    """
    Initialize the stage move node.

    Parameters:
        name (str): Name of the stage move node.
        stage_position (List[float]): Target position of the stage [x, y, z].
    """
    super().__init__(node_type="stage_move", name=name)
    self.stage_position = stage_position

to_dict()

Convert the StageMove object into a dictionary.

Returns:

Type Description
Dict[str, Any]

Dict[str, Any]: Dictionary representation of the object.

Source code in npxpy/nodes/misc.py
352
353
354
355
356
357
358
359
360
361
def to_dict(self) -> Dict[str, Any]:
    """
    Convert the StageMove object into a dictionary.

    Returns:
        Dict[str, Any]: Dictionary representation of the object.
    """
    node_dict = super().to_dict()  # Get the basic dict from Node
    node_dict["target_position"] = self.stage_position
    return node_dict