Skip to content

Commit

Permalink
Python: Use new openpmd_api import
Browse files Browse the repository at this point in the history
Use the new

  import openpmd_api

module in all places.
  • Loading branch information
ax3l committed Oct 18, 2018
1 parent 8980b46 commit 4546427
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ build_script:

test_script:
- cmd: ctest -V -C %CONFIGURATION%
- cmd: python -c "import openPMD; print(openPMD.__version__)"
- cmd: python -c "import openPMD_api; print(openPMD_api.__version__)"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Compile-able/executable code example to reproduce the problem:

Python:
```python
import openPMD
import openpmd_api

# ...
```
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Example: I always do the following workflow [...]
Don't be afraid to add code examples!
Python:
```python
import openPMD
import openpmd_api

# ...
```
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ about: Anything unclear or not well documented
Don't be afraid to add code examples!
Python:
```python
import openPMD
import openpmd_api

# ...
```
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Changelog
=========

0.6.3-alpha
0.7.0-alpha
-----------
**Date:** TBA

Expand All @@ -19,6 +19,7 @@ Features

- Python:

- ``import openPMD`` renamed to ``import openpmd_api`` #...
- works with Python 3.7 #376
- setup.py for sdist #240

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ for( auto const& i : s.iterations ) {


```py
import openPMD
import openpmd_api

# ...

series = openPMD.Series("samples/git-sample/data%T.h5", openPMD.Access_Type.read_only)
series = openpmd_api.Series("samples/git-sample/data%T.h5", openPMD.Access_Type.read_only)

for k_i, i in series.iterations.items():
print("Iteration: {0}".format(k_i))
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage/firststeps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Python

.. code-block:: python3
import openPMD
import openpmd_api
6 changes: 3 additions & 3 deletions examples/2_read_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
Authors: Axel Huebl
License: LGPLv3+
"""
import openPMD
import openpmd_api


if __name__ == "__main__":
series = openPMD.Series("../samples/git-sample/data%T.h5",
openPMD.Access_Type.read_only)
series = openpmd_api.Series("../samples/git-sample/data%T.h5",
openpmd_api.Access_Type.read_only)
print("Read a Series with openPMD standard version %s" %
series.openPMD)

Expand Down
14 changes: 7 additions & 7 deletions examples/3_write_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Authors: Axel Huebl
License: LGPLv3+
"""
import openPMD
import openpmd_api
import numpy as np


Expand All @@ -21,21 +21,21 @@
size, size))

# open file for writing
series = openPMD.Series(
series = openpmd_api.Series(
"../samples/3_write_serial_py.h5",
openPMD.Access_Type.create
openpmd_api.Access_Type.create
)

print("Created an empty {0} Series".format(series.iteration_encoding))

print(len(series.iterations))
rho = series.iterations[1]. \
meshes["rho"][openPMD.Mesh_Record_Component.SCALAR]
meshes["rho"][openpmd_api.Mesh_Record_Component.SCALAR]

datatype = openPMD.Datatype.DOUBLE
# datatype = openPMD.determineDatatype(global_data)
datatype = openpmd_api.Datatype.DOUBLE
# datatype = openpmd_api.determineDatatype(global_data)
extent = [size, size]
dataset = openPMD.Dataset(datatype, extent)
dataset = openpmd_api.Dataset(datatype, extent)

print("Created a Dataset of size {0}x{1} and Datatype {2}".format(
dataset.extent[0], dataset.extent[1], dataset.dtype))
Expand Down
2 changes: 1 addition & 1 deletion examples/7_extended_write_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Authors: Axel Huebl, Fabian Koller
License: LGPLv3+
"""
from openPMD import Series, Access_Type, Dataset, Mesh_Record_Component, \
from openpmd_api import Series, Access_Type, Dataset, Mesh_Record_Component, \
Unit_Dimension
import numpy as np

Expand Down
Loading

0 comments on commit 4546427

Please sign in to comment.