from abc import ABC, abstractmethod from typing import Callable """ Created on Tue Jan 21 16:19:01 2025 @author: Matthias Quintern """ class MeasurementDevice(ABC): @abstractmethod def test_connection(self) -> None: """ Verify that the device is still properly connected. If not, raises ConnectionError """ pass # RUN COMMANDS ON THE DEVICE @abstractmethod def run(self, code, verbose=False): pass @abstractmethod def run_script(self, script_path, verbose=False): pass @abstractmethod def reset(self, verbose=False): pass @abstractmethod def read_value(self) -> tuple[float, float]: """ Read a single value Returns ------- [timestamp, voltage] """ pass @abstractmethod def measure(self, interval: int, update_func: Callable[None, [int, float, float]]|None=None, max_measurements:int|None=None): """ 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 ,