Skip to content

Commit

Permalink
mapping: allow demapping infinite/high SNR symbols
Browse files Browse the repository at this point in the history
Signed-off-by: japm48 <[email protected]>
  • Loading branch information
japm48 committed Apr 15, 2024
1 parent 29dba8d commit 71b7e41
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 = np.finfo(dtype.as_numpy_dtype).tiny

@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 71b7e41

Please sign in to comment.