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

Aberta
#617 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@TheNetherWatcher já está trabalhando nisso.

Desde 1/11/2026.

  • #622 de @TheNetherWatcher — aberto

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
72/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
python
Domínio
data

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Jupyter Notebook
Estrelas
853
Forks
324
Merge médio
15h
PRs com merge (30d)
32

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de MIT-LCP/wfdb-python

Todas as issues de MIT-LCP/wfdb-python

Issues semelhantes

Mais issues de Data Engineering

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.