Skip to content

Commit f09557e

Browse files
mariomario
authored andcommitted
correct indentation in get_parameters
1 parent 9e5b369 commit f09557e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

code/python/cni_toolbox/HGR.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -232,32 +232,32 @@ def get_parameters(self, n_batch = 10000,
232232
sys.stdout.write("[%-20s] %d%%"
233233
('=' * i, 5 * i))
234234

235-
exist = 'v' in locals()
236-
if exist==False:
237-
batch = idx
238-
else:
239-
batch = idx[v:]
240-
241-
im = np.matmul(self.gamma, self.theta[:, batch])
242-
pos = np.argmax(im, axis = 0)
243-
mx = np.max(im, axis = 0)
244-
mn = np.min(im, axis = 0)
245-
val_range = mx - mn
246-
im = ((im - mn) / val_range)**alpha
247-
m_image = np.mean(im, axis = 0).transpose()
248-
249-
cx = np.floor(pos / self.r_stimulus)
250-
cy = pos % self.r_stimulus
251-
results['mu_x'][batch] = cx / self.r_stimulus * max_radius * 2 - max_radius
252-
results['mu_y'][batch] = -cy / self.r_stimulus * max_radius * 2 - max_radius
253-
R = np.sqrt(results['mu_x'][batch]**2 + results['mu_y'][batch]**2)
254-
P = np.hstack((m_image, R))
255-
results['sigma'][batch] = np.matmul(P, beta)
256-
257-
i = int(v / n_mask* 21)
258-
sys.stdout.write('\r')
259-
sys.stdout.write("[%-20s] %d%%"
260-
('=' * i, 5 * i))
235+
exist = 'v' in locals()
236+
if exist==False:
237+
batch = idx
238+
else:
239+
batch = idx[v:]
240+
241+
im = np.matmul(self.gamma, self.theta[:, batch])
242+
pos = np.argmax(im, axis = 0)
243+
mx = np.max(im, axis = 0)
244+
mn = np.min(im, axis = 0)
245+
val_range = mx - mn
246+
im = ((im - mn) / val_range)**alpha
247+
m_image = np.mean(im, axis = 0).transpose()
248+
249+
cx = np.floor(pos / self.r_stimulus)
250+
cy = pos % self.r_stimulus
251+
results['mu_x'][batch] = cx / self.r_stimulus * max_radius * 2 - max_radius
252+
results['mu_y'][batch] = -cy / self.r_stimulus * max_radius * 2 - max_radius
253+
R = np.sqrt(results['mu_x'][batch]**2 + results['mu_y'][batch]**2)
254+
P = np.hstack((m_image, R))
255+
results['sigma'][batch] = np.matmul(P, beta)
256+
257+
i = int(v / n_mask * 21)
258+
sys.stdout.write('\r')
259+
sys.stdout.write("[%-20s] %d%%"
260+
('=' * i, 5 * i))
261261

262262
return results
263263

0 commit comments

Comments
 (0)