Example #1
0
import numpy as np
import data_creation as dc
import parameters as prm
import os

# for running the code using a job array on cluster
# parvalue is between 1 and 8
parvalue = int(os.environ['SGE_TASK_ID']) - 1

noise_mapping = (0.5, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001)
sim_param = prm.system(alpha=1.,
                       beta=1.,
                       gamma=-1.,
                       gvec=np.full(prm.dim, noise_mapping[parvalue]))

# create paths
numpaths = 10
ic = np.random.uniform(low=-0.6, high=3.0, size=(numpaths, prm.dim))
it = np.zeros((numpaths))
euler_param = prm.euler_maruyama(numsteps=100000,
                                 savesteps=1000,
                                 ft=10.,
                                 ic=ic,
                                 it=it,
                                 numpaths=numpaths)
xout, tout, xout_without_noise = dc.createpaths(euler_param, sim_param)

# save to file
import pickle
with open('./data/noise_' + str(parvalue) + '.pkl', 'wb') as f:
    pickle.dump([xout, tout, xout_without_noise, euler_param, sim_param], f)
Example #2
0
import numpy as np
import data_creation as dc
import parameters as prm
import os

# for running the code using a job array on cluster
# parvalue is between 1 and 8
parvalue = int(os.environ['SGE_TASK_ID']) - 1

noise_mapping = (0.5, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001)
sim_param = prm.system(sigma=10.0,
                       rho=28.0,
                       beta=(8.0 / 3.0),
                       gvec=np.full(prm.dim, noise_mapping[parvalue]))

# create paths
numpaths = 10
ic = np.random.uniform(low=-1.0, high=1.0, size=(numpaths, prm.dim))
it = np.zeros((numpaths))
euler_param = prm.euler_maruyama(numsteps=100000,
                                 savesteps=1000,
                                 ft=50.,
                                 ic=ic,
                                 it=it,
                                 numpaths=numpaths)
xout, tout, xout_without_noise = dc.createpaths(euler_param, sim_param)

# save to file
import pickle
with open('./data/noise_' + str(parvalue) + '.pkl', 'wb') as f:
    pickle.dump([xout, tout, xout_without_noise, euler_param, sim_param], f)
Example #3
0
import numpy as np
import data_creation as dc
import parameters as prm
import os

# for running the code using a job array on cluster
# parvalue is between 1 and 8
parvalue = int(os.environ['SGE_TASK_ID']) - 1

noise_mapping = (0.5, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001)
sim_param = prm.system(kvec=np.array([1.0, 0.7, 0.6, 1.2, 0.9]),
                       mvec=np.array([0.2, 0.3, 0.5, 1.1]),
                       gvec=np.full(prm.dim, noise_mapping[parvalue]))

# create paths
numpaths = 10
ic = np.random.uniform(low=-1.0, high=1.0, size=(numpaths, prm.dim))
it = np.zeros((numpaths))
euler_param = prm.euler_maruyama(numsteps=100000,
                                 savesteps=1000,
                                 ft=10.,
                                 ic=ic,
                                 it=it,
                                 numpaths=numpaths)
xout, tout, xout_without_noise = dc.createpaths(euler_param, sim_param)

# save to file
import pickle
with open('./data/noise_' + str(parvalue) + '.pkl', 'wb') as f:
    pickle.dump([xout, tout, xout_without_noise, euler_param, sim_param], f)
Example #4
0
import numpy as np
import data_creation as dc
import parameters as prm
import os

# for running the code using a job array on cluster
# parvalue is between 1 and 8
parvalue = int(os.environ['SGE_TASK_ID']) - 1

noise_mapping = (0.5, 0.1, 0.05, 0.01, 0.005, 0.001, 0.0005, 0.0001)
sim_param = prm.system(alpha=1.,
                       beta=-1.,
                       gamma=0.5,
                       delta=-0.3,
                       omega=1.2,
                       gvec=np.full(prm.dim, noise_mapping[parvalue]))

# create paths
numpaths = 10
ic = np.random.uniform(low=-2.0, high=2.0, size=(numpaths, prm.dim))
it = np.zeros((numpaths))
euler_param = prm.euler_maruyama(numsteps=100000,
                                 savesteps=1000,
                                 ft=10.,
                                 ic=ic,
                                 it=it,
                                 numpaths=numpaths)
xout, tout, xout_without_noise = dc.createpaths(euler_param, sim_param)

# save to file
import pickle
Example #5
0
import numpy as np
import data_creation as dc
import parameters as prm
"""
Sample equation is the 2N coupled masses with spring
with weights w1, ..., wN and spring constants k0, ..., kN:
m_(2n) x''_(2n) = -k_(2n) (x_(2n) - x_(2n-1)) - k_(2n+1) (x_2n - x_(2n+1))
[Reference: http://www.people.fas.harvard.edu/~djmorin/waves/normalmodes.pdf]

Converting this second order system of equations to a first order system of equations:
dx_n = x_(n+1)

Standard parameter values:
"""
sim_param = prm.system()

# create paths
"""
The default parameters for Euler-Maruyama are:
euler_param = prm.euler_maruyama(numsteps = 25000, savesteps = 100, ft = 10., ic, it, numpaths)
"""
#ic = np.array([[1., 0., 3.2, 0.], [0.5, 0., 0.2, 0.], [-1.2, 0., 0.34, 0.], [0.98, 0., -1.34, 0.], [0.5, 0., -1.5, 0.], [0.1, 0., 0.9, 0.]])
ic = np.random.random((6, 10))
it = np.zeros((ic.shape[0]))
euler_param = prm.euler_maruyama(ic, it)
xout, tout, xout_without_noise = dc.createpaths(euler_param, sim_param)

# save to file
import pickle
with open('nem_6D.pkl', 'wb') as f:
    pickle.dump([xout, tout, xout_without_noise, euler_param, sim_param], f)