Skip to content

Commit

Permalink
Merge pull request #200 from omrivolk/master
Browse files Browse the repository at this point in the history
Fix bug when more than 2 traces are present
  • Loading branch information
ThomasLecocq committed Feb 25, 2020
2 parents 6c01168 + bafa97e commit 7b259f0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions msnoise/api.py
Expand Up @@ -1745,17 +1745,14 @@ def make_same_length(st):

# get the mask of all traces, i.e. the parts where at least one trace has
# a gap
# TODO add cases with more than 2 or 3 traces (could append?)
# TODO is there a better way to AND masks ?
mask = []

if len(st) < 2:
return st
elif len(st) == 2:
mask = np.logical_or(st[0].data.mask, st[1].data.mask)
elif len(st) == 3:
mask = np.logical_or(st[0].data.mask, st[1].data.mask, st[2].data.mask)
if not len(mask):
return st.split()

masks=[]
for tr in st:
masks.append(tr.data.mask)
mask = np.any(masks,axis=0)

# apply the mask to all traces
for tr in st:
Expand Down

0 comments on commit 7b259f0

Please sign in to comment.