simulate
Simulation Related
- pynumdiff.utils.simulate.linear_autonomous(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001)
Create toy example of time series from an autonomous linear system
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
- Returns
a tuple consisting of:
a noisy time series from an autonomous linear system;
a noise-free time series from an autonomous linear system (truth);
a true derivative information of the time series;
None: dummy output
- Return type
tuple -> (np.array, np.array, np.array, None)
- pynumdiff.utils.simulate.lorenz_x(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001)
Create toy example of x component from a lorenz attractor
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
- Returns
a tuple consisting of:
a noisy time series of x component from Lorenz system;
a noise-free time series of x component from Lorenz system (truth);
a true derivative information of the time series;
None: dummy output
- Return type
tuple -> (np.array, np.array, np.array, list (np.array))
- pynumdiff.utils.simulate.lorenz_xyz(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001, x0=(5, 1, 3), normalize=True)
Simulation of Lorenz system with Eular method
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
x0 (tuple, optional) – a tuple of initial state of the Lorenz system
normalize (boolean, optional) – whether to roughly normalize the time series
- Returns
a tuple consisting of:
noisy_measurements: noisy time series from Lorenz system;
actual_vals: noise-free time series from Lorenz system;
None: dummy output
- Return type
tuple -> (np.array, np.array, None)
- pynumdiff.utils.simulate.pi_control(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01)
Create a toy example of linear proportional integral controller with nonlinear control inputs
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
- Returns
a tuple consisting of:
- a noisy time series of linear proportional integral controller with
nonlinear control inputs;
- a noise-free time series of linear proportional integral controller with
nonlinear control inputs (truth);
a true derivative information of the time series;
a list of extra measurements and controls
- Return type
tuple -> (np.array, np.array, np.array, list (np.array))
- pynumdiff.utils.simulate.pop_dyn(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001)
Create toy example of bounded exponential growth: http://www.biologydiscussion.com/population/population-growth/population-growth-curves-ecology/51854
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
- Returns
a tuple consisting of:
a noisy time series consisted of bounded exponential growth;
a noise-free time series consisted of bounded exponential growth (truth);
a true derivative information of the time series;
None: dummy output
- Return type
tuple -> (np.array, np.array, np.array, None)
- pynumdiff.utils.simulate.rk4_lorenz_xyz(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, normalize=True)
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
normalize (boolean, optional) – whether to roughly normalize the time series
- Returns
a tuple consisting of:
noisy_measurements: noisy time series from Lorenz system;
actual_vals: noise-free time series from Lorenz system;
None: dummy output
- Return type
tuple -> (np.array, np.array, None)
- pynumdiff.utils.simulate.sine(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001, frequencies=(1, 1.7), magnitude=1)
Create toy example of time series consisted of sinusoidal modes
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
frequencies (list (float), optional) – a list of float numbers representing frequencies for each sinusoidal modes
magnitude (float, optional) – magnitude/frequencies[i] is the true magnitude of the ith sinusoidal mode
- Returns
a tuple consisting of:
a noisy time series consisted of several sinusoidal modes;
a noise-free time series consisted of several sinusoidal modes (truth);
a true derivative information of the time series;
None: dummy output
- Return type
tuple -> (np.array, np.array, np.array, None)
- pynumdiff.utils.simulate.triangle(timeseries_length=4, noise_type='normal', noise_parameters=(0, 0.5), random_seed=1, dt=0.01, simdt=0.0001)
Create toy example of sharp-edged triangle wave with increasing frequencies
- Parameters
timeseries_length (float, optional) – a float number representing the period of the time series, not to be confused with number of data points
noise_type (string, optional) – a string representing type of noise, should be compatible with np.random functions (eg. ‘normal’, ‘uniform’, ‘poisson’)
noise_parameters (list, optional) – a list of parameters of the noise used in np.random
random_seed (int, optional) – an integer seed used to initialize the random number generator
dt (float, optional) – a float number representing the time step size
simdt (float, optional) – a float number representing the the real simulation step size we use to generate the time series, typically smaller than dt to achieve high precision
- Returns
a tuple consisting of:
a noisy time series consisted of sharp-edged triangles;
a noise-free time series consisted of sharp-edged triangles (truth);
a true derivative information of the time series;
None: dummy output
- Return type
tuple -> (np.array, np.array, np.array, None)