def get_grads_reps_pca2_tangent(experiment, nreps, nsel, cores, projector): experiments = {} dim = experiment.dim dimnoise = experiment.dimnoise for i in range(nreps): experiments[i] = copy.copy(experiment) experiments[i].M.selected_points = np.random.choice(list( range(experiment.n)), nsel, replace=False) tangent_bases = experiments[i].M.get_wlpca_tangent_sel( experiments[i].Mpca, experiments[i].M.selected_points, dimnoise) subM = RiemannianManifold( experiments[i].Mpca.data[experiments[i].M.selected_points], dim) subM.tb = TangentBundle(subM, tangent_bases) experiments[i].N.tangent_bundle = TangentBundle( experiments[i].N, experiments[i].N.geom.rmetric.embedding_eigenvectors) #experiments[i].df_M = experiments[i].get_dF_js_idM(experiments[i].Mpca, experiments[i].N, subM.tb, experiments[i].N.tangent_bundle, # experiments[i].M.selected_points,dimnoise) #experiments[i].df_M = experiments[i].df_M / np.linalg.norm(experiments[i].df_M, axis=1).sum(axis=0) #experiments[i].df_M2 = experiments[i].df_M / np.linalg.norm(experiments[i].df_M) ** 2 experiments[i].df_M = np.asarray( [np.identity(dim) for i in range(nsel)]) experiments[i].dg_x = experiments[i].get_dx_g_full( experiments[i].M.data[experiments[i].M.selected_points]) experiments[i].W = ShapeSpace(experiments[i].positions, experiments[i].M.data) experiments[i].dw = experiments[i].W.get_dw( cores, experiments[i].atoms3, experiments[i].natoms, experiments[i].M.selected_points) experiments[i].dg_w = experiments[i].project( np.swapaxes(experiments[i].dw, 1, 2), experiments[i].project(experiments[i].dw, experiments[i].dg_x)) experiments[i].dg_w_pca = np.asarray([ np.matmul(projector, experiments[i].dg_w[j].transpose()).transpose() for j in range(nsel) ]) experiments[i].dgw_norm = experiments[i].normalize( experiments[i].dg_w_pca) # tb_w_tangent_bases = experiment.project(experiment.dw_pca, np.swapaxes(subM.tb.tangent_bases,1,2)) # experiment.dgw_norm = experiment.normalize(experiment.dg_w) #experiment[i].dg_M = experiment.project(subM.tb.tangent_bases, experiment.dgw_norm) experiments[i].dg_M = experiments[i].project(subM.tb.tangent_bases, experiments[i].dgw_norm) #experiments[i].dw_pca = np.asarray([np.matmul(projector, experiments[i].dw[j]) for j in range(nsel)]) #experiments[i].dg_w = experiments[i].project(experiments[i].dw_pca, np.swapaxes(experiments[i].dg_x_pca,1,2)) #tb_w_tangent_bases = experiments[i].project(experiments[i].dw_pca, np.swapaxes(subM.tb.tangent_bases, 1, 2)) #experiments[i].dw_norm = experiments[i].normalize(experiments[i].dg_w) #experiments[i].dg_M = experiments[i].project(np.swapaxes(tb_w_tangent_bases, 1, 2), experiments[i].dw_norm) #experiments[i].coeffs = experiments[i].get_betas_spam2(experiments[i].xtrain, experiments[i].ytrain, experiments[i].groups, lambdas, # nsel, experiments[i].q, itermax, tol) return (experiments)
def load_data(self, angles=False): n = self.n #d = self.d dim = self.dim natoms = self.natoms atoms3 = self.atoms3 filename_xyz = workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-Me.Rusinska-Roszak-DB.DFT.PBE-TS.light.MD.500K.99k.R_E_F_D_Q.npz' #filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-Me_all2indices.npy' filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-Mindices.npy' #filename_angles = workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-Me_all2angles.npy' filename_angles = workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-Mangles.npy' data_xyz_loaded = np.load(filename_xyz) angle_indices = np.load(filename_angle_indices) n = len(angle_indices) self.n = n positions = data_xyz_loaded['R'][angle_indices] self.positions = positions dat = np.load(filename_angles) d = int(dat.shape[0] * dat.shape[1] / n) self.d = d data = np.reshape(dat, (n, d)) data = np.arccos(data) return (RiemannianManifold(data, dim))
def generate_data(self, n, theta): self.n = n d = self.d xvar = self.xvar dim = self.dim noise = self.noise self.theta = theta ts = 1.5 * np.pi * (1 + 2 * np.random.uniform(low=0.0, high=1.0, size=n)) x = ts * np.cos(ts) y = 21 * np.random.uniform(low=0.0, high=1.0, size=n) self.ys = y z = ts * np.sin(ts) self.ts = ts X = np.vstack((x, y, z)) #X += noise * generator.randn(3, n_samples) X = X.T unrotated_data = np.zeros((n, 49)) unrotated_data[:, :3] = X rotator = special_ortho_group.rvs(49) #rotator = np.identity(49) self.rotator = rotator data = np.matmul(unrotated_data, rotator) #data = rotator(X,theta) #data = dup_cols(data, indx=0, num_dups=46) #data = np.reshape(results, (n, (d))) return (RiemannianManifold(data, dim))
def load_data(self): # filename = 'tolueneangles.npz' atoms3 = self.atoms3 dim = self.dim # cor = self.cor # xvar = self.xvar filename_xyz = workingdirectory + '/untracked_data/chemistry_data/ethanol.mat' filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/ethanolindices022119.npy' data_xyz_loaded = scipy.io.loadmat(filename_xyz) # print(data_xyz_loaded['R'].shape) angle_indices = np.load(filename_angle_indices) self.timeindices = angle_indices positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = workingdirectory + '/untracked_data/chemistry_data/ethanolangles022119.npy' data = np.reshape(np.load(filename_angles), (50000, 3 * len(atoms3))) data = np.arccos(data) # print(positions[0]) # if angles == True: # p = Pool(cores) # results = p.map(lambda i: compute3angles(position = positions[i[0],atoms3[i[1]],:]),data_stream(10,84)) # data2 = np.reshape(results, (10,(d))) # else: # data = np.reshape(positions,(n,d)) return (RiemannianManifold(data, dim))
def load_data(self): # filename = 'tolueneangles.npz' dim = self.dim n = self.n atoms3 = self.atoms3 subset = self.subset # cor = self.cor # xvar = self.xvar filename_xyz = '/Users/samsonkoelle/Downloads/aspirin.mat' filename_angle_indices = '/Users/samsonkoelle/Downloads/aspirinindices020619.npy' data_xyz_loaded = scipy.io.loadmat(filename_xyz) # print(data_xyz_loaded['R'].shape) angle_indices = np.load(filename_angle_indices) positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = '/Users/samsonkoelle/Downloads/aspirinangles020619.npy' data = np.reshape(np.load(filename_angles), (50000, len(atoms3)*3)) data = np.arccos(data) data = data[subset] # print(positions[0]) # if angles == True: # p = Pool(cores) # results = p.map(lambda i: compute3angles(position = positions[i[0],atoms3[i[1]],:]),data_stream(10,84)) # data2 = np.reshape(results, (10,(d))) # else: # data = np.reshape(positions,(n,d)) return (RiemannianManifold(data, dim))
def get_grads_reps(experiment, nreps, nsel, cores): experiments = {} dim = experiment.dim for i in range(nreps): experiments[i] = copy.copy(experiment) experiments[i].M.selected_points = np.random.choice(list( range(experiment.n)), nsel, replace=False) tangent_bases = experiments[i].M.get_wlpca_tangent_sel( experiments[i].M, experiments[i].M.selected_points) subM = RiemannianManifold( experiments[i].M.data[experiments[i].M.selected_points], dim) subM.tb = TangentBundle(subM, tangent_bases) experiments[i].N.tangent_bundle = TangentBundle( experiments[i].N, experiments[i].N.geom.rmetric.embedding_eigenvectors) experiments[i].df_M = experiments[i].get_dF_js_idM( experiments[i].M, experiments[i].N, subM.tb, experiments[i].N.tangent_bundle, experiments[i].M.selected_points) #experiments[i].df_M = experiments[i].df_M / np.linalg.norm(experiments[i].df_M, axis=1).sum(axis=0) experiments[i].df_M2 = experiments[i].df_M / np.linalg.norm( experiments[i].df_M)**2 experiments[i].dg_x = experiments[i].get_dx_g_full( experiments[i].M.data[experiments[i].M.selected_points]) experiments[i].W = ShapeSpace(experiments[i].positions, experiments[i].M.data) experiments[i].dw = experiments[i].W.get_dw( cores, experiments[i].atoms3, experiments[i].natoms, experiments[i].M.selected_points) experiments[i].dg_w = experiments[i].project(experiments[i].dw, experiments[i].dg_x) tb_w_tangent_bases = experiments[i].project( experiments[i].dw, np.swapaxes(subM.tb.tangent_bases, 1, 2)) experiments[i].dw_norm = experiments[i].normalize(experiments[i].dg_w) experiments[i].dg_M = experiments[i].project( np.swapaxes(tb_w_tangent_bases, 1, 2), experiments[i].dw_norm) #experiments[i].coeffs = experiments[i].get_betas_spam2(experiments[i].xtrain, experiments[i].ytrain, experiments[i].groups, lambdas, # nsel, experiments[i].q, itermax, tol) return (experiments)
def load_data(self, angles=False): n = self.n d = self.d dim = self.dim natoms = self.natoms atoms3 = self.atoms3 filename_xyz = workingdirectory + '/untracked_data/chemistry_data/toluene.mat' filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/tolueneindices020619.npy' data_xyz_loaded = scipy.io.loadmat(filename_xyz) angle_indices = np.load(filename_angle_indices) positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = workingdirectory + '/untracked_data/chemistry_data/tolueneangles020619.npy' data = np.reshape(np.load(filename_angles), (50000, 50)) data = np.arccos(data) return (RiemannianManifold(data, dim))
def load_data(self, angles=False): n = self.n d = self.d dim = self.dim natoms = self.natoms atoms3 = self.atoms3 filename_xyz = workingdirectory + '/untracked_data/chemistry_data/p-xylene.DFT.PBE-TS.l1t.MD.500K.01.npz' filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/p-xyleneindices060319.npy' data_xyz_loaded = np.load(filename_xyz) angle_indices = np.load(filename_angle_indices) positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = workingdirectory + '/untracked_data/chemistry_data/p-xyleneangles060319.npy' data = np.reshape(np.load(filename_angles), (50000, 2448)) data = np.arccos(data) return (RiemannianManifold(data, dim))
def generate_data(self, n, theta): self.n = n d = self.d xvar = self.xvar dim = self.dim noise = self.noise self.theta = theta ts = 1.5 * np.pi * (1 + 2 * np.random.uniform(low=0.0, high=1.0, size=n)) x = ts * np.cos(ts) y = 21 * np.random.uniform(low=0.0, high=1.0, size=n) z = ts * np.sin(ts) self.ts = ts X = np.vstack((x, y, z)) #X += noise * generator.randn(3, n_samples) X = X.T data = rotator(X, theta) #data = np.reshape(results, (n, (d))) return (RiemannianManifold(data, dim))
def load_data(self): n = self.n d = self.d dim = self.dim natoms = self.natoms atoms3 = self.atoms3 angle_indices = self.angle_indices filename_xyz = xyz filename_angle_indices = angle_indices print(filename_xyz[-4:]) if filename_xyz[-4:] == '.mat': data_xyz_loaded = scipy.io.loadmat(filename_xyz) if filename_xyz[-4:] == '.npz': data_xyz_loaded = np.load(filename_xyz) print(filename_angle_indices) angle_indices = np.load(filename_angle_indices) positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = angles data = np.reshape(np.load(filename_angles), (n, 3 * len(atoms3))) data = np.arccos(data) return (RiemannianManifold(data, dim))
def load_data(self, angles=False): n = self.n #d = self.d dim = self.dim natoms = self.natoms atoms3 = self.atoms3 filename_xyz = workingdirectory + '/untracked_data/chemistry_data/BIPHENYLENEDIOL.fullerene.DFT.PBE-TS.light.MD.500K.102k.R_E_F_D_Q.npz' filename_angle_indices = workingdirectory + '/untracked_data/chemistry_data/BIPHENYLENEDIOLindices.npy' filename_angles = workingdirectory + '/untracked_data/chemistry_data/BIPHENYLENEDIOLangles.npy' data_xyz_loaded = np.load(filename_xyz) angle_indices = np.load(filename_angle_indices) n = len(angle_indices) self.n = n positions = data_xyz_loaded['R'][angle_indices] self.positions = positions dat = np.load(filename_angles) d = int(dat.shape[0] * dat.shape[1] / n) self.d = d data = np.reshape(dat, (n, d)) data = np.arccos(data) return (RiemannianManifold(data, dim))
cores = 16 #number of cores for parallel processing natoms = 26 ii = np.asarray(list(range(natoms)), dtype=int) jj = np.asarray(list(range(natoms)), dtype=int) #run experiment #atoms4 = np.asarray([[9,0,1,2],[0,1,2,3],[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,1],[5,6,1,0]],dtype = int) atoms4 = np.asarray([[14, 0, 1, 15], [14, 0, 3, 4], [15, 1, 9, 10], [9, 1, 15, 0], [3, 0, 14, 1], [0, 15, 14, 1]], dtype=int) experiment = BiphenylenediolAngles(dim, n, ii, jj, cores, atoms4) experiment.M = experiment.load_data( ) #if noise == False then noise parameters are overriden experiment.Mpca = RiemannianManifold( np.load( workingdirectory + '/untracked_data/chemistry_data/BIPHENYLENEDIOLanglespca_pca50.npy'), dim) projector = np.load( workingdirectory + '/untracked_data/chemistry_data/BIPHENYLENEDIOLanglespca_pca50_components.npy' ) folder = workingdirectory + '/Figures/biphenylenediol/' + now experiment.q = n_components experiment.dimnoise = dimnoise n = experiment.n experiment.Mpca.geom = experiment.Mpca.compute_geom(diffusion_time, n_neighbors) experiment.N = experiment.Mpca.get_embedding3(experiment.Mpca.geom, n_components, diffusion_time,
savename = 'ethanol_013120' savefolder = 'ethanol' loadfolder = 'ethanol' loadname = 'ethanol_013020' nreps = 5 if new_MN == True: experiment = EthanolAngles(dim, ii, jj, cores, atoms4) projector = np.load( workingdirectory + '/untracked_data/chemistry_data/ethanolangles022119_pca50_components.npy' ) experiment.M = experiment.load_data( ) # if noise == False then noise parameters are overriden experiment.Mpca = RiemannianManifold( np.load( workingdirectory + '/untracked_data/chemistry_data/ethanolangles022119_pca50.npy'), dim) experiment.q = n_components experiment.dimnoise = dimnoise n = experiment.n experiment.Mpca.geom = experiment.Mpca.compute_geom( diffusion_time, n_neighbors) experiment.N = experiment.Mpca.get_embedding3(experiment.Mpca.geom, n_components, diffusion_time, dim) with open( workingdirectory + '/untracked_data/embeddings/' + savefolder + '/' + savename + '.pkl', 'wb') as output: pickle.dump(experiment, output, pickle.HIGHEST_PROTOCOL)
loadfolder = 'emdahhme' loadname = 'emdahhme_013020' nreps = 5 if new_MN == True: experiment = EmdaHHMAngles(dim, n, ii, jj, cores, atoms4) projector = np.load( workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-M_anglespca_pca50_components.npy' ) experiment.M = experiment.load_data( ) # if noise == False then noise parameters are overriden experiment.Mpca = RiemannianManifold( np.load( workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-M_anglespca_pca50.npy'), dim) experiment.q = n_components experiment.dimnoise = dimnoise n = experiment.n experiment.Mpca.geom = experiment.Mpca.compute_geom( diffusion_time, n_neighbors) experiment.N = experiment.Mpca.get_embedding3(experiment.Mpca.geom, n_components, diffusion_time, dim) with open( workingdirectory + '/untracked_data/embeddings/' + savefolder + '/' + savename + '.pkl', 'wb') as output: pickle.dump(experiment, output, pickle.HIGHEST_PROTOCOL)
n_neighbors = 1000 #number of neighbors in megaman n_components = 5 #number of embedding dimensions (diffusion maps) diffusion_time = 5. #diffusion time controls gaussian kernel radius per gradients paper dim = 2 #slow manifold dimension dimnoise = 2 #noise dimension cores = 16 #number of cores for parallel processing natoms = 9 ii = np.asarray(list(range(natoms)), dtype = int) jj = np.asarray(list(range(natoms)), dtype = int) #run experiment #atoms4 = np.asarray([[9,0,1,2],[0,1,2,3],[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,1],[5,6,1,0]],dtype = int) atoms4 = np.asarray([[5,3,1,0],[3,1,0,6],[4,2,0,1],[8,2,0,6],[7,1,0,6]],dtype = int) experiment = EmdaHHHAngles(dim, n, ii, jj,cores,atoms4) experiment.M = experiment.load_data() #if noise == False then noise parameters are overriden experiment.Mpca = RiemannianManifold(pca_dat, dim) projector = np.load(workingdirectory + '/untracked_data/chemistry_data/eMDA-H-H-H_all2anglespca_pca50_components.npy') folder = workingdirectory + '/Figures/emdahhh/' + now experiment.q = n_components experiment.dimnoise = dimnoise n = experiment.n experiment.Mpca.geom = experiment.Mpca.compute_geom(diffusion_time, n_neighbors) experiment.N = experiment.Mpca.get_embedding3(experiment.Mpca.geom, n_components, diffusion_time, dim) #experiment.g0 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[0]) #experiment.g1 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[1]) #experiment.g2 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[2]) #experiment.g3 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[3]) #experiment.g4 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[4]) experiment.gs = experiment.get_g_full(experiment.M.data) experiment.g0 = experiment.gs[:,0]
data_xyz_loaded = scipy.io.loadmat(filename_xyz) if filename_xyz[-4:] == '.npz': data_xyz_loaded = np.load(filename_xyz) print(filename_angle_indices) angle_indices = np.load(filename_angle_indices) positions = data_xyz_loaded['R'][angle_indices] self.positions = positions filename_angles = angles data = np.reshape(np.load(filename_angles), (n, 3 * len(atoms3))) data = np.arccos(data) return (RiemannianManifold(data, dim)) lambdas = np.asarray(np.hstack([np.asarray([0]),np.logspace(lambdamin,lambdamax,nlambdas)]), dtype = np.float16) experiment = AtomicRegressionLoader( angles,angle_indices, xyz,dim, dimnoise,itermax,tol,lambdas,n_neighbors, n_components, atoms4, ncores, diffusion_time) experiment.M = experiment.load_data() #if noise == False then noise parameters are overriden experiment.Mpca = RiemannianManifold(np.load(projected), dim) experiment.q = n_components experiment.dimnoise = dimnoise projector = np.load(pca_projector) print(n_neighbors, type(n_neighbors), 'nebstuff') experiment.Mpca.geom = experiment.Mpca.compute_geom(diffusion_time, n_neighbors) experiment.N = experiment.Mpca.get_embedding3(experiment.Mpca.geom, n_components, diffusion_time, dim) #experiment.g0 = experiment.get_g_full_sub(experiment.M.data,experiment.atoms4[0]) folder = output_folder + now os.mkdir(folder) axislist = list(combinations_with_replacement(list(range(n_components)), 3)) for i in range(len(axislist)): experiment.N.plot(axislist[i], list(range(n)),np.ones(n),.1,.1, folder + '/' + str(axislist[i])) #print('pregrad',datetime.datetime.now().strftime("%B_%d_%Y_%H_%M_%S")) #experiments = get_grads_reps_pca2(experiment, nreps, nsel,cores,projector) #print('precoeff',datetime.datetime.now().strftime("%B_%d_%Y_%H_%M_%S"))
def generate_data(self, noise=False): n = self.n d = self.d cor = self.cor xvar = self.xvar natoms = self.natoms cores = self.cores atoms3 = self.atoms3 dim = self.dim noise = self.noise positions = np.zeros((n, 9, 3)) # positions[0,0,:] = np.asarray([0.,0.,0.]) # positions[0,1,:] = np.asarray([-10.,0.,0.]) # positions[0,2,:] = np.asarray([1.,10.,0.]) # #positions[0,8,:] = np.asarray([1.,1.,0.]) # positions[0,8,:] = np.asarray([2.,10.,-0]) # positions[0,3,:] = np.asarray([1., np.cos(2/3 * np.pi), np.sin(2/3 * np.pi)]) # positions[0,4,:] = np.asarray([1., np.cos(2/3 * np.pi), np.sin(4/3 * np.pi)]) # positions[0,5,:] = np.asarray([-12.,1.,0.]) # positions[0,6,:] = np.asarray([-12., np.cos(2/3 * np.pi),np.sin(2/3 * np.pi)]) # positions[0,7,:] = np.asarray([-12.,np.cos(2/3 * np.pi), np.sin(4/3 * np.pi)]) positions[0, 0, :] = np.asarray([0., 0., 0.]) positions[0, 1, :] = np.asarray([-10., 0., np.sqrt(2) / 100]) positions[0, 2, :] = np.asarray([0., 10., np.sqrt(3) / 100]) #positions[0,8,:] = np.asarray([1.,1.,0.]) positions[0, 8, :] = np.asarray([1., 10., np.sqrt(5) / 100]) positions[0, 3, :] = np.asarray( [np.sqrt(7) / 100, np.cos(2 / 3 * np.pi), np.sin(2 / 3 * np.pi)]) positions[0, 4, :] = np.asarray( [np.sqrt(11) / 100, np.cos(2 / 3 * np.pi), np.sin(4 / 3 * np.pi)]) positions[0, 5, :] = np.asarray([-11., 1., np.sqrt(13) / 100]) positions[0, 6, :] = np.asarray( [-11., np.cos(2 / 3 * np.pi), np.sin(2 / 3 * np.pi)]) positions[0, 7, :] = np.asarray( [-11., np.cos(2 / 3 * np.pi), np.sin(4 / 3 * np.pi)]) angles1 = np.tile( np.linspace(start=0., stop=2 * math.pi, num=int(np.sqrt(n)), endpoint=False), int(np.sqrt(n))) angles2 = np.repeat( np.linspace(start=0., stop=2 * math.pi, num=int(np.sqrt(n)), endpoint=False), int(np.sqrt(n))) for i in range(1, n): rotationmatrix1 = np.zeros((3, 3)) rotationmatrix1[1, 1] = 1 rotationmatrix1[0, 0] = np.cos(angles1[i]) rotationmatrix1[0, 2] = -np.sin(angles1[i]) rotationmatrix1[2, 2] = np.cos(angles1[i]) rotationmatrix1[2, 0] = np.sin(angles1[i]) rotationmatrix2 = np.zeros((3, 3)) rotationmatrix2[0, 0] = 1 rotationmatrix2[1, 1] = np.cos(angles2[i]) rotationmatrix2[1, 2] = -np.sin(angles2[i]) rotationmatrix2[2, 2] = np.cos(angles2[i]) rotationmatrix2[2, 1] = np.sin(angles2[i]) positions[i, np.asarray([3, 4]), :] = positions[0, np.asarray([3, 4]), :] positions[i, np.asarray([2, 8]), :] = np.matmul( rotationmatrix1, positions[0, np.asarray([2, 8]), :].transpose()).transpose() positions[i, np.asarray([1, 5, 6, 7]), :] = np.matmul( rotationmatrix2, positions[ 0, np.asarray([1, 5, 6, 7]), :].transpose()).transpose() covariance = np.identity(natoms) for i in range(natoms): for j in range(natoms): if i != j: covariance[i, j] = cor covariance = xvar * covariance if noise == True: for i in range(n): for j in range(3): positions[i, :, j] = np.random.multivariate_normal( positions[i, :, j], covariance, size=1) self.positions = positions p = Pool(cores) results = p.map( lambda i: compute3angles(position=positions[i[0], atoms3[i[1]], :] ), data_stream(10000, 84)) data = np.reshape(results, (n, (d))) svd = TruncatedSVD(n_components=50) svd.fit(data) data_pca = svd.transform(data) return (RiemannianManifold(data, dim), RiemannianManifold(data_pca, dim), svd.components_)