提交 3c318186 authored 作者: --global's avatar --global

Fix sequence cutting in scan when all taps are negative

上级 6cf8a013
...@@ -500,20 +500,18 @@ def scan(fn, ...@@ -500,20 +500,18 @@ def scan(fn,
nw_slice.name = nw_name nw_slice.name = nw_name
# We cut the sequence such that seq[i] to correspond to # We cut the sequence such that seq[i] to correspond to
# seq[i-k] # seq[i-k]. For the purposes of cutting the sequences, we
if maxtap < 0: # need to pretend tap 0 is used to avoid cutting the sequences
offset = abs(maxtap) # too long if the taps are all lower or all higher than 0.
maxtap_proxy = max(maxtap, 0)
mintap_proxy = min(mintap, 0)
start = (k - mintap_proxy)
if k == maxtap_proxy:
nw_seq = seq['input'][start:]
else: else:
offset = 0 end = -(maxtap_proxy - k)
if maxtap == mintap and maxtap != 0: nw_seq = seq['input'][start:end]
if maxtap < 0:
nw_seq = seq['input'][:maxtap]
else:
nw_seq = seq['input'][maxtap:]
elif maxtap - k != 0:
nw_seq = seq['input'][offset + k - mintap: -(maxtap - k)]
else:
nw_seq = seq['input'][offset + k - mintap:]
if go_backwards: if go_backwards:
nw_seq = nw_seq[::-1] nw_seq = nw_seq[::-1]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论