summaryrefslogtreecommitdiff
path: root/gr-fec/python
diff options
context:
space:
mode:
authorJohannes Demel <ufcsy@student.kit.edu>2018-02-25 16:14:05 +0100
committerMichael Dickens <michael.dickens@ettus.com>2020-04-02 09:24:49 -0400
commit85a2e0ec362fcc862bfdab898d6bdbd4200431bb (patch)
treed2826c2d6f28111e96307a63e76cc191720c0534 /gr-fec/python
parentf2d3d412861e4b0e65ba4b3375f5aaf60ccf2660 (diff)
fec: make SciPy an optional dependency
This patch fixes issues like #1545 and #1539. Basically if a module in fec.polar requires SciPy and fails to do , it overwrites the missing function with an approximate version
Diffstat (limited to 'gr-fec/python')
-rw-r--r--gr-fec/python/fec/polar/channel_construction.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/gr-fec/python/fec/polar/channel_construction.py b/gr-fec/python/fec/polar/channel_construction.py
index 84e63871bc..d7958b1d9c 100644
--- a/gr-fec/python/fec/polar/channel_construction.py
+++ b/gr-fec/python/fec/polar/channel_construction.py
@@ -17,8 +17,13 @@ from __future__ import absolute_import
from .channel_construction_bec import calculate_bec_channel_capacities
from .channel_construction_bec import design_snr_to_bec_eta
from .channel_construction_bec import bhattacharyya_bounds
-from .channel_construction_awgn import tal_vardy_tpm_algorithm
from .helper_functions import *
+try:
+ from .channel_construction_awgn import tal_vardy_tpm_algorithm
+except ImportError:
+ print("SciPy missing. Overwrite Tal-Vardy algorithm with BEC approximation")
+ def tal_vardy_tpm_algorithm(block_size, design_snr, mu):
+ return bhattacharyya_bounds(design_snr, block_size)
Z_PARAM_FIRST_HEADER_LINE = "Bhattacharyya parameters (Z-parameters) for a polar code"