Commit 51060640 authored by Federico Julian Camerota Verdu's avatar Federico Julian Camerota Verdu
Browse files

Updated notebooks

parent b0e4d42e
......@@ -73,11 +73,11 @@
b = cu.array(b)
N = b.shape[0]
if a.shape[1:] != b.shape[1:]:
raise ValueError('a and b must have same shape')
a -= b
return cu.sqrt(cu.sum(cu.power(a, 2)) / N)
return cu.sqrt(cu.sum(cu.power(a, 2), axis=(1, 2)) / N)
```
%% Cell type:markdown id:d75ca8e1 tags:
### First load, then compute
......
......@@ -91,11 +91,11 @@
a = a.map_blocks(cu.array)
b = da.from_array(b)
b = b.map_blocks(cu.array)
N = b.shape[0]
a -= b
return da.sqrt(da.sum(da.power(a, 2)) / N)
return da.sqrt(da.sum(da.power(a, 2), axis=(1,2)) / N)
```
%% Cell type:markdown id:d75ca8e1 tags:
### First load, then compute
......
......@@ -85,11 +85,11 @@
b = da.from_array(b)
N = b.shape[0]
#if a.shape[1:] != b.shape[1:]:
# raise ValueError('a and b must have same shape')
return da.sqrt(da.sum((a - b) ** 2) / N)
return da.sqrt(da.sum((a - b) ** 2, axis=(1, 2)) / N)
```
%% Cell type:markdown id:d75ca8e1 tags:
### First load, then compute
......@@ -101,11 +101,11 @@
```
%% Cell type:code id:qualified-house tags:
``` python
%%timeit
%%time
trj.center_coordinates()
rmsd(trj.xyz, Ref.xyz).compute()
```
%% Cell type:markdown id:5147257b tags:
......@@ -113,11 +113,11 @@
### Iterate and compute
%% Cell type:code id:d5b26b6f tags:
``` python
%%timeit
%%time
for chunks in md.iterload(trajs, top=top):
chunks.center_coordinates()
rmsd(chunks.xyz, Ref.xyz).compute()
```
......
......@@ -101,14 +101,14 @@
%% Cell type:code id:9129076c tags:
``` python
%%timeit
model = PCA(n_clusters=2)
model = PCA(n_components=2)
model_trj = trj.xyz[:,:,:]
model_trj = model_trj.reshape(pca_trj.shape[0] , -1 )
proj = model.fit_transform(pca_trj)
model_trj = model_trj.reshape(model_trj.shape[0] , -1 )
proj = model.fit_transform(model_trj)
```
%% Cell type:markdown id:0475e0a8 tags:
%%time
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment