-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.py
More file actions
29 lines (23 loc) · 742 Bytes
/
Main.py
File metadata and controls
29 lines (23 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import numpy as np
import correlation_functions as cf
import helper as hlp
import numpy as np
BORDER_VALUE = -1
class Pixel:
def __init__(self, color, coord):
self.color = color
self.coord = coord
class Grid:
def __init__(self, raw_grid):
self.raw = raw_grid
self.shape = raw_grid.shape
self.sum = np.sum(raw_grid)
self.size = len(np.nonzero(raw_grid!=BORDER_VALUE))
self.pixels = [Pixel(color, i) for i,color in enumerate(raw_grid.flatten())]
self.colors = np.unique(raw_grid)
self.objects = []
self.patterns = []
pixel = Pixel(1, [1,2])
pixel2 = Pixel(1, [1,2])
grid = np.asarray([[1, 2, 1], [2, 2, 2], [3, 1, 1]])
g = Grid(grid)