Skip to content

Commit 03ae177

Browse files
committed
style: change flip_image parameter to make non-flipping default.
1 parent 1567b45 commit 03ae177

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/diffpy/srxplanar/loadimage.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, p):
5454
self.config = p
5555
return
5656

57-
def flip_image(self, pic):
57+
def flip_image(self, pic, fliphorizontal=False, flipvertical=False):
5858
"""Flip image if configured in config.
5959
6060
:param pic: 2d array, image array
@@ -66,7 +66,7 @@ def flip_image(self, pic):
6666
pic = np.array(pic[::-1, :])
6767
return pic
6868

69-
def load_image(self, filename):
69+
def load_image(self, filename, fliphorizontal=False, flipvertical=False):
7070
"""Load image file. If loading fails (e.g. incomplete file),
7171
retry for 5 seconds (10×0.5s).
7272
@@ -95,14 +95,11 @@ def load_image(self, filename):
9595
if filenamefull.suffix == ".npy":
9696
image = np.load(filenamefull)
9797
else:
98-
image = open_image(
99-
str(filenamefull)
100-
) # openImage expects str
98+
image = open_image(filenamefull)
10199
break
102100
except FileNotFoundError:
103101
time.sleep(0.5)
104-
105-
image = self.flip_image(image)
102+
image = self.flip_image(image, fliphorizontal, flipvertical)
106103
image[image < 0] = 0
107104
return image
108105

0 commit comments

Comments
 (0)