Skip to content

Problem with flattening SFGs

It seems like the following would be a way to flatten SFGs:

from b_asic.signal_flow_graph import SFG
from b_asic.sfg_generators import wdf_allpass

allpass = wdf_allpass(0.5)
allpass2 = allpass.replace_operation(allpass.find_by_id('sym2p1').to_sfg(), 'sym2p1')

allpass2.find_by_id('sfg1').connect_external_signals_to_components()

allpass3 = SFG(allpass2.input_operations, allpass2.output_operations)

allpass image

allpass2 before connect... image

but creating allpass3 leads to

Traceback (most recent call last):

  File /local/data1/miniconda3/lib/python3.10/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File /local/data1/B-ASIC/b_asic/untitled1.py:17
    allpass3 = SFG(allpass2.input_operations, allpass2.output_operations)

  File /local/data1/B-ASIC/b_asic/signal_flow_graph.py:264 in __init__
    self._add_operation_connected_tree_copy(

  File /local/data1/B-ASIC/b_asic/signal_flow_graph.py:1176 in _add_operation_connected_tree_copy
    raise ValueError(

ValueError: Signal (id: s1, 	name: no_name, 	bits: None) without destination in SFG

It seems like s1 is the input signal, at least from: image