Commit b2321879 authored by Thomas Kluyver's avatar Thomas Kluyver
Browse files

Add example notebook

parent 0d270641
/build/
*.c
.ipynb_checkpoints/
%% Cell type:code id: tags:
``` python
import h5py
from pycrystfel.bindings import inspect_geom_file, find_peaks_single_panel, Detector
```
%% Cell type:code id: tags:
``` python
inspect_geom_file('../agipd_simple_2d.geom')
```
%%%% Output: stream
n_panels: 128
panel names: [b'p0a0', b'p0a1', b'p0a2', b'p0a3', b'p0a4', b'p0a5', b'p0a6', b'p0a7', b'p1a0', b'p1a1', b'p1a2', b'p1a3', b'p1a4', b'p1a5', b'p1a6', b'p1a7', b'p2a0', b'p2a1', b'p2a2', b'p2a3', b'p2a4', b'p2a5', b'p2a6', b'p2a7', b'p3a0', b'p3a1', b'p3a2', b'p3a3', b'p3a4', b'p3a5', b'p3a6', b'p3a7', b'p4a0', b'p4a1', b'p4a2', b'p4a3', b'p4a4', b'p4a5', b'p4a6', b'p4a7', b'p5a0', b'p5a1', b'p5a2', b'p5a3', b'p5a4', b'p5a5', b'p5a6', b'p5a7', b'p6a0', b'p6a1', b'p6a2', b'p6a3', b'p6a4', b'p6a5', b'p6a6', b'p6a7', b'p7a0', b'p7a1', b'p7a2', b'p7a3', b'p7a4', b'p7a5', b'p7a6', b'p7a7', b'p8a0', b'p8a1', b'p8a2', b'p8a3', b'p8a4', b'p8a5', b'p8a6', b'p8a7', b'p9a0', b'p9a1', b'p9a2', b'p9a3', b'p9a4', b'p9a5', b'p9a6', b'p9a7', b'p10a0', b'p10a1', b'p10a2', b'p10a3', b'p10a4', b'p10a5', b'p10a6', b'p10a7', b'p11a0', b'p11a1', b'p11a2', b'p11a3', b'p11a4', b'p11a5', b'p11a6', b'p11a7', b'p12a0', b'p12a1', b'p12a2', b'p12a3', b'p12a4', b'p12a5', b'p12a6', b'p12a7', b'p13a0', b'p13a1', b'p13a2', b'p13a3', b'p13a4', b'p13a5', b'p13a6', b'p13a7', b'p14a0', b'p14a1', b'p14a2', b'p14a3', b'p14a4', b'p14a5', b'p14a6', b'p14a7', b'p15a0', b'p15a1', b'p15a2', b'p15a3', b'p15a4', b'p15a5', b'p15a6', b'p15a7']
photon energy: 4972.0
%% Cell type:code id: tags:
``` python
with h5py.File('../monolithic_img_1.h5', 'r') as f:
arr = f['data/data'][()]
print("Image shape:", arr.shape)
```
%%%% Output: stream
Image shape: (1000, 1000)
%% Cell type:code id: tags:
``` python
peaks_tbl = find_peaks_single_panel(arr, '../1panel.geom')
peaks_tbl
```
%%%% Output: stream
Loaded geometry with 1 panels
%%%% Output: execute_result
ss fs rx ry rz \
0 3.500000 524.250000 2.505115e-318 2.340294e-310 2.340294e-310
1 4.500000 328.000000 2.352760e-318 0.000000e+00 0.000000e+00
2 18.250000 577.750000 0.000000e+00 0.000000e+00 0.000000e+00
3 22.928572 362.928558 0.000000e+00 0.000000e+00 0.000000e+00
4 30.500000 651.750000 0.000000e+00 0.000000e+00 0.000000e+00
.. ... ... ... ... ...
120 955.200012 317.399994 0.000000e+00 0.000000e+00 0.000000e+00
121 960.166687 793.166687 0.000000e+00 0.000000e+00 0.000000e+00
122 961.166687 372.500000 0.000000e+00 0.000000e+00 0.000000e+00
123 994.500000 518.833313 0.000000e+00 0.000000e+00 0.000000e+00
124 996.500000 521.000000 0.000000e+00 0.000000e+00 0.000000e+00
intensity
0 18701.500000
1 19184.888672
2 19427.628906
3 33865.886719
4 19319.771484
.. ...
120 48995.921875
121 14225.445312
122 13649.546875
123 14537.181641
124 9605.000000
[125 rows x 6 columns]
%% Cell type:code id: tags:
``` python
det = Detector.from_filename('../agipd_simple_2d.geom')
```
%% Cell type:code id: tags:
``` python
det.n_panels
```
%%%% Output: execute_result
128
%% Cell type:code id: tags:
``` python
det.panel_names()[:10]
```
%%%% Output: execute_result
['p0a0',
'p0a1',
'p0a2',
'p0a3',
'p0a4',
'p0a5',
'p0a6',
'p0a7',
'p1a0',
'p1a1']
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