Correct sampto behaviour using rdsamp and rdann?
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
まず、同じ sampto 値とインデックス 100 のサンプルを使用して、提供された Python の再現コードを wfdb.rdsamp と wfdb.rdann で実行します。各エントリポイントが上限をどのように処理するかを追跡します。完了の条件は、それぞれの範囲セマンティクスに一貫性があり、返されたアノテーションのインデックス指定で IndexError が発生しないことです。
索引モデルが issue の本文から書いたものです。
説明
When reading the signal with rdsamp and the corresponding annotations with rdann using the same sampto value results in an IndexError when accessing the signal array it includes an annotation outside the array.
In the example below, to read the first 100 entries, sampto must be 100. If using the same value for the annotations up to and including 100 are read, rather than stopping at 99 (i.e., the 100th entry in a 0-indexed array).
Is this the expected behaviour?
Using: python 3.9.18 with wfdb 4.1.2
import numpy as np
import wfdb
# create test data
n = 250
test_sig = np.zeros((n, 1))
test_sig[:, 0] = np.linspace(0, 1, n)
print(f'original shape: {test_sig.shape}')
# write to file
wfdb.wrsamp('test', fs = 250, units=['mV'], sig_name=['test'], p_signal=test_sig, fmt=['16'])
# create annotation and write
wfdb.Annotation(
record_name='test',
extension='atr',
sample=np.array([0, 99, 100, 249]),
symbol=['N', 'N', 'N', 'N']
).wrann()
samp_from = 0
samp_to = 100
# read values
values, _ = wfdb.rdsamp('test', sampfrom=samp_from, sampto=samp_to)
print(f'sampto shape: {values.shape}')
atr_1 = wfdb.rdann('test', extension='atr', sampfrom=samp_from, sampto=samp_to, shift_samps=True)
print(f'samples: {atr_1.sample}')
# IndexError
# print(f'values at samples: {values[atr_1.sample, :]}')
samp_to_minus_1 = samp_to - 1
atr_2 = wfdb.rdann('test', extension='atr', sampfrom=samp_from, sampto=samp_to_minus_1, shift_samps=True)
print(f'samples: {atr_2.sample}')
# No IndexError
# print(f'values at samples: {values[atr_2.sample, :]}')
- 主要言語
- Jupyter Notebook
- スター
- 853
- フォーク
- 322
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MIT-LCP/wfdb-python のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
MIT-LCP/wfdb-python#568 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
MIT-LCP/wfdb-python#557 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 58/100
MIT-LCP/wfdb-python#554 ·
-
WFDB path ignored オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
MIT-LCP/wfdb-python#545 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
MIT-LCP/wfdb-python#540 ·
MIT-LCP/wfdb-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
speaches-ai/speaches#678 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's オープンbug ecr
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
conda-forge/spacy-feedstock#177 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100