Skip to content

Commit

Permalink
BUG: Peak picking using downward algorithm not finding correct peaks
Browse files Browse the repository at this point in the history
The downard segmentation routines we incorrectly using is False when comparing
against numpy.bool__ objects. Correct to be == False
  • Loading branch information
jjhelmus committed Jun 4, 2015
1 parent 8974b13 commit 0ddf717
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nmrglue/analysis/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def mark_dseg(mdata, map, pt, mark, structure):
v = mdata.data[pt]
# Check all neightbors
for new_pt in neighbors(pt, mdata.shape, structure):
if mdata.mask[new_pt] is False and mdata[new_pt] < v:
if mdata.mask[new_pt] == False and mdata[new_pt] < v:
Q.append(new_pt)
map[new_pt] = mark
mdata[new_pt] = ma.masked
Expand All @@ -182,7 +182,7 @@ def label_downward_seg(data, labels, seg_slice, seg_index, max_index,
mark_dseg(msdata, slabels, argmax, seg_index, structure)

# mark any
while msdata.mask.all() is False:
while msdata.mask.all() == False:
argmax = np.unravel_index(msdata.argmax(), msdata.shape)
mark_dseg(msdata, slabels, argmax, max_index, structure)
max_index = max_index + 1
Expand Down Expand Up @@ -281,7 +281,7 @@ def mark_useg(mdata, map, pt, mark, structure):
v = mdata.data[pt]
# Check all neightbors
for new_pt in neighbors(pt, mdata.shape, structure):
if mdata.mask[new_pt] is False and mdata[new_pt] > v:
if mdata.mask[new_pt] == False and mdata[new_pt] > v:
Q.append(new_pt)
map[new_pt] = mark
mdata[new_pt] = ma.masked
Expand All @@ -300,7 +300,7 @@ def label_upward_seg(data, labels, seg_slice, seg_index, max_index,
mark_useg(msdata, slabels, argmin, seg_index, structure)

# mark any
while msdata.mask.all() is False:
while msdata.mask.all() == False:
argmin = np.unravel_index(msdata.argmin(), msdata.shape)
mark_useg(msdata, slabels, argmin, max_index, structure)
max_index = max_index + 1
Expand Down

0 comments on commit 0ddf717

Please sign in to comment.