Skip to content

Commit

Permalink
Merge branch 'main' into devel-1.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
arnobaer committed Aug 28, 2024
2 parents acf021c + a66a40d commit 9c8cba8
Show file tree
Hide file tree
Showing 27 changed files with 709 additions and 215 deletions.
8 changes: 7 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.1.0] - 2024-04-09
## [1.1.0] - 2024-08-28

### Added
- Additional HEPHY EnvironBox commands for driver and emulator (#74).
- Generic base classes `PowerSupply` and `PowerSupplyChannel` and `LightSource`.
- Rhode&Schwarz NGE100 power supply (#77).
- Photonic F3000 LED light source (#75).

### Removed
- Dropped support for Python 3.8

## [1.0.0] - 2024-03-26

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ utilities for instrumentation applications. Inspired by
Install from GitHub using pip

```bash
pip install git+https://github.com/hephy-dd/comet.git@1.0.0
pip install git+https://github.com/hephy-dd/comet.git@v1.1.0
```
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ theme:
highlightjs: true
extra_css: [extra.css]
extra:
version: 1.0.0
version: 1.1.0
7 changes: 7 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mypy]

[mypy-pint.*]
ignore_missing_imports = True

[mypy-schema.*]
ignore_missing_imports = True
33 changes: 31 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
[project]
name = "comet"
description = "Control and Measurement Toolkit"
authors = [
{name = "Bernhard Arnold", email = "[email protected]"},
]
readme = "README.md"
license = {text = "GPLv3"}
requires-python = ">=3.9"
dependencies = [
"PyVISA",
"PyVISA-py",
"PyVISA-sim",
"pyserial",
"pyusb",
"numpy",
"pint",
"schema",
"PyYAML",
]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/hephy-dd/comet/"
Source = "https://github.com/hephy-dd/comet/"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "src/comet/__init__.py"
36 changes: 0 additions & 36 deletions setup.cfg

This file was deleted.

19 changes: 17 additions & 2 deletions src/comet/driver/generic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .instrument import (
InstrumentError,
BeeperMixin,
ErrorQueueMixin,
RouteTerminalMixin,
InstrumentError,
Instrument,
)
from .source_meter_unit import SourceMeterUnit
Expand All @@ -13,4 +13,19 @@
MotionController,
MotionControllerAxis,
)
from .light_source import LightSource
from .light_source import LightSource

__all__ = [
"BeeperMixin",
"ErrorQueueMixin",
"RouteTerminalMixin",
"InstrumentError",
"Instrument",
"SourceMeterUnit",
"Electrometer",
"LCRMeter",
"SwitchingMatrix",
"MotionController",
"MotionControllerAxis",
"LightSource",
]
12 changes: 4 additions & 8 deletions src/comet/driver/generic/electrometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ class Electrometer(Instrument):
# Measurements

@abstractmethod
def measure_voltage(self) -> float:
...
def measure_voltage(self) -> float: ...

@abstractmethod
def measure_current(self) -> float:
...
def measure_current(self) -> float: ...

@abstractmethod
def measure_resistance(self) -> float:
...
def measure_resistance(self) -> float: ...

@abstractmethod
def measure_charge(self) -> float:
...
def measure_charge(self) -> float: ...
64 changes: 34 additions & 30 deletions src/comet/driver/generic/instrument.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from abc import ABC, abstractmethod
from typing import List, Iterable, Optional, Tuple
from typing import Optional

from ..driver import Driver

__all__ = [
"InstrumentError",
"BeeperMixin",
"IdentifyMixin",
"ResetMixin",
"ClearMixin",
"ErrorQueueMixin",
"BeeperMixin",
"RouteTerminalMixin",
"Instrument",
]
Expand All @@ -23,55 +26,56 @@ def __repr__(self) -> str:
return f"{cls_name}({self.code}, {self.message!r})"


class BeeperMixin(ABC):
class IdentifyMixin(ABC):

BEEPER_ON: bool = True
BEEPER_OFF: bool = False
@abstractmethod
def identify(self) -> str: ...


class ResetMixin(ABC):

@property # type: ignore
@abstractmethod
def beeper(self) -> bool:
...
def reset(self) -> None: ...


class ClearMixin(ABC):

@beeper.setter # type: ignore
@abstractmethod
def beeper(self, value: bool) -> None:
...
def clear(self) -> None: ...


class ErrorQueueMixin(ABC):

@abstractmethod
def next_error(self) -> Optional[InstrumentError]:
...
def next_error(self) -> Optional[InstrumentError]: ...


class RouteTerminalMixin(ABC):
class BeeperMixin(ABC):

ROUTE_TERMINAL_FRONT: str = "front"
ROUTE_TERMINAL_REAR: str = "rear"
BEEPER_ON: bool = True
BEEPER_OFF: bool = False

@property # type: ignore
@property
@abstractmethod
def route_terminal(self) -> str:
...
def beeper(self) -> bool: ...

@route_terminal.setter # type: ignore
@beeper.setter
@abstractmethod
def route_terminal(self, route_terminal: str) -> None:
...
def beeper(self, value: bool) -> None: ...


class Instrument(ErrorQueueMixin, Driver):
class RouteTerminalMixin(ABC):

@abstractmethod
def identify(self) -> str:
...
ROUTE_TERMINAL_FRONT: str = "front"
ROUTE_TERMINAL_REAR: str = "rear"

@property
@abstractmethod
def reset(self) -> None:
...
def route_terminal(self) -> str: ...

@route_terminal.setter
@abstractmethod
def clear(self) -> None:
...
def route_terminal(self, route_terminal: str) -> None: ...


class Instrument(IdentifyMixin, ResetMixin, ClearMixin, ErrorQueueMixin, Driver): ...
33 changes: 13 additions & 20 deletions src/comet/driver/generic/lcr_meter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,29 @@

class LCRMeter(Instrument):

@property # type: ignore
@property
@abstractmethod
def function(self) -> str:
...
def function(self) -> str: ...

@function.setter # type: ignore
@function.setter
@abstractmethod
def function(self, function: str) -> None:
...
def function(self, function: str) -> None: ...

@property # type: ignore
@property
@abstractmethod
def amplitude(self) -> float:
...
def amplitude(self) -> float: ...

@amplitude.setter # type: ignore
@amplitude.setter
@abstractmethod
def amplitude(self, level: float) -> None:
...
def amplitude(self, level: float) -> None: ...

@property # type: ignore
@property
@abstractmethod
def frequency(self) -> float:
...
def frequency(self) -> float: ...

@frequency.setter # type: ignore
@frequency.setter
@abstractmethod
def frequency(self, frequency: float) -> None:
...
def frequency(self, frequency: float) -> None: ...

@abstractmethod
def measure_impedance(self) -> Tuple[float, float]:
...
def measure_impedance(self) -> Tuple[float, float]: ...
Loading

0 comments on commit 9c8cba8

Please sign in to comment.