Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Moving of `_snicaddr` in psutil package v2.7 from `_common` to `_ntuples` module, which caused an error with `qmi_proc`.
- Process management logging path now resolves correctly also for cases where the config file path starts with the `~`, indicating home directory location.
- Issue with Python 3.14 compatibility in `QMI_Context` class. Addition of `run` method with specific input parameter fixes the issue.
- Instrument drivers `tsl_570.py`, `wltf_n.py` and `tfn.py` have now default values in dataclasses which are initiated in the driver class constructor. This is done to avoid Mypy error: 'Cannot access instance-only attribute "<attr>" on class object [misc]"

### Removed
- Removed `xdrlib-py` import for Python 3.13 version, where it was needed for python-vxi11 package.
Expand Down
44 changes: 22 additions & 22 deletions qmi/instruments/santec/tsl_570.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import logging
from dataclasses import dataclass
from typing import List, Union

from qmi.core.context import QMI_Context
from qmi.core.exceptions import QMI_InstrumentException
Expand All @@ -21,24 +20,24 @@
class _WavelengthRange:
"""Dataclass for wavelength instrument range."""

min: float
max: float
min: float = 0.0
max: float = 0.0


@dataclass
class _FrequencyRange:
"""Dataclass for frequency instrument range."""

min: float
max: float
min: float = 0.0
max: float = 0.0


@dataclass
class _PowerLevelRange:
"""Dataclass for power level instrument range."""

min: float
max: float
min: float = 0.0
max: float = 0.0


class Santec_Tsl570(QMI_Instrument):
Expand Down Expand Up @@ -106,11 +105,11 @@ def __init__(self, context: QMI_Context, name: str, transport: str) -> None:
default_timeout=self.DEFAULT_RESPONSE_TIMEOUT,
)
# Instrument ranges for values
self._wavelength_range = _WavelengthRange
self._frequency_range = _FrequencyRange
self._power_level_range = _PowerLevelRange
self._wavelength_range = _WavelengthRange()
self._frequency_range = _FrequencyRange()
self._power_level_range = _PowerLevelRange()

def _check_error(self) -> List[str]:
def _check_error(self) -> list[str]:
"""Read the instrument error queue and raise an exception if there is an error.

Returns:
Expand Down Expand Up @@ -219,7 +218,7 @@ def get_idn(self) -> QMI_InstrumentIdentification:

Returns:
QMI_InstrumentIdentification: Data with e.g. idn.vendor = SANTEC, idn.model = TSL-570,
idn.serial = 21020001, idn.version = 0001.000.0001 (firmware version).
idn.serial = 21020001, idn.version = 0001.000.0001 (firmware version).
"""
resp = self._scpi_protocol.ask("*IDN?")
words = resp.rstrip().split(",")
Expand All @@ -238,7 +237,8 @@ def reset(self) -> None:
@rpc_method
def clear(self) -> None:
"""Clear Status. Clears all event registers and queues and reflects the summary in the Status Byte Register.
Clears the following items.

Clears the following items:
・Status Byte Register
・Standard Event Status Register
・Error Queue
Expand All @@ -257,7 +257,7 @@ def operation_complete(self) -> bool:
return response

@rpc_method
def get_errors(self) -> List[str]:
def get_errors(self) -> list[str]:
"""Query all errors and alerts.

Returns:
Expand Down Expand Up @@ -416,7 +416,7 @@ def disable_finetuning_operation(self) -> None:
self._write_and_check_errors(":WAV:FIN:DIS")

@rpc_method
def set_coherence_control_status(self, status: Union[bool, str]) -> None:
def set_coherence_control_status(self, status: bool | str) -> None:
"""Set the Coherence control status.

Parameters:
Expand Down Expand Up @@ -445,7 +445,7 @@ def get_coherence_control_status(self) -> str:
return "ON" if status else "OFF"

@rpc_method
def set_optical_output_status(self, status: Union[bool, str]) -> None:
def set_optical_output_status(self, status: bool | str) -> None:
"""Set the optical output status.

Parameters:
Expand Down Expand Up @@ -607,7 +607,7 @@ def set_sweep_start_frequency(self, frequency: float) -> None:
"""Set the start frequency for a sweep.

Parameters:
frequency: frequency in terahertz.
frequency: Frequency in terahertz.
"""
unit = "THz"
dec = 4 # 10 MHz resolution
Expand All @@ -634,7 +634,7 @@ def set_sweep_stop_frequency(self, frequency: float) -> None:
"""Set the stop frequency for a sweep.

Parameters:
frequency: frequency in terahertz.
frequency: Frequency in terahertz.
"""
unit = "THz"
dec = 4 # 10 MHz resolution
Expand Down Expand Up @@ -721,7 +721,7 @@ def get_sweep_dwell(self) -> float:
"""Get dwell between sweep steps.

Returns:
dwell: dwell in range [0, 1000[s.
dwell: Dwell in range [0, 1000[s.
"""
return self._ask_float(":WAV:SWE:DWEL?")

Expand All @@ -744,7 +744,7 @@ def get_sweep_delay(self) -> float:
"""Get delay between sweeps.

Returns:
delay: delay in range [0, 1000[s.
delay: Delay in range [0, 1000[s.
"""
return self._ask_float(":WAV:SWE:DEL?")

Expand Down Expand Up @@ -869,7 +869,7 @@ def get_trigger_output_step(self) -> float:
"""Get trigger output step.

Returns:
step: step in range [0.0001, max wavelength]nm.
step: Step in range [0.0001, max wavelength]nm.
"""
return self._ask_float(":TRIG:OUTP:STEP?")

Expand All @@ -888,7 +888,7 @@ def readout_points(self) -> int:
return int(self._scpi_protocol.ask(":READ:POIN?"))

@rpc_method
def readout_data(self) -> List[float]:
def readout_data(self) -> list[float]:
"""Read out wavelength logging data and convert it into floating point values. According to the manual
the data points are returned in units of 0.1pm. Thus, value 0x0040F844 (little Endian order) = 4520000
corresponds to 452.0000nm.
Expand Down
Loading
Loading