Ejemplo n.º 1
0
    def test_from_signal_and_connection_with_slice(self, latching, num, den):
        # Create the mock signal and connection
        signal = mock.Mock(name="signal", spec_set=["latching"])
        signal.latching = latching

        with nengo.Network():
            a = nengo.Ensemble(100, 1)
            b = nengo.Ensemble(100, 2)
            connection = nengo.Connection(a, b[1],
                                          synapse=nengo.LinearFilter(num, den))

        # Create the filter
        lpf = LinearFilter.from_signal_and_connection(signal, connection)
        assert lpf == LinearFilter(2, latching, num, den)
Ejemplo n.º 2
0
    def test_from_signal_and_connection_force_width(self):
        # Create the mock signal and connection
        signal = mock.Mock(name="signal", spec_set=["latching"])
        signal.latching = True

        with nengo.Network():
            a = nengo.Ensemble(100, 3)
            b = nengo.Ensemble(100, 3)
            connection = nengo.Connection(
                a, b, synapse=nengo.LinearFilter([1.0], [0.5, 1.0])
            )

        # Create the filter
        lpf = LinearFilter.from_signal_and_connection(signal, connection,
                                                      width=2)
        assert lpf == LinearFilter(2, True, [1.0], [0.5, 1.0])