Correct sampto behaviour using rdsamp and rdann?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện Python được cung cấp với wfdb.rdsamp và wfdb.rdann, sử dụng cùng giá trị sampto và mẫu tại chỉ mục 100. Theo dõi cách mỗi điểm vào xử lý cận trên; được xem là hoàn tất khi ngữ nghĩa phạm vi của chúng nhất quán và việc lập chỉ mục các chú thích được trả về không gây ra IndexError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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, :]}')
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 853
- Fork
- 322
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MIT-LCP/wfdb-python
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
MIT-LCP/wfdb-python#568 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
MIT-LCP/wfdb-python#557 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
MIT-LCP/wfdb-python#554 ·
-
WFDB path ignored Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MIT-LCP/wfdb-python#545 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
MIT-LCP/wfdb-python#540 ·
Tất cả issue của MIT-LCP/wfdb-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
speaches-ai/speaches#678 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Đang mởbug ecr
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
conda-forge/spacy-feedstock#177 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100