from ..base import MeasurementDevice from typing import Callable from time import time as now import numpy as np class TestVoltageMeasurementDevice(MeasurementDevice): def __init__(self, amplitude: float=1.0, frequency: float=20.0): super().__init__() self.amplitude = amplitude self.frequency = frequency self.t0 = now() def test_connection(self) -> None: pass # RUN COMMANDS ON THE DEVICE def run(self, code, verbose=False): pass def run_script(self, script_path, verbose=False): pass def reset(self, verbose=False): pass def read_value(self) -> tuple[float, float]: """ Read a single value Returns ------- [timestamp, voltage] """ t = now() - self.t0 v = self.amplitude * np.sin(2 * np.pi * t / self.frequency) return t, v # def measure(self, interval: int, update_func: Callable[None, [int, float, float]] | None = None, # max_measurements: int | None = None): def measureTODO(): """ Take voltage readings after milliseconds. Parameters ---------- interval : int Number of milliseconds to wait between readings. update_func : Callable[None, [int, float, float]] or None, optional A function that is called after each reading with parameters ,