Aleš Erjavec committed 64a2f4b

Fixed 'ScaleLinProjData.create_projection_as_numeric_array' (again).

Two calls to jitter_array with the same seed resulted in jittering
applied only to the y=x direction.

Comments (0)

Files changed (1)


-def jitter_array(array, ratio=0.01, axis=0, rand_seed=0):
+def jitter_array(array, ratio=0.01, axis=0, rand_seed=None):
     array = numpy.array(array)
             y_positions *= self.trueScaleFactor
         if jitter_size > 0.0:
-            x_positions = jitter_array(x_positions, jitter_size / 100.,
-                                       rand_seed=self.jitter_seed)
-            y_positions = jitter_array(y_positions, jitter_size / 100.,
-                                       rand_seed=self.jitter_seed)
+            positions = numpy.vstack((x_positions, y_positions))
+            positions = jitter_array(positions, jitter_size / 100., axis=1,
+                                     rand_seed=self.jitter_seed)
+            x_positions, y_positions = numpy.vsplit(positions, 2)
+            x_positions = x_positions.ravel()
+            y_positions = y_positions.ravel()
         self.last_attr_indices = attr_indices
         if class_list != None:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.