Skip to content

Commit

Permalink
Add magnitude and phase properties
Browse files Browse the repository at this point in the history
  • Loading branch information
muhd-umer committed Feb 18, 2024
1 parent cdbb7d4 commit 97e20a6
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions comyx/network/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def channel_gain(self) -> NDArrayComplex:

return self._channel_gain

@property
def magnitude(self) -> NDArrayFloat:
"""Magnitude of the channel"""

return np.abs(self.channel_gain)

@property
def phase(self) -> NDArrayFloat:
"""Phase of the channel"""

return np.angle(self.channel_gain)

def generate_channel_gain(self) -> NDArrayComplex:
"""Generate channel gain between the transceivers.
Expand Down Expand Up @@ -198,6 +210,28 @@ def channel_gain(self) -> dict[str, NDArrayComplex]:
"Rr": self._channel_gain_Rr,
}

@property
def magnitude(self) -> dict[str, NDArrayFloat]:
"""Dictionary containing magnitude of the channel between different components.
Keys are ``tR`` for transceiver and RIS, ``Rr`` for RIS and receiver."""

return {
"tR": np.abs(self._channel_gain_tR),
"Rr": np.abs(self._channel_gain_Rr),
}

@property
def phase(self) -> dict[str, NDArrayFloat]:
"""Dictionary containing phase of the channel between different components.
Keys are ``tR`` for transceiver and RIS, ``Rr`` for RIS and receiver."""

return {
"tR": np.angle(self._channel_gain_tR),
"Rr": np.angle(self._channel_gain_Rr),
}

def generate_channel_gain(self) -> Tuple[NDArrayComplex, NDArrayComplex]:
"""Generate channels to and from the Transceiver and the RIS.
Expand Down

0 comments on commit 97e20a6

Please sign in to comment.