MPBA / pyphysio

GNU General Public License v3.0
47 stars 13 forks source link

ph.LabelSegments() different behaviour Evenly/Unevenly #47

Closed andbiz closed 7 years ago

andbiz commented 7 years ago

Unexpected behaviour when using LabelSegments. See code below:

from __future__ import division
import numpy as np
import pandas as pd
import os

import pyphysio as ph
import matplotlib.pyplot as plt

#%%
ecg = ph.EvenlySignal(ph.TestData.ecg(), 2048)

ibi = ph.BeatFromECG()(ecg)

labels = np.zeros(len(ecg))

labels[61440:122880] = 1
labels[184320:] = 2

labels = ph.EvenlySignal(labels, 2048)

#%%
windows = ph.LabelSegments(labels=labels)

indicators_td, col_names_td = ph.fmap(windows, ph.preset_hrv_td(prefix=''), ibi)
indicators_fd, col_names_fd = ph.fmap(windows, ph.preset_hrv_fd(prefix=''), ibi.to_evenly().resample(4))

print(indicators_td[:,2])
print(indicators_fd[:,2])
andbiz commented 7 years ago

It works with drop_cut = False. Closed