Skip to content

Commit 7b259f0

Browse files
authored
Merge pull request #200 from omrivolk/master
Fix bug when more than 2 traces are present
2 parents 6c01168 + bafa97e commit 7b259f0

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

msnoise/api.py

+6-9
Original file line numberDiff line numberDiff line change
@@ -1745,17 +1745,14 @@ def make_same_length(st):
17451745

17461746
# get the mask of all traces, i.e. the parts where at least one trace has
17471747
# a gap
1748-
# TODO add cases with more than 2 or 3 traces (could append?)
1749-
# TODO is there a better way to AND masks ?
1750-
mask = []
1748+
17511749
if len(st) < 2:
17521750
return st
1753-
elif len(st) == 2:
1754-
mask = np.logical_or(st[0].data.mask, st[1].data.mask)
1755-
elif len(st) == 3:
1756-
mask = np.logical_or(st[0].data.mask, st[1].data.mask, st[2].data.mask)
1757-
if not len(mask):
1758-
return st.split()
1751+
1752+
masks=[]
1753+
for tr in st:
1754+
masks.append(tr.data.mask)
1755+
mask = np.any(masks,axis=0)
17591756

17601757
# apply the mask to all traces
17611758
for tr in st:

0 commit comments

Comments
 (0)