Skip to content

Index

pychilaslasers.laser_components

Laser hardware components package.

This package provides classes for controlling and interfacing with various laser hardware components including diode, TEC and heating elements. It offers both low-level component access and high-level abstractions for laser control operations.

Modules:

  • LaserComponent

    Base class for all laser hardware components

  • Diode

    Laser diode control and monitoring

  • TEC

    Temperature control functionality

  • heaters

    Phase section, ring heaters, and tunable coupler

Authors: SDU

Classes

Diode(laser: Laser)

Bases: LaserComponent

Laser diode component for current control.

Parameters:

  • laser (Laser) –

    The laser instance to control.

Attributes:

  • state (bool) –

    The current on/off state of the laser diode.

  • current (float) –

    The drive current level in milliamps.

  • value (float) –

    Alias for the drive current (inherited from LaserComponent).

  • min_value (float) –

    Minimum current (always 0.0 mA).

  • max_value (float) –

    Maximum current.

  • unit (str) –

    Current unit (mA).

Sets up the laser diode component by querying the hardware for its maximum current and configuring the component with appropriate current range and units.

Parameters:

  • laser (Laser) –

    The laser instance to control.

Source code in src/pychilaslasers/laser_components/diode.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
def __init__(self, laser: Laser) -> None:
    """Initialize the diode component with laser instance.

    Sets up the laser diode component by querying the hardware for its
    maximum current and configuring the component with
    appropriate current range and units.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser=laser)
    self._min: float = 0.0
    self._max: float = float(laser._comm.query("LSR:IMAX?"))
    self._unit: str = "mA"
Attributes
state: bool property writable

Get the current on/off state of the laser diode.

Returns:

  • bool

    True if the laser diode is ON, False if OFF.

current: float property writable

Returns the current drive current in milliamps.

Returns:

  • float

    The current drive current in milliamps.

value: float property writable

Get the current drive current value.

Alias for the current property to implement the LaserComponent interface.

Returns:

  • float

    The current drive current in milliamps.

Functions
get_value() -> float

Alias for the value property getter.

Returns:

  • float

    The current drive current in milliamps.

Source code in src/pychilaslasers/laser_components/diode.py
110
111
112
113
114
115
116
117
def get_value(self) -> float:
    """Alias for the `value` property getter.

    Returns:
        The current drive current in milliamps.

    """
    return self.value
set_value(val: float) -> None

Alias for the value property setter.

Parameters:

  • val (float) –

    The desired drive current in milliamps.

Raises:

  • ValueError

    If current is not a number or is outside the valid range.

Source code in src/pychilaslasers/laser_components/diode.py
119
120
121
122
123
124
125
126
127
128
129
def set_value(self, val: float) -> None:
    """Alias for the `value` property setter.

    Args:
        val: The desired drive current in milliamps.

    Raises:
        ValueError: If current is not a number or is outside the valid range.

    """
    self.value = val
get_current() -> float

Alias for the current property getter.

Returns:

  • float

    The current drive current in milliamps.

Source code in src/pychilaslasers/laser_components/diode.py
131
132
133
134
135
136
137
138
def get_current(self) -> float:
    """Alias for the `current` property getter.

    Returns:
        The current drive current in milliamps.

    """
    return self.current
set_current(current_ma: float) -> None

Alias for the current property setter.

Parameters:

  • current_ma (float) –

    The desired drive current in milliamps.

Raises:

  • ValueError

    If current is not a number or is outside the valid range.

Source code in src/pychilaslasers/laser_components/diode.py
140
141
142
143
144
145
146
147
148
149
150
def set_current(self, current_ma: float) -> None:
    """Alias for the `current` property setter.

    Args:
        current_ma: The desired drive current in milliamps.

    Raises:
        ValueError: If current is not a number or is outside the valid range.

    """
    self.current = current_ma
turn_on() -> None

Turn the laser diode ON.

Alias for setting state to True.

Source code in src/pychilaslasers/laser_components/diode.py
152
153
154
155
156
157
def turn_on(self) -> None:
    """Turn the laser diode ON.

    Alias for setting `state` to True.
    """
    self.state = True
turn_off() -> None

Turn the laser diode OFF.

Alias for setting state to False.

Source code in src/pychilaslasers/laser_components/diode.py
159
160
161
162
163
164
def turn_off(self) -> None:
    """Turn the laser diode OFF.

    Alias for setting `state` to False.
    """
    self.state = False

Heater(laser: Laser)

Bases: LaserComponent

Base class for laser heater components.

Provides common functionality for all heater types including value setting and channel management.

Attributes:

Sets up the heater with its operating limits and units by querying the laser hardware.

Parameters:

  • laser (Laser) –

    The laser instance to control.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(self, laser: Laser) -> None:
    """Initialize the heater component.

    Sets up the heater with its operating limits and units by
    querying the laser hardware.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser)
    self._min: float = float(self._comm.query(f"DRV:LIM:MIN? {self.channel.value}"))
    self._max: float = float(self._comm.query(f"DRV:LIM:MAX? {self.channel.value}"))
    self._unit: str = self._comm.query(f"DRV:UNIT? {self.channel.value}").strip()
Attributes
channel: HeaterChannel abstractmethod property

Get the heater channel identifier.

Must be implemented by subclasses to specify which heater channel this component controls.

Returns:

value: float property writable

Get the current heater drive value.

Returns:

  • float

    The current heater drive value.

Functions
get_value() -> float

Alias for the value property getter.

Returns:

  • float

    The current heater drive value.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
110
111
112
113
114
115
116
117
def get_value(self) -> float:
    """Alias for the `value` property getter.

    Returns:
        The current heater drive value.

    """
    return self.value
set_value(value: float) -> None

Alias for the value property setter.

Parameters:

  • value (float) –

    The heater drive value to set.

Raises:

  • ValueError

    If value is not a number or outside valid range.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
119
120
121
122
123
124
125
126
127
128
129
def set_value(self, value: float) -> None:
    """Alias for the `value` property setter.

    Args:
        value: The heater drive value to set.

    Raises:
        ValueError: If value is not a number or outside valid range.

    """
    self.value = value

LargeRing(laser: Laser)

Bases: Heater

Large ring heater component.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(self, laser: Laser) -> None:
    """Initialize the heater component.

    Sets up the heater with its operating limits and units by
    querying the laser hardware.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser)
    self._min: float = float(self._comm.query(f"DRV:LIM:MIN? {self.channel.value}"))
    self._max: float = float(self._comm.query(f"DRV:LIM:MAX? {self.channel.value}"))
    self._unit: str = self._comm.query(f"DRV:UNIT? {self.channel.value}").strip()
Attributes
channel: HeaterChannel property

Get the large ring channel.

PhaseSection(laser: Laser)

Bases: Heater

Phase section heater component.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
162
163
164
165
166
167
168
169
def __init__(self, laser: Laser) -> None:
    """Initialize the phase section heater component."""
    super().__init__(laser)

    self._anti_hyst = True

    self._volts: None | list[float] = None
    self._time_steps: None | list[float] = None
Attributes
anti_hyst: bool property writable

Get the anti-hysteresis flag.

channel: HeaterChannel property

Get the phase section channel.

Functions

SmallRing(laser: Laser)

Bases: Heater

Small ring heater component.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(self, laser: Laser) -> None:
    """Initialize the heater component.

    Sets up the heater with its operating limits and units by
    querying the laser hardware.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser)
    self._min: float = float(self._comm.query(f"DRV:LIM:MIN? {self.channel.value}"))
    self._max: float = float(self._comm.query(f"DRV:LIM:MAX? {self.channel.value}"))
    self._unit: str = self._comm.query(f"DRV:UNIT? {self.channel.value}").strip()
Attributes
channel: HeaterChannel property

Get the small ring channel.

TunableCoupler(laser: Laser)

Bases: Heater

Tunable coupler heater component.

Source code in src/pychilaslasers/laser_components/heaters/heaters.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def __init__(self, laser: Laser) -> None:
    """Initialize the heater component.

    Sets up the heater with its operating limits and units by
    querying the laser hardware.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser)
    self._min: float = float(self._comm.query(f"DRV:LIM:MIN? {self.channel.value}"))
    self._max: float = float(self._comm.query(f"DRV:LIM:MAX? {self.channel.value}"))
    self._unit: str = self._comm.query(f"DRV:UNIT? {self.channel.value}").strip()
Attributes
channel: HeaterChannel property

Get the tunable coupler channel.

LaserComponent(laser: Laser)

Bases: ABC

Abstract base class for all laser hardware components.

This class defines the common interface that all laser components must implement. It provides standardized access to component values, operating ranges, and units of measurement.

Attributes:

  • value (float) –

    The current value of the component (implementation-dependent).

  • min_value (float) –

    The minimum allowable value for this component.

  • max_value (float) –

    The maximum allowable value for this component.

  • unit (str) –

    The unit of measurement for this component's values.

Note

Subclasses should initialize self._min, self._max and self._unit during construction.

Source code in src/pychilaslasers/laser_components/laser_component.py
47
48
49
def __init__(self, laser: Laser) -> None:  # noqa: D107
    super().__init__()
    self._comm: Communication = laser._comm
Attributes
value: float abstractmethod property

Returns the current value of the component in appropriate units.

min_value: float property

Returns the minimum value that can be safely set for this component.

max_value: float property

Returns the maximum value that can be safely set for this component.

unit: str property

Returns the unit string (e.g., "mA", "°C", "V") for this component.

TEC(laser: Laser)

Bases: LaserComponent

Temperature control component for laser thermal management.

This component automatically retrieves its operating range limits from the laser hardware and provides input validation.

Attributes:

  • target (float) –

    The target temperature in Celsius.

  • temp (float) –

    The current measured temperature in Celsius.

  • value (float) –

    Alias for the current temperature (inherited from LaserComponent).

  • min_value (float) –

    Minimum allowable temperature target.

  • max_value (float) –

    Maximum allowable temperature target.

  • unit (str) –

    Temperature unit (Celsius).

Sets up the component by querying the laser hardware for its temperature operating limits and configuring the component with appropriate units and ranges.

Parameters:

  • laser (Laser) –

    The laser instance to control.

Source code in src/pychilaslasers/laser_components/tec.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def __init__(self, laser: Laser) -> None:
    """Initialize the temperature control component.

    Sets up the component by querying the laser hardware for its temperature
    operating limits and configuring the component
    with appropriate units and ranges.

    Args:
        laser: The laser instance to control.

    """
    super().__init__(laser=laser)
    self._min: float = float(self._comm.query("TEC:CFG:TMIN?"))
    self._max: float = float(self._comm.query("TEC:CFG:TMAX?"))
    self._unit: str = "Celsius"
Attributes
target: float property writable

Get the current target temperature in Celsius.

temp: float property

Get the current measured temperature reading in Celsius.

value: float property

Get the current temperature value.

Note

This is an alias for the temp property.

Functions
get_value() -> float

Return the current measured temperature in Celsius.

Returns:

  • float

    The current measured temperature in Celsius.

Source code in src/pychilaslasers/laser_components/tec.py
100
101
102
103
104
105
106
107
def get_value(self) -> float:
    """Return the current measured temperature in Celsius.

    Returns:
        The current measured temperature in Celsius.

    """
    return self.value
set_value(val: float) -> None

Set the target temperature of the TEC.

Parameters:

  • val (float) –

    The desired target temperature in Celsius.

Raises:

  • ValueError

    If target is not a number or is outside the valid range.

Source code in src/pychilaslasers/laser_components/tec.py
109
110
111
112
113
114
115
116
117
118
119
def set_value(self, val: float) -> None:
    """Set the target temperature of the TEC.

    Args:
        val: The desired target temperature in Celsius.

    Raises:
        ValueError: If target is not a number or is outside the valid range.

    """
    self.target = val
get_temp() -> float

Return the current measured temperature in Celsius.

Returns:

  • float

    The current measured temperature in Celsius.

Source code in src/pychilaslasers/laser_components/tec.py
121
122
123
124
125
126
127
128
def get_temp(self) -> float:
    """Return the current measured temperature in Celsius.

    Returns:
        The current measured temperature in Celsius.

    """
    return self.temp
get_target_temp() -> float

Return the current target temperature in Celsius.

Returns:

  • float

    The current target temperature in Celsius.

Source code in src/pychilaslasers/laser_components/tec.py
130
131
132
133
134
135
136
137
def get_target_temp(self) -> float:
    """Return the current target temperature in Celsius.

    Returns:
        The current target temperature in Celsius.

    """
    return self.target
set_target(target: float) -> None

Set the target temperature of the TEC.

Parameters:

  • target (float) –

    The desired target temperature in Celsius.

Raises:

  • ValueError

    If target is not a number or is outside the valid range.

Source code in src/pychilaslasers/laser_components/tec.py
139
140
141
142
143
144
145
146
147
148
149
def set_target(self, target: float) -> None:
    """Set the target temperature of the TEC.

    Args:
        target: The desired target temperature in Celsius.

    Raises:
        ValueError: If target is not a number or is outside the valid range.

    """
    self.target = target