-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRavenProgressiveMatrix.py
More file actions
45 lines (31 loc) · 1.18 KB
/
RavenProgressiveMatrix.py
File metadata and controls
45 lines (31 loc) · 1.18 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import numpy as np
from matplotlib import pyplot as plt
import utils
import jaccard
class RavenProgressiveMatrix:
def __init__(self, name, matrix, matrix_ref, options, answer):
self.name = name
self.type = str(matrix.shape[0]) + "x" + str(matrix.shape[1])
self.matrix = matrix
self.options = options
self.answer = answer
self.matrix_ref = matrix_ref
def plot_problem(self):
fig, axs = plt.subplots(nrows = self.matrix.shape[0] + 1,
ncols = max(self.matrix.shape[1], len(self.options)))
fig.suptitle(self.name)
for ii, axs_row in enumerate(axs):
for jj, ax in enumerate(axs_row):
if ii < self.matrix.shape[0]:
if jj < self.matrix.shape[1]:
ax.imshow(self.matrix[ii, jj], cmap = "binary")
else:
ax.remove()
else:
if jj < len(self.options):
ax.imshow(self.options[jj], cmap = "binary")
else:
ax.remove()
plt.show()
def plot_solution(self):
pass