import pyActigraphy from pytest import approx sampling_period = 60 frequency = pd.Timedelta(sampling_period, unit='s') start_time = '01/01/2018 08:00:00' N = 20160 period = pd.Timedelta(N * sampling_period, unit='s') gaussian_noise = generate_series(generate_gaussian_noise(N=N), start=start_time, sampling_period=sampling_period) square_wave = generate_series(generate_squarewave(N=N), start=start_time, sampling_period=sampling_period) sine_wave = generate_series(generate_sinewave(N=N), start=start_time, sampling_period=sampling_period) raw_gaussian = pyActigraphy.io.BaseRaw(name='raw_gaussian', uuid='XXXXXXXX', format='CUSTOM', axial_mode=None, start_time=pd.to_datetime(start_time), period=period, frequency=frequency, data=gaussian_noise, light=None) raw_squarewave = pyActigraphy.io.BaseRaw(name='raw_square', uuid='XXXXXXXX', format='CUSTOM',
sampling_period = 60 frequency = pd.Timedelta(sampling_period, unit='s') start_time = '01/01/2000 08:00:00' N = 10080 period = pd.Timedelta(N * sampling_period, unit='s') # Set seed for reproducibility np.random.seed(0) sine_wave = generate_series( generate_sinewave( N=N, # number of samples T=1440 * 60, # period in sec: 24*60*60 Ts=60, # sampling rate (sec.) A=100, # oscillation amplitude add_noise=True, # add gaussian noise noise_power=100, offset=True # offset oscillations between 0 and +2A ), start=start_time, sampling_period=sampling_period) raw_sinewave = pyActigraphy.io.BaseRaw(name='raw_sinewave', uuid='XXXXXXXX', format='CUSTOM', axial_mode=None, start_time=pd.to_datetime(start_time), period=period, frequency=frequency, data=sine_wave,
# from generate_dataset import generate_gaussian_noise from generate_dataset import generate_series # from generate_dataset import generate_squarewave from generate_dataset import generate_sinewave import pandas as pd import pyActigraphy from pytest import approx sampling_period = 60 frequency = pd.Timedelta(sampling_period, unit='s') start_time = '01/01/2018 08:00:00' N = 20160 period = pd.Timedelta(N * sampling_period, unit='s') sine_wave_mask = generate_series(generate_sinewave(N=N, offset=True), start=start_time, sampling_period=sampling_period) sine_wave_mask.loc['2018-01-03 06:00:00':'2018-01-03 14:00:00'] = 0 raw_sinewave_mask = pyActigraphy.io.BaseRaw( name='raw_sinewave', uuid='XXXXXXXX', format='CUSTOM', axial_mode=None, start_time=pd.to_datetime(start_time), period=period, frequency=frequency, data=sine_wave_mask, light=None)
from generate_dataset import generate_series from generate_dataset import generate_sinewave import pandas as pd import pyActigraphy from pytest import approx sampling_period = 60 frequency = pd.Timedelta(sampling_period, unit='s') start_time = '01/01/2018 08:00:00' N = 20800 * sampling_period period = pd.Timedelta(N, unit='s') sine_wave = generate_series(generate_sinewave(A=100, offset=True, N=N - 1), start=start_time, sampling_period=sampling_period) raw_sinewave = pyActigraphy.io.BaseRaw(name='raw_sinewave', uuid='XXXXXXXX', format='CUSTOM', axial_mode=None, start_time=pd.to_datetime(start_time), period=period, frequency=frequency, data=sine_wave, light=None) def test_sri_sinewave(): assert raw_sinewave.SleepRegularityIndex(freq='5min',