@@ -66,11 +66,11 @@ def average(
6666
6767 Should return an Image source of synthetic class averages.
6868
69- :param classes: class indices, refering to src. (n_img , n_nbor).
69+ :param classes: class indices, refering to src. (n_classes , n_nbor).
7070 :param reflections: Bool representing whether to reflect image in `classes`.
71- (n_img , n_nbor)
71+ (n_clases , n_nbor)
7272 :param coefs: Optional basis coefs (could avoid recomputing).
73- (n_img , coef_count)
73+ (n_classes , coef_count)
7474 :return: Stack of synthetic class average images as Image instance.
7575 """
7676
@@ -134,21 +134,21 @@ def align(self, classes, reflections, basis_coefficients):
134134
135135 `rotations` is an (n_classes, n_nbor) array of angles,
136136 which should represent the rotations needed to align images within
137- that class. `rotations` is measured in Radians.
138-
139- `correlations` is an (n_classes, n_nbor) array representing
140- a correlation like measure between classified images and their base
141- image (image index 0).
137+ that class. `rotations` is measured in radians.
142138
143139 `shifts` is None or an (n_classes, n_nbor) array of 2D shifts
144140 which should represent the translation needed to best align the images
145141 within that class.
146142
143+ `correlations` is an (n_classes, n_nbor) array representing
144+ a correlation like measure between classified images and their base
145+ image (image index 0).
146+
147147 Subclasses of should implement and extend this method.
148148
149- :param classes: (n_classes, n_nbor) integer array of img indices
150- :param reflections: (n_classes, n_nbor) bool array of corresponding reflections
151- :param basis_coefficients: (n_img, self.pca_basis .count) compressed basis coefficients
149+ :param classes: (n_classes, n_nbor) integer array of img indices.
150+ :param reflections: (n_classes, n_nbor) bool array of corresponding reflections,
151+ :param basis_coefficients: (n_img, self.alignment_basis .count) basis coefficients,
152152
153153 :returns: (rotations, shifts, correlations)
154154 """
@@ -216,13 +216,13 @@ def __init__(
216216 composite_basis ,
217217 source ,
218218 alignment_basis = None ,
219- n_angles = 359 ,
219+ n_angles = 360 ,
220220 dtype = None ,
221221 ):
222222 """
223223 See AligningAverager2D, adds:
224224
225- :params n_angles: Number of brute force rotations to attempt, defaults 359 .
225+ :params n_angles: Number of brute force rotations to attempt, defaults 360 .
226226 """
227227 super ().__init__ (composite_basis , source , alignment_basis , dtype )
228228
@@ -303,7 +303,7 @@ def __init__(
303303 composite_basis ,
304304 source ,
305305 alignment_basis = None ,
306- n_angles = 359 ,
306+ n_angles = 360 ,
307307 n_x_shifts = 1 ,
308308 n_y_shifts = 1 ,
309309 dtype = None ,
@@ -318,7 +318,7 @@ def __init__(
318318
319319 n_x_shifts=n_y_shifts=0 is the same as calling BFRAverager2D.
320320
321- :params n_angles: Number of brute force rotations to attempt, defaults 359 .
321+ :params n_angles: Number of brute force rotations to attempt, defaults 360 .
322322 :params n_x_shifts: +- Number of brute force xshifts to attempt, defaults 1.
323323 :params n_y_shifts: +- Number of brute force xshifts to attempt, defaults 1.
324324 """
@@ -369,7 +369,9 @@ def align(self, classes, reflections, basis_coefficients):
369369 shifts = np .empty ((* classes .shape , 2 ), dtype = int )
370370
371371 if basis_coefficients is None :
372- # Retrieve image coefficients, this is bad, but should be deleted anyway.
372+ # Retrieve image coefficients, this is bad, it load all images.
373+ # TODO: Refactor this s.t. the following code blocks and super().align
374+ # only require coefficients relating to their class. See _cls_images.
373375 basis_coefficients = self .composite_basis .evaluate_t (
374376 self .src .images (0 , np .inf )
375377 )
@@ -382,7 +384,7 @@ def align(self, classes, reflections, basis_coefficients):
382384 # Loop over shift search space, updating best result
383385 for x , y in product (x_shifts , y_shifts ):
384386 shift = np .array ([x , y ], dtype = int )
385- logger .debug (f"Computing Rotational alignment after shift ({ x } ,{ y } )." )
387+ logger .debug (f"Computing rotational alignment after shift ({ x } ,{ y } )." )
386388
387389 # Shift the coef representing the first (base) entry in each class
388390 # by the negation of the shift
0 commit comments