Skip to content

Commit 70e05dc

Browse files
Fix: change 'is' to '=='
1 parent 403fd7f commit 70e05dc

4 files changed

Lines changed: 11 additions & 11 deletions

File tree

rodan-main/code/rodan/jobs/diagonal_neume_slicing/ProjectionSplitting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ def _split(self, image, pos, dim, rotation):
223223
rcp = self._get_center_of_image(r_image) # rotated center point
224224

225225
# rotated image points
226-
r_p1 = (pos, r_rows) if dim is 'x' else (0, pos) # left / bottom
227-
r_p2 = (pos, 0) if dim is 'x' else (r_cols, pos) # top / right
226+
r_p1 = (pos, r_rows) if dim == 'x' else (0, pos) # left / bottom
227+
r_p2 = (pos, 0) if dim == 'x' else (r_cols, pos) # top / right
228228
# print r_p1, r_p2
229229

230230
# # show rotated cuts

rodan-main/code/rodan/jobs/diagonal_neume_slicing/SliceFinding.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ def _arrayify_projection(self, projection):
120120
for i, x in enumerate(projection[1:]):
121121

122122
# found max
123-
if projection[i] > x and direction is 'up':
123+
if projection[i] > x and direction == 'up':
124124
projection_spaces.append(projection[start_pos:i + 1])
125125
start_pos = i + 1
126126
direction = 'down'
127127

128128
# found min
129-
elif projection[i] < x and direction is 'down':
129+
elif projection[i] < x and direction == 'down':
130130
projection_spaces.append(projection[start_pos:i + 1])
131131
start_pos = i + 1
132132
direction = 'up'
@@ -189,7 +189,7 @@ def _get_extrema(self, arrays):
189189
def _find_slices(self, mm, dim):
190190
minima, maxima = mm
191191
slices = []
192-
rel_max = self.x_max_proj if dim is 'x' else self.y_max_proj
192+
rel_max = self.x_max_proj if dim == 'x' else self.y_max_proj
193193

194194
for i, m in enumerate(maxima[:-1]):
195195
peak_L, peak_R = maxima[i], maxima[i + 1]

rodan-main/code/rodan/jobs/heuristic_pitch_finding/PitchFinding.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,18 +327,18 @@ def _find_distance_between_line_and_point(self, p1, p2, p3):
327327

328328
line_type = ('vertical' if x1 == x2 else 'horizontal')
329329

330-
if line_type is 'vertical':
330+
if line_type == 'vertical':
331331
perp = y3 < max([y1, y2]) and y3 > min([y1, y2])
332-
elif line_type is 'horizontal':
332+
elif line_type == 'horizontal':
333333
perp = x3 < max([x1, x2]) and x3 > min([x1, x2])
334334

335335
if not perp:
336336
s1 = self._find_distance_between_points(p3, p1)
337337
s2 = self._find_distance_between_points(p3, p2)
338338
return min([s1, s2])
339-
elif line_type is 'vertical':
339+
elif line_type == 'vertical':
340340
return abs(float(x3 - x1))
341-
elif line_type is 'horizontal':
341+
elif line_type == 'horizontal':
342342
return abs(float(y3 - y1))
343343

344344
def _find_distance_between_points(self, p1, p2):

rodan-main/code/rodan/jobs/heuristic_pitch_finding/StaffFinding.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ def _binarize_image(self, image):
109109
def _get_staff_finding_algorithm(self, image, sfnd_alg):
110110
if sfnd_alg == 0:
111111
return musicstaves.StaffFinder_miyao(image)
112-
elif sfnd_alg is 1:
112+
elif sfnd_alg == 1:
113113
return musicstaves.StaffFinder_dalitz(image)
114-
elif sfnd_alg is 2:
114+
elif sfnd_alg == 2:
115115
return musicstaves.StaffFinder_projections(image)
116116
else:
117117
raise AomrStaffFinderNotFoundError("The staff finding algorithm was not found.")

0 commit comments

Comments
 (0)