Pupil Mask#

class phobos.PupilMask(*args, **kwargs)[source]#

Bases: object

Singleton Class to control the mask wheel in the optical system.

Warning

It is highly recommended to reset the mask to the home position using the reset=True parameter when initializing the PupilMask object.

zaber_h#

Instance of the Zaber class for controlling the horizontal motor.

Type:

Zaber

zaber_v#

Instance of the Zaber class for controlling the vertical motor.

Type:

Zaber

newport#

Instance of the Newport class for controlling the mask wheel.

Type:

Newport

zaber_h_home#

Home position for the horizontal motor (in steps).

Type:

int

zaber_v_home#

Home position for the vertical motor (in steps).

Type:

int

newport_home#

Angular home position for the first mask (in degrees).

Type:

float

__init__()[source]#

Initialize the PupilMask class using global configuration.

move_h(pos: int, abs: bool = False) str[source]#

Move the mask to the horizontal by a certain number of steps.

Parameters:
  • pos (int) – Number of steps to move.

  • abs (bool, optional) – If True, move to an absolute position. Default is False.

Returns:

Response from the motor after moving to the target position.

Return type:

str

move_v(pos: int, abs: bool = False) str[source]#

Move the mask vertically by a certain number of steps.

Parameters:
  • pos (int) – Number of steps to move.

  • abs (bool, optional) – If True, move to an absolute position. Default is False.

Returns:

Response from the motor after moving to the target position.

Return type:

str

rotate_clockwise(
pos: float,
abs: bool = False,
) str[source]#

Rotate the mask clockwise by a certain number of degrees. Alias: rotate()

Parameters:
  • pos (float) – Number of degrees to rotate.

  • abs (bool, optional) – If True, rotate to an absolute position. Default is False.

Returns:

Response from the motor after moving to the target position.

Return type:

str

apply_mask(key: str, config_path: str = None)[source]#

Rotate the mask wheel and move the Zabers to the desired mask position. It can load the positions of the wheel and the zabers from a YAML file. In this case, key is the string of the key of the YAML file of the desired configuration to set.

If no such file is given, key (string or int) is the number of the mask to put. The zabers remains are not moved.

Parameters:
  • key (str or int) – Key of the config to load.

  • config_path (str, optional) – YAML file in which are stored the motors positions. See “Configuration file” documentation. for each wheel position. The default is None.

Returns:

Response from the motor after moving to the target position.

Return type:

str

get_pos()[source]#

Get the current position of the mask.

Returns:

  • float – Current angular position of the mask wheel (in degrees).

  • int – Current position of the horizontal Zaber motor (in steps).

  • int – Current position of the vertical Zaber motor (in steps).

save_pos(key: str, config_path: str)[source]#

Save position of the wheel and the two zabers into a yml file.

Parameters:
  • key (str) – Key at which saving the configuration.

  • config_path (str) – Name of the yml file.

reset() None[source]#

Reset the mask wheel and Zaber motors to the positions defined in the configuration.

This method reloads the current ‘pupil_mask’ configuration settings (newport_home, zaber_h_home, zaber_v_home) and moves the hardware accordingly.