ann2rr filters intervals by length instead of by time in the record

クローズ
#617 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #622 @TheNetherWatcher による — マージ済み

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
data

調査の方向性

The ann2rr function lives in wfdb/processing.py; start by reading its docstring and the filtering lines shown. Compute each interval's end time as cumulative sum of RR intervals from start_time, then keep those between bounds. Done means ann2rr('sample-data/100','atr', start_time=0.9) returns intervals after 0.9s, and tests pass.

索引モデルが issue の本文から書いたものです。

説明

The ann2rr docstring describes start_time and stop_time as "the time to start the intervals" and "the time to stop the intervals", in seconds. But they're compared with the length of each interval, not with its position in the record:

time_interval = rr_interval / ann.fs
if start_time is not None:
    time_interval = time_interval[(time_interval > start_time).astype(bool)]
if stop_time is not None:
    time_interval = time_interval[(time_interval < stop_time).astype(bool)]

For example, with record 100 (360 Hz):

from wfdb import processing

len(processing.ann2rr("sample-data/100", "atr"))                  # 2274
processing.ann2rr("sample-data/100", "atr", start_time=0.9)       # 30 intervals, all longer than 0.9 s
processing.ann2rr("sample-data/100", "atr", stop_time=0.5)        # 2 intervals, both shorter than 0.5 s

So start_time=0.9 drops every interval shorter than 0.9 s, rather than the intervals before 0.9 s into the record.

The WFDB ann2rr program's -f and -t options select annotations by time in the record. ann2rr should probably do the same: keep the intervals that end between start_time and stop_time, measuring the first interval from start_time, as ann2rr -f does.

This is separate from #584, which changes which annotations are used but leaves this filtering unchanged.

主要言語
Jupyter Notebook
スター
856
フォーク
326
平均マージ
22時間 46分
マージ済み PR(30日)
40

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MIT-LCP/wfdb-python のほかの issue

MIT-LCP/wfdb-python の issue をすべて見る

似ている issue

Data Engineering の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。