-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.py
More file actions
28 lines (22 loc) · 768 Bytes
/
util.py
File metadata and controls
28 lines (22 loc) · 768 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
27
28
import matplotlib.pyplot as plt
import numpy as np
class Util:
@staticmethod
def parameter(start, end, delta=0):
value = np.random.randint(start-delta, end+delta)
parameters = len(range(start-delta, end+delta))
return value, parameters
@staticmethod
def imshow_nicely(image, filename=None, new_figure=True):
if new_figure:
plt.figure()
plt.imshow(image, cmap='Greys', interpolation='nearest')
ax = plt.gca()
ax.set_xticklabels('')
ax.set_yticklabels('')
ax.set_xticks(np.arange(-.5, 100, 10), minor=False);
ax.set_yticks(np.arange(-.5, 100, 10), minor=False);
ax.grid(which='major', color='gray', linestyle=':', linewidth='0.5')
ax.set_axisbelow(True)
if filename:
plt.savefig(filename, bbox_inches='tight', transparent=True,)