Commit a976b266 authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Added the method that puts the data around in the grid

parent 48966d5e
......@@ -2,6 +2,9 @@
from . import encoder
from . import reedsolomon
from . import sizes
from . import positions
import numpy as np
def prepareData(data, forceLayers = None, forceCompact = None):
encoded = encoder.Encoder().encode(data, asBits = True)
......@@ -41,3 +44,13 @@ def prepareData(data, forceLayers = None, forceCompact = None):
result = list(reedsolomon.fromwords(stuffed + rscode, wordsize))
return result, layers, compact, wordcount
def prepareDataMatrix(data, layers, compact, wordcount):
size = positions.matrixSize(layers, compact)
result = np.zeros((size, size), dtype=np.bool8)
if compact:
poslist = positions.COMPACT_POS_LIST[layers -1]
else:
poslist = positions.FULL_POS_LIST[layers -1]
for i, bit in enumerate(data):
result[poslist[i]] = bit
return result, layers, compact, wordcount
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment