Skip to content
Snippets Groups Projects
Commit 6a1ec0f5 authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

add test with jupyter notebook

parent 988e7a13
Branches
Tags
No related merge requests found
%% Cell type:code id: tags:
``` python
%matplotlib inline
```
%% Cell type:code id: tags:
``` python
import asapo_worker
import h5py
import numpy as np
import matplotlib.pyplot as plt
import tempfile
import cbf
import time
from IPython import display
broker, err = asapo_worker.create_server_broker("psana002:8400", "/tmp", "asapo_test2","yzgAcLmijSLWIm8dBiGNCbc0i42u5HSm-zR6FRqo__Y=", 1000000)
```
%% Cell type:code id: tags:
``` python
last_id = 0
try:
while True:
data, meta, err = broker.get_last(meta_only=False)
id = meta['_id']
if id == last_id:
time.sleep(1)
continue
tmpfile = tempfile.NamedTemporaryFile()
tmpfile.write(data)
content = cbf.read(tmpfile.name)
numpy_array_with_data = content.data
header_metadata = content.metadata
plt.imshow(numpy_array_with_data, cmap='gnuplot', vmax=500)
# display.display(plt.gcf())
display.clear_output(wait=True)
plt.show()
print (meta)
last_id = id
except KeyboardInterrupt:
pass
```
%% Output
{'_id': 198, 'size': 6247362, 'name': 'data/file_lin/test_dir/sample_1_00001.cbf'}
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
ssh -l root asap3-tst01 scp max-wgs:/beegfs/desy/group/it/ReferenceData/MX/Pilatus/sample_1_0000$1.cbf /run/user/data/file_lin/test_dir/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment