Skip to content

Commit

Permalink
mapping: allow demapping infinite/high SNR symbols (#327)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan A. Pedreira <[email protected]>
  • Loading branch information
japm48 authored Apr 23, 2024
1 parent 34fa468 commit 3a4538d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sionna/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,8 @@ def __init__(self,
dtype.real_dtype,
**kwargs)

self._no_threshold = tf.cast(np.finfo(dtype.as_numpy_dtype).tiny, dtype.real_dtype)

@property
def constellation(self):
return self._constellation
Expand All @@ -1001,6 +1003,8 @@ def call(self, inputs):
# Add a dummy dimension for broadcasting. This is not needed when no
# is a scalar, but also does not do any harm.
no = tf.expand_dims(no, axis=-1)
# Deal with zero or very small values.
no = tf.math.maximum(no, self._no_threshold)

# Compute exponents
exponents = -squared_dist/no
Expand Down

0 comments on commit 3a4538d

Please sign in to comment.