Commit f54423eb authored by payno's avatar payno
Browse files

[doc] fix tutorials. Now EDFTomoScan.projections only return the none...

[doc] fix tutorials. Now EDFTomoScan.projections only return the none alignment projections. And there is  only 20 projections of those
parent d0563409
......@@ -166,7 +166,7 @@
],
"source": [
"from silx.io.utils import get_data\n",
"frame_28_data = get_data(scan.projections[28])\n",
"frame_18_data = get_data(scan.projections[18])\n",
"# imshow(frame_28_data)"
]
},
......
%% Cell type:markdown id: tags:
# Read data from an EDF acquisition
To create a 'Scan' object from EDF you have to use the :class:`EDFTomoScan` class and provide the path to the acquisition
WARNING: Browsing EDF files is based on several convention at ESRF.
The most important one is that the acquisition 'identification' - which is the folder name is repeated in the file names.
For example if we have an acquisition names 'acq_0005' we expect edf file prefix to be 'acq_0005' too.
WARNING: The :class:`EDFTomoScan` has been tested on EDF single frame files. It wouldn't be surprising if it fails on EDF multiple frames files.
%% Cell type:code id: tags:
``` python
# %pylab # to use imshow uncomment
```
%%%% Output: stream
Using matplotlib backend: Qt5Agg
Populating the interactive namespace from numpy and matplotlib
%% Cell type:markdown id: tags:
## Get a simple dataset for test (this dataset is a pure noise)
%% Cell type:code id: tags:
``` python
from tomoscan.test.utils import UtilsTest
import os
data_dir = UtilsTest.getDataset('test10')
```
%% Cell type:markdown id: tags:
## create an instance of `EDFTomoScan`
`EDFTomoScan` implements the TomoScanBase interface.
This allow you to have a common API for accessing data from EDF or HDF5 regardless of the type of acquisition.
%% Cell type:code id: tags:
``` python
from tomoscan.esrf.edfscan import EDFTomoScan
scan = EDFTomoScan(scan=data_dir)
```
%% Cell type:markdown id: tags:
Then from it you can access several information
%% Cell type:markdown id: tags:
### projections
%% Cell type:code id: tags:
``` python
scan.projections
```
%%%% Output: execute_result
{3: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100003.edf', data_path=None, data_slice=[0]),
27: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100027.edf', data_path=None, data_slice=[0]),
0: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100000.edf', data_path=None, data_slice=[0]),
31: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100031.edf', data_path=None, data_slice=[0]),
20: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100020.edf', data_path=None, data_slice=[0]),
25: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100025.edf', data_path=None, data_slice=[0]),
7: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100007.edf', data_path=None, data_slice=[0]),
19: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100019.edf', data_path=None, data_slice=[0]),
8: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100008.edf', data_path=None, data_slice=[0]),
5: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100005.edf', data_path=None, data_slice=[0]),
4: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100004.edf', data_path=None, data_slice=[0]),
22: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100022.edf', data_path=None, data_slice=[0]),
26: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100026.edf', data_path=None, data_slice=[0]),
32: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100032.edf', data_path=None, data_slice=[0]),
14: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100014.edf', data_path=None, data_slice=[0]),
18: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100018.edf', data_path=None, data_slice=[0]),
30: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100030.edf', data_path=None, data_slice=[0]),
2: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100002.edf', data_path=None, data_slice=[0]),
16: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100016.edf', data_path=None, data_slice=[0]),
15: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100015.edf', data_path=None, data_slice=[0]),
23: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100023.edf', data_path=None, data_slice=[0]),
11: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100011.edf', data_path=None, data_slice=[0]),
13: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100013.edf', data_path=None, data_slice=[0]),
1: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100001.edf', data_path=None, data_slice=[0]),
17: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100017.edf', data_path=None, data_slice=[0]),
24: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100024.edf', data_path=None, data_slice=[0]),
12: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100012.edf', data_path=None, data_slice=[0]),
9: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100009.edf', data_path=None, data_slice=[0]),
29: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100029.edf', data_path=None, data_slice=[0]),
21: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100021.edf', data_path=None, data_slice=[0]),
28: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100028.edf', data_path=None, data_slice=[0]),
10: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100010.edf', data_path=None, data_slice=[0]),
6: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/test100006.edf', data_path=None, data_slice=[0])}
%% Cell type:markdown id: tags:
This return a dictionnary of projection index and DataUrl.
You can access the data using `silx.io.utils.get_data function`
%% Cell type:code id: tags:
``` python
from silx.io.utils import get_data
frame_28_data = get_data(scan.projections[28])
frame_18_data = get_data(scan.projections[18])
# imshow(frame_28_data)
```
%%%% Output: execute_result
<matplotlib.image.AxesImage at 0x7f5ce5bbcc88>
%% Cell type:markdown id: tags:
### darks
%% Cell type:code id: tags:
``` python
scan.darks
```
%%%% Output: execute_result
{}
%% Cell type:markdown id: tags:
### flats
%% Cell type:code id: tags:
``` python
scan.flats
```
%%%% Output: execute_result
{20: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/refHST0020.edf', data_path=None, data_slice=[0]),
10: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/refHST0010.edf', data_path=None, data_slice=[0]),
0: DataUrl(valid=True, scheme='fabio', file_path='/home/payno/dev/tomo/tomoscan/tomoscan/test/test10/refHST0000.edf', data_path=None, data_slice=[0])}
%% Cell type:markdown id: tags:
### energy (in keV)
%% Cell type:code id: tags:
``` python
scan.energy
```
%%%% Output: execute_result
19.0
%% Cell type:markdown id: tags:
### pixel size (in )
%% Cell type:code id: tags:
``` python
scan.get_pixel_size(unit='cm')
```
%%%% Output: execute_result
0.00030199999999999997
%% Cell type:markdown id: tags:
There is more information that you can access, to get them all please have a look on the [TomwerScanBase API](https://tomotools.gitlab-pages.esrf.fr/tomoscan/modules/scanbase.html#tomoscan.scanbase.TomoScanBase) and [EDFTomoScan API](https://tomotools.gitlab-pages.esrf.fr/tomoscan/modules/esrf.html#tomoscan.esrf.edfscan.EDFTomoScan).
......
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