aboutsummaryrefslogtreecommitdiff
path: root/Docs/source/visualization/openpmdviewer.rst
blob: 4d41ba00fad78b3409733830c8853b53d7a3d592 (plain) (blame)
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
Visualization with openPMD-viewer (for openPMD data)
====================================================

openPMD-viewer is an open-source Python package to access openPMD data.

It allows to:
- Quickly browse through the data, with a GUI-type interface in the Jupyter notebook
- Have access to the data numpy array, for more detailed analysis

Installation
------------

openPMD-viewer can be installed via ``conda`` or ``pip``:

::

    conda install -c rlehe openpmd_viewer

::

    pip install openPMD-viewer

Usage
-----

openPMD-viewer can be used either in simple Python scripts, or in a Jupyter
notebook. In both cases, you can import openPMD-viewer, and load the data
with the following commands:

::

    from opmd_viewer import OpenPMDTimeSeries
    ts = OpenPMDTimeSeries('./diags/hdf5')

.. note::

    If you are using the Jupyter notebook, then you can start a pre-filled
    notebook, which already contains the above lines, by typing in a terminal:

    ::

        openPMD_notebook

When using the Jupyter notebook, you can quickly browse through the data
by using the command:

::

    ts.slider()

You can also access the particle and field data as numpy arrays with the
methods ``ts.get_field`` and ``ts.get_particle``. See the openPMD-viewer
tutorials `here <https://github.com/openPMD/openPMD-viewer/tree/master/tutorials>`_ for more info.