From 97c952ad6086d162e043d151dd14a60a4e5cdeb5 Mon Sep 17 00:00:00 2001 From: Aidan Higgins <47744029+Nala1712@users.noreply.github.com> Date: Tue, 30 Jul 2024 12:56:25 +0100 Subject: [PATCH] Various fixes --- piel/experimental/models/__init__.py | 2 +- piel/experimental/models/cables.py | 60 ++++++++++++++++++++++++- piel/experimental/models/sourcemeter.py | 10 ++++- piel/types/electrical/cables.py | 12 ++--- 4 files changed, 74 insertions(+), 10 deletions(-) diff --git a/piel/experimental/models/__init__.py b/piel/experimental/models/__init__.py index 5b40b071..8c87df08 100644 --- a/piel/experimental/models/__init__.py +++ b/piel/experimental/models/__init__.py @@ -1,4 +1,4 @@ -from .cables import rg164 +from .cables import rg164, generic_sma, generic_banana from .multimeter import DMM6500 from .rf_passives import create_power_splitter_1to2 from .rf_calibration import ( diff --git a/piel/experimental/models/cables.py b/piel/experimental/models/cables.py index fa86b5a3..ee9f9c53 100644 --- a/piel/experimental/models/cables.py +++ b/piel/experimental/models/cables.py @@ -1,8 +1,35 @@ -from ...types import CoaxialCable, CoaxialCableGeometryType +from ...types import CoaxialCable, CoaxialCableGeometryType, PhysicalPort, DCCable + + +def generic_banana( + name: str, + length_m: float, + **kwargs, +) -> DCCable: + ports = [ + PhysicalPort( + name="IN", + domain="DC", + connector="Male", + ), + PhysicalPort( + name="OUT", + domain="DC", + connector="Male", + ) + ] + + return DCCable( + name=name, + ports=ports, + **kwargs, + ) + def rg164( length_m: float, + **kwargs, ) -> CoaxialCable: geometry = CoaxialCableGeometryType( length_m=length_m, @@ -25,6 +52,37 @@ def rg164( name="RG164", geometry=geometry, ports=ports, + **kwargs, + ) + + +def generic_sma( + name: str, + length_m: float, + **kwargs, +) -> CoaxialCable: + geometry = CoaxialCableGeometryType( + length_m=length_m, + ) + + ports = [ + PhysicalPort( + name="IN", + domain="RF", + connector="SMA", + ), + PhysicalPort( + name="OUT", + domain="RF", + connector="SMA", + ) + ] + + return CoaxialCable( + name=name, + geometry=geometry, + ports=ports, + **kwargs, ) diff --git a/piel/experimental/models/sourcemeter.py b/piel/experimental/models/sourcemeter.py index ab6d1221..e5005e9c 100644 --- a/piel/experimental/models/sourcemeter.py +++ b/piel/experimental/models/sourcemeter.py @@ -1,8 +1,14 @@ +from typing import Optional from ...types import PhysicalPort from ..types import Sourcemeter -def SMU2450(**kwargs) -> Sourcemeter: +def SMU2450(name: Optional[str] = None, + **kwargs) -> Sourcemeter: + + if name is None: + name = "SMU2450" + ports = [ PhysicalPort( name="FORCEHI", @@ -31,4 +37,4 @@ def SMU2450(**kwargs) -> Sourcemeter: ), ] - return Sourcemeter(name="SMU2450", manufacturer="Keithley", ports=ports, **kwargs) + return Sourcemeter(name=name, manufacturer="Keithley", ports=ports, **kwargs) diff --git a/piel/types/electrical/cables.py b/piel/types/electrical/cables.py index 449ecd92..adb72627 100644 --- a/piel/types/electrical/cables.py +++ b/piel/types/electrical/cables.py @@ -122,9 +122,9 @@ class DCCable(Cable): """ A DC cable is a single core cable that is used to transmit direct current. """ - geometry: DCCableGeometryType - heat_transfer: DCCableHeatTransferType - material_specification: DCCableMaterialSpecificationType + geometry: Optional[DCCableGeometryType] = None + heat_transfer: Optional[DCCableHeatTransferType] = None + material_specification: Optional[DCCableMaterialSpecificationType] = None class CoaxialCable(Cable): @@ -132,9 +132,9 @@ class CoaxialCable(Cable): A coaxial cable is a type of electrical cable that has an inner conductor surrounded by a tubular insulating layer, surrounded by a tubular conducting shield. """ - geometry: CoaxialCableGeometryType - heat_transfer: CoaxialCableHeatTransferType - material_specification: CoaxialCableMaterialSpecificationType + geometry: Optional[CoaxialCableGeometryType] = None + heat_transfer: Optional[CoaxialCableHeatTransferType] = None + material_specification: Optional[CoaxialCableMaterialSpecificationType] = None CableHeatTransferTypes = Union[CoaxialCableHeatTransferType, DCCableHeatTransferType]