Closed andbiz closed 7 years ago
# create a signal ## create fake data signal_values = np.arange(100) ## create fake indices idx = np.arange(100) idx[-1] = 125 ## set the sampling frequency fsamp = 10 # Hz ## set the starting time tstart = 0 # s ## create an Unevenly signal defining the indices x_values_idx = idx s_fake_idx = UnevenlySignal(values = signal_values, sampling_freq = fsamp, signal_nature = 'fake', start_time = tstart, x_values = x_values_idx, x_type = 'indices') ## create an Unevenly signal defining the indices x_values_time = idx/fsamp + 1 s_fake_time = UnevenlySignal(values = signal_values, sampling_freq = fsamp, signal_nature = 'fake',# start_time = tstart, x_values = x_values_time, x_type = 'instants') # segmentation of US s_fake_idx_segment = s_fake_idx.segment_time(4.5, 5) s_fake_time_segment = s_fake_time.segment_time(4.5, 5) # plot ax1 = plt.subplot(211) s_fake_idx.plot('.-') s_fake_idx_segment.plot('.-r') plt.subplot(212, sharex=ax1) s_fake_time.plot('.-') s_fake_time_segment.plot('.-r')
Memo: in UnevenlySignal segmentation increased start_time but not decreased x_values Today: signal has not to be defined between start_time and the first sample