File: emd.rst

package info (click to toggle)
python-rosettasciio 0.7.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144,644 kB
  • sloc: python: 36,638; xml: 2,582; makefile: 20; ansic: 4
file content (118 lines) | stat: -rw-r--r-- 4,029 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
.. _emd-format:

Electron Microscopy Dataset (EMD)
---------------------------------

EMD stands for “Electron Microscopy Dataset”. It is a subset of the open source
HDF5 wrapper format. N-dimensional data arrays of any standard type can be
stored in an HDF5 file, as well as tags and other metadata.

.. note::
   To read this format, the optional dependency ``h5py`` is required.

.. _emd_ncem-format:

EMD (NCEM)
^^^^^^^^^^

This `EMD format <https://emdatasets.com>`_ was developed by Colin Ophus at the
National Center for Electron Microscopy (NCEM).
This format is used by the `prismatic software <https://prism-em.com/docs-outputs/>`_
to save the simulation outputs.

Usage examples
""""""""""""""

For files containing several datasets, the `dataset_path` argument can be
used to select a specific one:

.. code-block:: python

    >>> from rsciio.emd import file_reader
    >>> s = file_reader("adatafile.emd", dataset_path="/experimental/science_data_1/data")

Or several by using a list:

.. code-block:: python

    >>> s = file_reader("adatafile.emd",
    ...             dataset_path=[
    ...                 "/experimental/science_data_1/data",
    ...                 "/experimental/science_data_2/data"])


.. _emd_fei-format:

EMD (Velox)
^^^^^^^^^^^

This is a non-compliant variant of the standard EMD format developed by
ThermoFisher (former FEI). RosettaSciIO supports importing images, EDS spectrum and EDS
spectrum streams (spectrum images stored in a sparse format). For spectrum
streams, there are several loading options (described in the docstring below) 
to control the frames and detectors to load and whether to sum them on loading.
The default is to import the sum over all frames and over all detectors in order
to decrease the data size in memory.

.. note::

    Pruned Velox EMD files only contain the spectrum image in a proprietary
    format that RosettaSciIO cannot read. Therefore, don't prune Velox EMD files
    if you intend to read them with RosettaSciIO.

.. note::

    When using `HyperSpy <https://hyperspy.org>`_, FFTs made in Velox are loaded
    in as-is as a HyperSpy ComplexSignal2D object.
    The FFT is not centered and only positive frequencies are stored in the file.
    Making FFTs with HyperSpy from the respective image datasets is recommended.

.. note::

    When using `HyperSpy <https://hyperspy.org>`_, DPC data is loaded in as a HyperSpy ComplexSignal2D object.

.. note::

    Currently, only lazy uncompression rather than lazy loading is implemented.
    This means that it is not currently possible to read EDS SI Velox EMD files
    with size bigger than the available memory.

.. note::
   To load EDS data, the optional dependency ``sparse`` is required.

.. warning::

   This format is still not stable and files generated with the most recent
   version of Velox may not be supported. If you experience issues loading
   a file, please report it  to the RosettaSciIO developers so that they can
   add support for newer versions of the format.

Usage examples
""""""""""""""

.. code-block:: python

    >>> from rsciio.emd import file_reader
    >>> file_reader("sample.emd")
    [<Signal2D, title: HAADF, dimensions: (|179, 161)>,
    <EDSSEMSpectrum, title: EDS, dimensions: (179, 161|4096)>]

.. code-block:: python

    >>> file_reader("sample.emd", sum_EDS_detectors=False)
    [<Signal2D, title: HAADF, dimensions: (|179, 161)>,
    <EDSSEMSpectrum, title: EDS - SuperXG21, dimensions: (179, 161|4096)>,
    <EDSSEMSpectrum, title: EDS - SuperXG22, dimensions: (179, 161|4096)>,
    <EDSSEMSpectrum, title: EDS - SuperXG23, dimensions: (179, 161|4096)>,
    <EDSSEMSpectrum, title: EDS - SuperXG24, dimensions: (179, 161|4096)>]

    >>> file_reader("sample.emd", sum_frames=False, load_SI_image_stack=True, SI_dtype=np.int8, rebin_energy=4)
    [<Signal2D, title: HAADF, dimensions: (50|179, 161)>,
    <EDSSEMSpectrum, title: EDS, dimensions: (50, 179, 161|1024)>]


API functions
^^^^^^^^^^^^^

.. automodule:: rsciio.emd
   :members: