def _makeSquare_works(self, num_pixels, num_rows):
     self.assertEqual(num_pixels % num_rows, 0)
     num_cols = int(num_pixels / num_rows)
     effect = panelize.MakeSquare()
     effect.setNumOutputPixels(num_pixels)
     effect.setNumOutputRows(num_rows)
     self.assertEqual(effect.getNumInputPixels(0), 2 * num_cols)
     input = np.array([[i + 1, 2 * i + 1, 3 * i + 1]
                       for i in range(0, 2 * num_cols)]).T
     for i in range(0, 2 * num_cols):
         self.assertEqual(i + 1, input[0, i])
     effect._inputBuffer = [input]
     effect._outputBuffer = [None]
     loop = asyncio.get_event_loop()
     loop.run_until_complete(effect.update(0))
     self.assertIsNotNone(effect._mapMask)
     effect.process()
     self.assertIsNotNone(effect._outputBuffer)
     self.assertEqual(len(effect._outputBuffer), 1)
     output = effect._outputBuffer[0]
     self.assertEqual(np.size(output, axis=1), num_pixels)
     for i in range(0, num_rows):
         for j in range(0, num_cols):
             index = self._indexFor(i, j, num_rows, num_cols)
             print(index)
             self.assertEqual(input[0, index], output[0, j + i * num_cols])
def createPanelPendulum():
    fg = filtergraph.FilterGraph(recordTimings=True)

    led_out = devices.LEDOutput()
    fg.addEffectNode(led_out)

    makeSquare = panelize.MakeSquare()
    fg.addEffectNode(makeSquare)

    pendulum = generative.Pendulum(heightactivator=False, displacement=0.5)
    fg.addEffectNode(pendulum)

    fg.addConnection(makeSquare, 0, led_out, 0)
    fg.addConnection(pendulum, 0, makeSquare, 0)
    return fg