Skip to content

Commit 01b901d

Browse files
mariomario
authored andcommitted
corrected coordinates in create gamma
1 parent bbbcc6c commit 01b901d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

code/python/cni_toolbox/HGR.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,19 @@ def get_parameters(self, n_batch = 10000,
211211
beta = regress(S, P)
212212

213213
for v in np.arange(0, n_mask - n_batch, n_batch):
214+
i = int(v / n_mask * 21)
215+
sys.stdout.write('\r')
216+
sys.stdout.write("[%-20s] %d%%"
217+
% ('=' * i, 5 * i))
218+
214219
batch = idx[v: v + n_batch]
215220
im = np.matmul(self.gamma, self.theta[:, batch])
216221
pos = np.argmax(im, axis = 0)
217222
mx = np.max(im, axis = 0)
218223
mn = np.min(im, axis = 0)
219224
val_range = mx - mn
220225
im = ((im - mn) / val_range)**alpha
221-
m_image = np.mean(im, axis = 0).transpose()
226+
m_image = np.mean(im, axis = 0)
222227

223228
cx = np.floor(pos / self.r_stimulus)
224229
cy = pos % self.r_stimulus
@@ -228,17 +233,17 @@ def get_parameters(self, n_batch = 10000,
228233
P = np.hstack((m_image.reshape(-1,1), R.reshape(-1,1)))
229234
results['sigma'][batch] = np.matmul(P, beta)
230235

231-
i = int(v / n_mask * 21)
232-
sys.stdout.write('\r')
233-
sys.stdout.write("[%-20s] %d%%"
234-
% ('=' * i, 5 * i))
235-
236236
exist = 'v' in locals()
237237
if exist==False:
238238
batch = idx
239239
else:
240240
batch = idx[v:]
241241

242+
i = 20
243+
sys.stdout.write('\r')
244+
sys.stdout.write("[%-20s] %d%%"
245+
% ('=' * i, 5 * i))
246+
242247
im = np.matmul(self.gamma, self.theta[:, batch])
243248
pos = np.argmax(im, axis = 0)
244249
mx = np.max(im, axis = 0)
@@ -255,11 +260,6 @@ def get_parameters(self, n_batch = 10000,
255260
P = np.hstack((m_image.reshape(-1,1), R.reshape(-1,1)))
256261
results['sigma'][batch] = np.matmul(P, beta)
257262

258-
i = int(v / n_mask * 21)
259-
sys.stdout.write('\r')
260-
sys.stdout.write("[%-20s] %d%%"
261-
% ('=' * i, 5 * i))
262-
263263
return results
264264

265265
def get_timecourses(self, stimulus):
@@ -392,7 +392,7 @@ def __create_gamma__(self):
392392
r = np.arange(self.r_stimulus)
393393
[x_coordinates, y_coordinates] = np.meshgrid(r, r)
394394
x_coordinates = x_coordinates.flatten()
395-
y_coordinates = -y_coordinates.flatten()
395+
y_coordinates = y_coordinates.flatten()
396396
sigma = self.fwhm / (2 * np.sqrt(2 * np.log(2)))
397397
self.gamma = np.zeros((self.n_pixels, self.n_features))
398398
pix_id = np.linspace(0, self.n_pixels, self.n_features * self.n_gaussians)

0 commit comments

Comments
 (0)