Commit d773e20c authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[docs] Adds BSS and CM to notebook tutorial

parent 7cc41464
%% Cell type:code id: tags:
``` python
import silx
comp1 = "/users/garrigaf/Documents/tests/Nexus/heat1/layer0"
comp2 = "/users/garrigaf/Documents/tests/Nexus/heat1/layer1"
from darfix.io.utils import read_components
d1, c1, W1 = read_components(comp1)
d2, c2, W2 = read_components(comp2)
```
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
Z = kmeans.predict(W.T).reshape((2, len(c1)))
```
%% Cell type:code id: tags:
``` python
Z
```
%% Output
array([[12, 4, 8, 14, 28, 17, 7, 11, 10, 26, 19, 6, 23, 1, 0, 21,
13, 15, 20, 2, 4, 20, 18, 24, 3, 27, 16, 9, 22, 5],
[20, 13, 6, 18, 25, 7, 9, 11, 29, 15, 4, 19, 27, 21, 20, 14,
8, 0, 10, 17, 5, 1, 3, 24, 23, 16, 16, 22, 2, 22]],
dtype=int32)
%% Cell type:code id: tags:
``` python
from matplotlib import pyplot as plt
keys = list(d1.keys())
plt.scatter(d1[keys[0]], d1[keys[1]], c=W1.T[1], cmap="jet")
```
%% Output
<matplotlib.collections.PathCollection at 0x7fd3d29f8128>
%% Cell type:code id: tags:
``` python
plt.scatter(d2[keys[0]], d2[keys[1]], c=W2.T[10], cmap="jet")
```
%% Output
<matplotlib.collections.PathCollection at 0x7fd3d2833dd8>
This source diff could not be displayed because it is too large. You can view the blob instead.
Supports Markdown
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