Пример #1
0
    def test_timeseries_too_short(self):
        net = ECA(30, 3)

        with self.assertRaises(ValueError):
            net.timeseries(-1)

        with self.assertRaises(ValueError):
            net.timeseries(0)
Пример #2
0
 def test_timeseries_eca(self):
     for size in [5, 7, 11]:
         rule = ECA(30, size)
         time = 10
         series = rule.timeseries(time)
         self.assertEqual((size, 2**size, time + 1), series.shape)
         for index, state in enumerate(rule):
             traj = rule.trajectory(state, timesteps=time)
             for t, expect in enumerate(traj):
                 got = series[:, index, t]
                 self.assertTrue(np.array_equal(expect, got))