Skip to content

Commit 0a917ec

Browse files
committed
source ~~> src
1 parent f3f4ec3 commit 0a917ec

File tree

2 files changed

+32
-34
lines changed

2 files changed

+32
-34
lines changed

src/aspire/classification/averager2d.py

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class Averager2D(ABC):
2121
Base class for 2D Image Averaging methods.
2222
"""
2323

24-
def __init__(self, composite_basis, source, dtype=None):
24+
def __init__(self, composite_basis, src, dtype=None):
2525
"""
2626
:param composite_basis: Basis to be used during class average composition (eg FFB2D)
27-
:param source: Source of original images.
27+
:param src: Source of original images.
2828
:param dtype: Numpy dtype to be used during alignment.
2929
"""
3030

3131
self.composite_basis = composite_basis
32-
self.src = source
32+
self.src = src
3333
if dtype is None:
3434
if self.composite_basis:
3535
self.dtype = self.composite_basis.dtype
@@ -101,17 +101,17 @@ class AligningAverager2D(Averager2D):
101101
Subclass supporting averagers which perfom an aligning stage.
102102
"""
103103

104-
def __init__(self, composite_basis, source, alignment_basis=None, dtype=None):
104+
def __init__(self, composite_basis, src, alignment_basis=None, dtype=None):
105105
"""
106106
:param composite_basis: Basis to be used during class average composition (eg hi res Cartesian/FFB2D).
107-
:param source: Source of original images.
107+
:param src: Source of original images.
108108
:param alignment_basis: Optional, basis to be used only during alignment (eg FSPCA).
109109
:param dtype: Numpy dtype to be used during alignment.
110110
"""
111111

112112
super().__init__(
113113
composite_basis=composite_basis,
114-
source=source,
114+
src=src,
115115
dtype=dtype,
116116
)
117117
# If alignment_basis is None, use composite_basis
@@ -214,7 +214,7 @@ class BFRAverager2D(AligningAverager2D):
214214
def __init__(
215215
self,
216216
composite_basis,
217-
source,
217+
src,
218218
alignment_basis=None,
219219
n_angles=360,
220220
dtype=None,
@@ -224,7 +224,7 @@ def __init__(
224224
225225
:params n_angles: Number of brute force rotations to attempt, defaults 360.
226226
"""
227-
super().__init__(composite_basis, source, alignment_basis, dtype)
227+
super().__init__(composite_basis, src, alignment_basis, dtype)
228228

229229
self.n_angles = n_angles
230230

@@ -301,7 +301,7 @@ class BFSRAverager2D(BFRAverager2D):
301301
def __init__(
302302
self,
303303
composite_basis,
304-
source,
304+
src,
305305
alignment_basis=None,
306306
n_angles=360,
307307
n_x_shifts=1,
@@ -324,7 +324,7 @@ def __init__(
324324
"""
325325
super().__init__(
326326
composite_basis,
327-
source,
327+
src,
328328
alignment_basis,
329329
n_angles,
330330
dtype=dtype,
@@ -441,34 +441,32 @@ class ReddyChatterjiAverager2D(AligningAverager2D):
441441
def __init__(
442442
self,
443443
composite_basis,
444-
source,
445-
alignment_source=None,
444+
src,
445+
alignment_src=None,
446446
diagnostics=False,
447447
dtype=None,
448448
):
449449
"""
450450
:param composite_basis: Basis to be used during class average composition.
451-
:param source: Source of original images.
452-
:param alignment_source: Optional, source to be used during class average alignment.
453-
Must be the same resolution as `source`.
451+
:param src: Source of original images.
452+
:param alignment_src: Optional, source to be used during class average alignment.
453+
Must be the same resolution as `src`.
454454
:param dtype: Numpy dtype to be used during alignment.
455455
"""
456456

457457
self.__cache = dict()
458458
self.diagnostics = diagnostics
459459
self.do_cross_corr_translations = True
460-
self.alignment_src = alignment_source or source
460+
self.alignment_src = alignment_src or src
461461

462462
# TODO, for accomodating different resolutions we minimally need to adapt shifting.
463463
# Outside of scope right now, but would make a nice PR later.
464-
if self.alignment_src.L != source.L:
465-
raise RuntimeError("Currently `alignment_src.L` must equal `source.L`")
466-
if self.alignment_src.dtype != source.dtype:
467-
raise RuntimeError(
468-
"Currently `alignment_src.dtype` must equal `source.dtype`"
469-
)
464+
if self.alignment_src.L != src.L:
465+
raise RuntimeError("Currently `alignment_src.L` must equal `src.L`")
466+
if self.alignment_src.dtype != src.dtype:
467+
raise RuntimeError("Currently `alignment_src.dtype` must equal `src.dtype`")
470468

471-
super().__init__(composite_basis, source, composite_basis, dtype=dtype)
469+
super().__init__(composite_basis, src, composite_basis, dtype=dtype)
472470

473471
def _phase_cross_correlation(self, img0, img1):
474472
"""
@@ -905,22 +903,22 @@ class BFSReddyChatterjiAverager2D(ReddyChatterjiAverager2D):
905903
def __init__(
906904
self,
907905
composite_basis,
908-
source,
909-
alignment_source=None,
906+
src,
907+
alignment_src=None,
910908
radius=None,
911909
diagnostics=False,
912910
dtype=None,
913911
):
914912
"""
915913
:param alignment_basis: Basis to be used during alignment.
916914
For current implementation of ReddyChatterjiAverager2D this should be `None`.
917-
Instead see `alignment_source`.
918-
:param source: Source of original images.
915+
Instead see `alignment_src`.
916+
:param src: Source of original images.
919917
:param composite_basis: Basis to be used during class average composition.
920-
:param alignment_source: Optional, source to be used during class average alignment.
921-
Must be the same resolution as `source`.
918+
:param alignment_src: Optional, source to be used during class average alignment.
919+
Must be the same resolution as `src`.
922920
:param radius: Brute force translation search radius.
923-
Defaults to source.L//8.
921+
Defaults to src.L//8.
924922
:param dtype: Numpy dtype to be used during alignment.
925923
926924
:param diagnostics: Plot interactive diagnostic graphics (for debugging).
@@ -929,16 +927,16 @@ def __init__(
929927

930928
super().__init__(
931929
composite_basis,
932-
source,
933-
alignment_source,
930+
src,
931+
alignment_src,
934932
diagnostics,
935933
dtype=dtype,
936934
)
937935

938936
# For brute force we disable the cross_corr translation code
939937
self.do_cross_corr_translations = False
940938
# Assign search radius
941-
self.radius = radius or source.L // 8
939+
self.radius = radius or src.L // 8
942940

943941
def align(self, classes, reflections, basis_coefficients):
944942
"""

tests/test_averager2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def testAverager(self):
257257
# Construct the Averager and then call the main `align` method
258258
avgr = self.averager(
259259
composite_basis=self.basis,
260-
source=self._getSrc(),
260+
src=self._getSrc(),
261261
dtype=self.dtype,
262262
)
263263
_rotations, _shifts, _ = avgr.align(self.classes, self.reflections, self.coefs)

0 commit comments

Comments
 (0)