-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecovery.py
More file actions
23 lines (17 loc) · 736 Bytes
/
Recovery.py
File metadata and controls
23 lines (17 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import numpy as np
from numba import jit
@jit(nopython=True)
def recovery(instruction, deviations, big_grid, WIN_SIZE, squares_size):
data = np.zeros((WIN_SIZE, WIN_SIZE), dtype=np.uint8)
for k in range(len(instruction)):
for l in range(len(instruction)):
for i in range(squares_size):
for j in range(squares_size):
color = big_grid[instruction[k, l, 0],
instruction[k, l, 1]][i, j] * deviations[k, l]
if color < 0:
color = 0
elif color > 254:
color = 254
data[k*squares_size+i, l*squares_size+j] = color
return data