Skip to content

Commit

Permalink
Merge branch 'revert-655862c1' into 'master'
Browse files Browse the repository at this point in the history
Revert "Merge branch 'fix-matced-filter-port-selection' into 'master'"

See merge request barkhauseninstitut/wicon/hermespy!184
  • Loading branch information
adlerjan committed May 6, 2024
2 parents 655862c + 531a37d commit a6a6526
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 39 deletions.
24 changes: 6 additions & 18 deletions hermespy/core/duplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from __future__ import annotations
from abc import abstractmethod
from h5py import Group
from typing import Generic, Sequence
from typing import Generic

from .device import Device, OperatorSlot, ReceptionType, Receiver, TransmissionType, Transmitter
from .signal_model import Signal
Expand All @@ -31,12 +31,7 @@ class DuplexOperator(
__device: Device | None

def __init__(
self,
device: Device | None = None,
reference: Device | None = None,
selected_transmit_ports: Sequence[int] | None = None,
selected_receive_ports: Sequence[int] | None = None,
seed: int | None = None,
self, device: Device | None = None, reference: Device | None = None, seed: int | None = None
):
"""
Args:
Expand All @@ -45,11 +40,10 @@ def __init__(
Device the duplex operator operates.
"""

self.__device = None

Transmitter.__init__(self, seed, selected_transmit_ports)
Receiver.__init__(self, seed, reference, selected_receive_ports)
Transmitter.__init__(self, seed=seed)
Receiver.__init__(self, seed=seed, reference=reference)

self.__device = None
self.device = device

@property
Expand All @@ -63,11 +57,7 @@ def device(self) -> Device | None:

@device.setter
def device(self, value: Device | None) -> None:
# Abort if the device is already assigned
if self.__device is value:
return

if value is None and self.__device is not None:
if self.__device is not None:
self.__device.transmitters.remove(self)
self.__device.receivers.remove(self)

Expand All @@ -77,8 +67,6 @@ def device(self, value: Device | None) -> None:
value.transmitters.add(self)
value.receivers.add(self)

return

@Transmitter.slot.setter
def slot(self, value: OperatorSlot[Transmitter]) -> None:
if value is not None and self.device is not value.device:
Expand Down
24 changes: 3 additions & 21 deletions hermespy/jcas/jcas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations
from abc import abstractmethod
from typing import Generic, Sequence, Type
from typing import Generic, Type

from h5py import Group

Expand Down Expand Up @@ -68,14 +68,7 @@ class DuplexJCASOperator(
cube from the received backscattered power.
"""

def __init__(
self,
device: Device | None = None,
waveform: CWT | None = None,
selected_transmit_ports: Sequence[int] | None = None,
selected_receive_ports: Sequence[int] | None = None,
**kwargs,
) -> None:
def __init__(self, device: Device | None = None, waveform: CWT | None = None, **kwargs) -> None:
"""
Args:
Expand All @@ -85,23 +78,12 @@ def __init__(
waveform (CWT, optional):
Communication waveform emitted by this operator.
selected_transmit_ports (Sequence[int], optional):
Selected transmit ports of the device.
selected_receive_ports (Sequence[int], optional):
Selected receive ports of the device.
"""

# Initialize base classes
TransmittingModemBase.__init__(self)
ReceivingModemBase.__init__(self, **kwargs)
RadarBase.__init__(
self,
device=device,
selected_transmit_ports=selected_transmit_ports,
selected_receive_ports=selected_receive_ports,
)
RadarBase.__init__(self, device=device)

# Initialize class attributes
self.device = device
Expand Down

0 comments on commit a6a6526

Please sign in to comment.