Skip to content

Commit

Permalink
Add seed parameter to update_channel
Browse files Browse the repository at this point in the history
  • Loading branch information
muhd-umer committed Apr 4, 2024
1 parent b91113e commit d9b56b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion comyx/network/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def update_channel(
custom_rvs: NDArrayComplex | None = None,
ex_pathloss: bool = False,
ex_rvs: bool = False,
seed: Union[int, None] = None,
) -> None:
"""Update the channel gain.
Expand All @@ -167,14 +168,15 @@ def update_channel(
custom_rvs: New random variables for the channel gain.
ex_pathloss: Whether to exclude distance-based params from the update.
ex_rvs: Whether to exclude the random variables from the update.
seed: Seed for the random number generator.
"""

if not ex_pathloss:
self.update_params(distance=distance)

if not ex_rvs:
# generate new random variables
self.generate_rvs(custom_rvs=custom_rvs, seed=None)
self.generate_rvs(custom_rvs=custom_rvs, seed=seed)

pathloss = db2pow(-self.pathloss)
self._channel_gain = np.sqrt(pathloss) * self.rvs
Expand Down

0 comments on commit d9b56b4

Please sign in to comment.