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 9e6c5d24..ee9f9c53 100644 --- a/piel/experimental/models/cables.py +++ b/piel/experimental/models/cables.py @@ -1,14 +1,89 @@ -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, + ) + + ports = [ + PhysicalPort( + name="IN", + domain="RF", + connector="SMA", + ), + PhysicalPort( + name="OUT", + domain="RF", + connector="SMA", + ) + ] + + return CoaxialCable( + name="RG164", + geometry=geometry, + ports=ports, + **kwargs, + ) + + +def generic_sma( + name: str, + length_m: float, + **kwargs, ) -> CoaxialCable: geometry = CoaxialCableGeometryType( length_m=length_m, ) - return CoaxialCable(name="RG164", geometry=geometry) + ports = [ + PhysicalPort( + name="IN", + domain="RF", + connector="SMA", + ), + PhysicalPort( + name="OUT", + domain="RF", + connector="SMA", + ) + ] + + return CoaxialCable( + name=name, + geometry=geometry, + ports=ports, + **kwargs, + ) def cryo_cable( 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/experimental/types/dc.py b/piel/experimental/types/dc.py index 4b9d6208..78b697f9 100644 --- a/piel/experimental/types/dc.py +++ b/piel/experimental/types/dc.py @@ -1,3 +1,4 @@ +from typing import Optional from .device import Device, DeviceConfiguration @@ -16,7 +17,7 @@ class Sourcemeter(Device): Represents a sourcemeter. """ - configuration: SourcemeterConfiguration + configuration: Optional[SourcemeterConfiguration] = None class MultimeterConfiguration(DeviceConfiguration): diff --git a/piel/types/electrical/cables.py b/piel/types/electrical/cables.py index 4c7b0a58..adb72627 100644 --- a/piel/types/electrical/cables.py +++ b/piel/types/electrical/cables.py @@ -6,7 +6,7 @@ # TODO This shouldn't be a quantity class CoaxialCableGeometryType(QuantityType): - core_cross_sectional_area_m2: Optional[float] + core_cross_sectional_area_m2: Optional[float] = None """ The cross-sectional area of the core in meters squared. """ @@ -16,12 +16,12 @@ class CoaxialCableGeometryType(QuantityType): The length of the cable in meters. """ - sheath_cross_sectional_area_m2: Optional[float] + sheath_cross_sectional_area_m2: Optional[float] = None """ The cross-sectional area of the sheath in meters squared. """ - total_cross_sectional_area_m2: Optional[float] + total_cross_sectional_area_m2: Optional[float] = None """ The total cross-sectional area of the cable in meters squared. """ @@ -32,17 +32,17 @@ class CoaxialCableHeatTransferType(QuantityType): All units are in watts. """ - core: Optional[float] + core: Optional[float] = None """ The computed heat transfer in watts for the core of the cable. """ - sheath: Optional[float] + sheath: Optional[float] = None """ The computed heat transfer in watts for the sheath of the cable. """ - dielectric: Optional[float] + dielectric: Optional[float] = None """ The computed heat transfer in watts for the dielectric of the cable. """ @@ -56,17 +56,17 @@ class CoaxialCableHeatTransferType(QuantityType): class CoaxialCableMaterialSpecificationType(QuantityType): - core: Optional[MaterialReferenceType] + core: Optional[MaterialReferenceType] = None """ The material of the core. """ - sheath: Optional[MaterialReferenceType] + sheath: Optional[MaterialReferenceType] = None """ The material of the sheath. """ - dielectric: Optional[MaterialReferenceType] + dielectric: Optional[MaterialReferenceType] = None """ The material of the dielectric. """ @@ -94,7 +94,7 @@ class DCCableHeatTransferType(QuantityType): All units are in watts. """ - core: Optional[float] + core: Optional[float] = None """ The computed heat transfer in watts for the core of the cable. """ @@ -108,7 +108,7 @@ class DCCableHeatTransferType(QuantityType): class DCCableMaterialSpecificationType(QuantityType): - core: Optional[MaterialReferenceType] + core: Optional[MaterialReferenceType] = None """ The material of the core. """ @@ -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]