Skip to content

Commit

Permalink
[QMI-128] Removed one convenience method after review.
Browse files Browse the repository at this point in the history
  • Loading branch information
heevasti committed Dec 19, 2024
1 parent d48a38b commit f04f364
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
23 changes: 0 additions & 23 deletions qmi/instruments/high_finesse/wlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@

import ctypes
import logging
from time import time

import numpy as np

from qmi.core.context import QMI_Context
from qmi.core.exceptions import QMI_InstrumentException
from qmi.core.instrument import QMI_Instrument, QMI_InstrumentIdentification
from qmi.core.rpc import rpc_method
from qmi.instruments.bristol.bristol_871a import Measurement
from qmi.instruments.high_finesse.support import wlmConst
from qmi.instruments.high_finesse.support._library_wrapper import _LibWrapper, WlmGetErr

Expand Down Expand Up @@ -218,27 +216,6 @@ def get_power(self, channel: int) -> float:

return self._check_for_error_code(power, "GetPowerNum")

@rpc_method
def read_measurement(self, channel: int) -> Measurement:
"""This is to make compatibility with the Bristol wavemeter Measurement namedtuple.
Parameters:
channel: The channel number to read the data from. Not used for HighFinesse, which
returns the status of the device, not just channel.
Returns:
measurement: Measurement instance with timestamp, index, status, wavelength and power.
"""
self._check_channel(channel)

timestamp = time()
index = 0 # Currently not used
status = self.get_operation_state()
wavelength = self.get_wavelength(channel)
power = self.get_power(channel)

return Measurement(timestamp, index, status, wavelength, power)

@rpc_method
def set_data_pattern(self, index: int = 1, enable: bool = True) -> None:
"""Enable or disable a pattern index to export data from instrument.
Expand Down
28 changes: 0 additions & 28 deletions tests/instruments/high_finesse/test_wlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from numpy import nan

from qmi.core.exceptions import QMI_InvalidOperationException, QMI_InstrumentException
from qmi.instruments.bristol.bristol_871a import Measurement
from qmi.instruments.high_finesse import HighFinesse_Wlm
from qmi.instruments.high_finesse.support import (
wlmData,
Expand Down Expand Up @@ -219,33 +218,6 @@ def test_get_power_returns_nan(self, dll_patcher):

numpy.testing.assert_equal(nan, power)

def test_read_measurement(self, dll_patcher):
"""The driver should return the frequency and power values with a timestamp."""
expected_time = 12.34
expected_power = 1.23
expected_wavelength = 673
expected_state = 2
expected_measurement = Measurement(
timestamp=expected_time,
index=0,
status=expected_state,
wavelength=expected_wavelength,
power=expected_power
)
wlmData.dll = dll_patcher.return_value
wlmData.dll.GetWLMCount.side_effect = {0: 1}.get
wlmData.dll.GetPowerNum.return_value = expected_power
wlmData.dll.GetWavelengthNum.return_value = expected_wavelength
wlmData.dll.GetOperationState.return_value = expected_state

with patch("qmi.instruments.high_finesse.wlm.time", return_value=expected_time):
with HighFinesse_Wlm(self.ctx, "wlm") as wlm:
self.assertEqual(expected_measurement, wlm.read_measurement(1))

wlm._lib.dll.GetWavelengthNum.assert_called_once_with(1, 0.0)
wlm._lib.dll.GetPowerNum.assert_called_once_with(1, 0.0)
wlm._lib.dll.GetOperationState.assert_called_once_with(0)

def test_set_data_pattern_defaults(self, dll_patcher):
"""Test the set_data_patterns calls SetPattern with default index and i_enable."""
default_index, default_enable = 1, True
Expand Down

0 comments on commit f04f364

Please sign in to comment.