1- Panedr
2- ======
1+ Pyedr and Panedr
2+ ================
33
44|Build Status | |cov |
55
6- Panedr reads a `Gromacs EDR `_ binary energy XDR file and returns its content
7- as a pandas _ dataframe. The library exposes three functions:
6+ This repository hosts the source files for both the Pyedr and Panedr packages.
87
9- - the ``edr_to_df `` function, which gets the path to an EDR file and returns a
10- pandas DataFrame,
8+ ``pyedr `` and ``panedr `` are compatible with Python 3.6 and greater.
9+
10+ Pyedr
11+ -----
12+
13+ Pyedr provides a means of reading a `Gromacs EDR `_ binary XDR file and
14+ return its contents as a dictionary of `numpy `_ arrays. Pyedr exposes
15+ the following functions:
1116
12- - the ``edr_to_dict `` function, which returns a dictionary of NumPy arrays instead
13- of a pandas DataFrame
17+ - ``edr_to_dict ``: returns a dictionary of NumPy arrays keyed by the energy
18+ type from a given path to an EDR file.
19+ - ``read_edr ``: parses an EDR file and returns the energy terms
20+ in a nested list
1421
15- - and the ``read_edr `` function, which is called by the other two functions to
16- do the actual reading of EDR files. It returns a tuple of lists.
1722
18- ``panedr `` is compatible with Python 3.6 and greater.
23+ Panedr
24+ ------
25+
26+ Panedr uses the Pyedr library to read a `Gromacs EDR `_ binary energy XDR file
27+ and returns its contents as a pandas _ dataframe. Panedr exposes the
28+ following function:
29+
30+ - ``edr_to_df ``: which gets the path to an EDR file and returns a
31+ pandas DataFrame,
32+
1933
2034Example
2135-------
2236
37+ Using ``pyedr ``:
38+
39+
40+ .. code :: python
41+
42+ import pyedr
43+
44+ # Read the EDR file
45+ path = ' ener.edr'
46+ dic = pyedr.edr_to_dict(path)
47+
48+ # The `verbose` optional parameter can be set to True to display the
49+ # progress on stderr
50+ dic = pyedr.edr_to_dict(path, verbose = True )
51+
52+ # Get the average pressure after the first 10 ns
53+ pressure_avg = dic[' Pressure' ][dic[' Time' ] > 10000 ].mean()
54+
55+
56+ Using ``panedr ``:
57+
58+
2359.. code :: python
2460
2561 import panedr
2662
2763 # Read the EDR file
2864 path = ' ener.edr'
2965 df = panedr.edr_to_df(path)
30- dic = panedr.edr_to_dict(path)
3166
3267 # The `verbose` optional parameter can be set to True to display the
3368 # progress on stderr
3469 df = panedr.edr_to_df(path, verbose = True )
35- dic = panedr.edr_to_dict(path, verbose = True )
3670
3771 # Get the average pressure after the first 10 ns
3872 pressure_avg = df[' Pressure' ][df[' Time' ] > 10000 ].mean()
39- pressure_avg = dic[' Pressure' ][dic[' Time' ] > 10000 ].mean()
4073
4174
4275 Install
4376-------
44- Install panedr ``pip ``:
77+
78+ You can install ``pyedr `` and ``panedr `` using ``pip ``:
4579
4680.. code :: bash
4781
82+ pip install pyedr
83+
84+ # installing panedr automatically installs pyedr
4885 pip install panedr
4986
5087
51- If you are using `conda `_ and `conda-forge `_, you can install with
88+ If you are using `conda `_ and `conda-forge `_, you can install with:
5289
5390.. code :: bash
5491
92+ conda install -c conda-forge pyedr
93+
94+ # install panedr automatically installs pyedr
5595 conda install -c conda-forge panedr
5696
97+
5798 Tests
5899-----
59100
60- The ``panedr `` repository contains a series of tests. If you downloaded or
61- cloned the code from the repository, you can run the tests. To do so,
62- install `pytest `_, and, in the directory of the
101+ The ``pyedr `` and `` panedr `` repositories contains a series of tests.
102+ If you downloaded or cloned the code from the repository, you can run
103+ the tests. To do so, install `pytest `_, and, in the directory of the
63104panedr source code, run:
64105
106+ For ``pyedr ``:
107+
108+
65109.. code :: bash
66110
67- pytest -v tests
111+ pytest -v pyedr/pyedr/ tests
68112
69113
70- panedrlite
71- ----------
72- Under the hood, panedr is just a metapackage that installs panedrlite and
73- the requirements for all functions, notably including pandas. To avoid requiring
74- pandas in downstream applications, panedrlite is available for installation as
75- well. It provides all functionality, except that pandas is not automatically
76- installed as a dependency, and therefore :func: `edr_to_df ` will not work
77- out-of-the-box unless it is installed manually. `panedrlite ` also uses the panedr
78- namespace, so `import panedr ` works.
114+ For ``panedr ``:
79115
80116
81117.. code :: bash
82118
83- pip install panedrlite
119+ pytest -v panedr/panedr/tests
84120
85121
86122 License
87123-------
88124
89- Panedr translate in python part of the source code of Gromacs.
125+ Pyedr and Panedr translate part of the source code of Gromacs into Python .
90126Therefore, Panedr is distributed under the same GNU Lesser General
91- Public License version 2.1 as Gromacs.
92-
93- Panedr — a library to manipulate Gromacs EDR file in python
94-
95- Copyright (C) 2016 Jonathan Barnoud
96-
97- This library is free software; you can redistribute it and/or modify
98- it under the terms of the GNU Lesser General Public License as
99- published by the Free Software Foundation; either version 2.1 of the
100- License, or (at your option) any later version.
101-
102- This library is distributed in the hope that it will be useful, but
103- WITHOUT ANY WARRANTY; without even the implied warranty of
104- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
105- Lesser General Public License for more details.
127+ Public License version 2.1 as Gromacs. See the `license `_ for more details.
106128
107- You should have received a copy of the GNU Lesser General Public
108- License along with this library; if not, write to the Free Software
109- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
110- 02110-1301 USA
111129
112130.. |Build Status | image :: https://github.com/MDAnalysis/panedr/actions/workflows/gh-ci.yaml/badge.svg
113131 :alt: Github Actions Build Status
@@ -118,7 +136,9 @@ Public License version 2.1 as Gromacs.
118136 :target: https://codecov.io/gh/MDAnalysis/panedr
119137
120138.. _`Gromacs EDR` : https://manual.gromacs.org/documentation/current/reference-manual/file-formats.html#edr
139+ .. _numpy : https://numpy.org/
121140.. _pandas : https://pandas.pydata.org/
122141.. _conda : https://docs.conda.io
123142.. _`conda-forge` : https://conda-forge.org/
124143.. _pytest : https://docs.pytest.org/
144+ .. _license : https://github.com/MDAnalysis/panedr/blob/master/LICENSE.txt
0 commit comments