bibliopixel.layout.cutter module

Cut matrices by row or column and apply operations to them.

class bibliopixel.layout.cutter.Cutter(layout, by_row=True)[source]

Bases: object

Base class that pre-calculates cuts and can use them to apply a function to the layout.

Each “cut” is a row or column, depending on the value of by_row.

The entries are iterated forward or backwards, depending on the value of forward.

apply(function)[source]

For each row or column in cuts, read a list of its colors, apply the function to that list of colors, then write it back to the layout.

class bibliopixel.layout.cutter.Indexer(layout, by_row=True)[source]

Bases: bibliopixel.layout.cutter.Cutter

Slower implementation of Cutter that uses lists of indices and the Matrix interface.

cut_column(i)[source]
cut_row(i)[source]
read(cut)[source]
write(cut, value)[source]
class bibliopixel.layout.cutter.Slicer(layout, by_row=True)[source]

Bases: bibliopixel.layout.cutter.Cutter

Implementation of Cutter that uses slices of the underlying colorlist. Does not work if the Matrix layout is serpentine or has any reflections or rotations.

cut_column(i)[source]
cut_row(i)[source]
read(cut)[source]
write(cut, value)[source]