MPBA / pyphysio

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

wrong representation of instants in an UnevenlySignal #24

Closed andbiz closed 7 years ago

andbiz commented 7 years ago
import numpy as np
import pyphysio as ph

FSAMP = 100
n = np.arange(1000)
t = n / FSAMP
freq = 1
#create reference signal
sinusoid = ph.EvenlySignal(np.sin(2 * np.pi * freq * t), sampling_freq = FSAMP, signal_nature = '', start_time = 0)

# remove some samples
sinusoid_unevenly = ph.UnevenlySignal(np.delete(sinusoid.get_values(), [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),
                                      sampling_freq = FSAMP, signal_nature = '', start_time = 0,
                                      x_values = np.delete(sinusoid.get_times(), [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]),
                                      x_type='instants')

np.sum(sinusoid_unevenly.get_times() - np.delete(sinusoid.get_times(), [10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])) # NOT EQUAL TO ZERO