Skip to content

Commit 4819566

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 62188fc commit 4819566

28 files changed

+1155
-1095
lines changed

docs/source/conf.py

Lines changed: 56 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# -- General configuration ------------------------------------------------
2727

2828
# RTD
29-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
29+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
3030

3131
show_authors = True
3232

@@ -37,63 +37,67 @@
3737
# Add any Sphinx extension module names here, as strings. They can be
3838
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3939
# ones.
40-
extensions = ['sphinx.ext.mathjax',
41-
'breathe',
42-
'sphinx_copybutton',
43-
'sphinx_design',
44-
'sphinxcontrib.googleanalytics',
45-
'sphinxcontrib.programoutput',
46-
'sphinxcontrib.rsvgconverter',
47-
'matplotlib.sphinxext.plot_directive']
40+
extensions = [
41+
"sphinx.ext.mathjax",
42+
"breathe",
43+
"sphinx_copybutton",
44+
"sphinx_design",
45+
"sphinxcontrib.googleanalytics",
46+
"sphinxcontrib.programoutput",
47+
"sphinxcontrib.rsvgconverter",
48+
"matplotlib.sphinxext.plot_directive",
49+
]
4850

4951
if not on_rtd:
50-
extensions.append('sphinx.ext.githubpages')
52+
extensions.append("sphinx.ext.githubpages")
5153

5254
# Google Analytics
5355
googleanalytics_id = "G-3P1ZT3SQQ5"
5456
googleanalytics_enabled = True
5557

5658
# breathe config
57-
breathe_projects = {'openPMD-api': '../xml'}
58-
breathe_default_project = 'openPMD-api'
59+
breathe_projects = {"openPMD-api": "../xml"}
60+
breathe_default_project = "openPMD-api"
5961

60-
subprocess.call('cd ..; doxygen;'
61-
'mkdir -p source/_static;'
62-
'cp -r doxyhtml source/_static/;'
63-
'cp openpmd-api-doxygen-web.tag.xml source/_static/doxyhtml/',
64-
shell=True)
62+
subprocess.call(
63+
"cd ..; doxygen;"
64+
"mkdir -p source/_static;"
65+
"cp -r doxyhtml source/_static/;"
66+
"cp openpmd-api-doxygen-web.tag.xml source/_static/doxyhtml/",
67+
shell=True,
68+
)
6569

6670
if not on_rtd:
6771
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
6872

6973
# Add any paths that contain templates here, relative to this directory.
70-
templates_path = ['_templates']
74+
templates_path = ["_templates"]
7175

7276
# The suffix(es) of source filenames.
7377
# You can specify multiple suffix as a list of string:
7478
#
7579
source_parsers = {
76-
'.md': CommonMarkParser,
80+
".md": CommonMarkParser,
7781
}
7882

79-
source_suffix = ['.rst', '.md']
83+
source_suffix = [".rst", ".md"]
8084

8185
# The master toctree document.
82-
master_doc = 'index'
86+
master_doc = "index"
8387

8488
# General information about the project.
85-
project = u'openPMD-api'
86-
copyright = u'Documentation under CC-BY 4.0, The openPMD Community'
87-
author = u'The openPMD Community'
89+
project = "openPMD-api"
90+
copyright = "Documentation under CC-BY 4.0, The openPMD Community"
91+
author = "The openPMD Community"
8892

8993
# The version info for the project you're documenting, acts as replacement for
9094
# |version| and |release|, also used in various other places throughout the
9195
# built documents.
9296
#
9397
# The short X.Y version.
94-
version = u'0.18.0'
98+
version = "0.18.0"
9599
# The full version, including alpha/beta/rc tags.
96-
release = u'0.18.0-dev'
100+
release = "0.18.0-dev"
97101

98102
# The language for content autogenerated by Sphinx. Refer to documentation
99103
# for a list of supported languages.
@@ -108,20 +112,20 @@
108112
exclude_patterns = []
109113

110114
# The name of the Pygments (syntax highlighting) style to use.
111-
pygments_style = 'default'
115+
pygments_style = "default"
112116

113117
# If true, `todo` and `todoList` produce output, else they produce nothing.
114118
todo_include_todos = False
115119

116120

117121
# -- Options for HTML output ----------------------------------------------
118122

119-
html_logo = 'openPMD.png'
123+
html_logo = "openPMD.png"
120124

121125
# The theme to use for HTML and HTML Help pages. See the documentation for
122126
# a list of builtin themes.
123127
#
124-
html_theme = 'sphinx_rtd_theme'
128+
html_theme = "sphinx_rtd_theme"
125129

126130
numfig = True
127131

@@ -134,34 +138,31 @@
134138
# Add any paths that contain custom static files (such as style sheets) here,
135139
# relative to this directory. They are copied after the builtin static files,
136140
# so a file named "default.css" will overwrite the builtin "default.css".
137-
html_static_path = ['_static']
141+
html_static_path = ["_static"]
138142

139143

140144
# -- Options for HTMLHelp output ------------------------------------------
141145

142146
# Output file base name for HTML help builder.
143-
htmlhelp_basename = 'openPMD-apidoc'
147+
htmlhelp_basename = "openPMD-apidoc"
144148

145149

146150
# -- Options for LaTeX output ---------------------------------------------
147151

148-
latex_logo = 'openPMD.png'
152+
latex_logo = "openPMD.png"
149153

150154
latex_elements = {
151155
# The paper size ('letterpaper' or 'a4paper').
152156
#
153157
# 'papersize': 'letterpaper',
154-
'papersize': 'a4paper',
155-
158+
"papersize": "a4paper",
156159
# The font size ('10pt', '11pt' or '12pt').
157160
#
158161
# 'pointsize': '10pt',
159-
160162
# Additional stuff for the LaTeX preamble.
161163
#
162164
# 'preamble': '',
163-
'preamble': r'\setcounter{tocdepth}{2}',
164-
165+
"preamble": r"\setcounter{tocdepth}{2}",
165166
# Latex figure (float) alignment
166167
#
167168
# 'figure_align': 'htbp',
@@ -171,19 +172,21 @@
171172
# (source start file, target name, title,
172173
# author, documentclass [howto, manual, or own class]).
173174
latex_documents = [
174-
(master_doc, 'openPMD-api.tex', u'openPMD-api Documentation',
175-
u'The openPMD Community', 'manual'),
175+
(
176+
master_doc,
177+
"openPMD-api.tex",
178+
"openPMD-api Documentation",
179+
"The openPMD Community",
180+
"manual",
181+
),
176182
]
177183

178184

179185
# -- Options for manual page output ---------------------------------------
180186

181187
# One entry per manual page. List of tuples
182188
# (source start file, name, description, authors, manual section).
183-
man_pages = [
184-
(master_doc, 'openPMD-api', u'openPMD-api Documentation',
185-
[author], 1)
186-
]
189+
man_pages = [(master_doc, "openPMD-api", "openPMD-api Documentation", [author], 1)]
187190

188191

189192
# -- Options for Texinfo output -------------------------------------------
@@ -192,14 +195,19 @@
192195
# (source start file, target name, title, author,
193196
# dir menu entry, description, category)
194197
texinfo_documents = [
195-
(master_doc, 'openPMD-api', u'openPMD-api Documentation',
196-
author, 'openPMD-api',
197-
'C++ and Python APIs for the openPMD meta-standard',
198-
"""
198+
(
199+
master_doc,
200+
"openPMD-api",
201+
"openPMD-api Documentation",
202+
author,
203+
"openPMD-api",
204+
"C++ and Python APIs for the openPMD meta-standard",
205+
"""
199206
The openPMD standard, short for open standard for particle-mesh data files
200207
is not a file format per se. It is a standard for meta data and naming
201208
schemes.
202209
openPMD provides naming and attribute conventions that allow to exchange
203210
particle and mesh based data from scientific simulations and experiments.
204-
"""),
211+
""",
212+
),
205213
]

examples/10_streaming_read.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55

66
# pass-through for ADIOS2 engine parameters
77
# https://adios2.readthedocs.io/en/latest/engines/engines.html
8-
config = {'adios2': {'engine': {}, 'dataset': {}}}
9-
config['adios2']['engine'] = {'parameters':
10-
{'Threads': '4', 'DataTransport': 'WAN'}}
11-
config['adios2']['dataset'] = {'operators': [{'type': 'bzip2'}]}
8+
config = {"adios2": {"engine": {}, "dataset": {}}}
9+
config["adios2"]["engine"] = {"parameters": {"Threads": "4", "DataTransport": "WAN"}}
10+
config["adios2"]["dataset"] = {"operators": [{"type": "bzip2"}]}
1211

1312
if __name__ == "__main__":
1413
# this block is for our CI, SST engine is not present on all systems

examples/10_streaming_write.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66

77
# pass-through for ADIOS2 engine parameters
88
# https://adios2.readthedocs.io/en/latest/engines/engines.html
9-
config = {'adios2': {'engine': {}, 'dataset': {}}}
10-
config['adios2']['engine'] = {'parameters':
11-
{'Threads': '4', 'DataTransport': 'WAN'}}
12-
config['adios2']['dataset'] = {'operators': [{'type': 'bzip2'}]}
9+
config = {"adios2": {"engine": {}, "dataset": {}}}
10+
config["adios2"]["engine"] = {"parameters": {"Threads": "4", "DataTransport": "WAN"}}
11+
config["adios2"]["dataset"] = {"operators": [{"type": "bzip2"}]}
1312

1413
if __name__ == "__main__":
1514
# this block is for our CI, SST engine is not present on all systems
@@ -41,8 +40,7 @@
4140
electronPositions.set_attribute("comment", "I'm a comment")
4241

4342
length = 10
44-
local_data = np.arange(i * length, (i + 1) * length,
45-
dtype=np.dtype("double"))
43+
local_data = np.arange(i * length, (i + 1) * length, dtype=np.dtype("double"))
4644
for dim in ["x", "y", "z"]:
4745
pos = electronPositions[dim]
4846
pos.reset_dataset(io.Dataset(local_data.dtype, [length]))
@@ -58,12 +56,11 @@
5856
temperature = iteration.meshes["temperature"]
5957
temperature.unit_dimension = {io.Unit_Dimension.theta: 1.0}
6058
temperature.axis_labels = ["x", "y"]
61-
temperature.grid_spacing = [1., 1.]
59+
temperature.grid_spacing = [1.0, 1.0]
6260
# temperature has no x,y,z components, so skip the last layer:
6361
temperature_dataset = temperature
6462
# let's say we are in a 3x3 mesh
65-
temperature_dataset.reset_dataset(
66-
io.Dataset(np.dtype("double"), [3, 3]))
63+
temperature_dataset.reset_dataset(io.Dataset(np.dtype("double"), [3, 3]))
6764
# temperature is constant
6865
temperature_dataset.make_constant(273.15)
6966

examples/11_particle_dataframe.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
Authors: Axel Huebl, Dmitry Ganyushin
77
License: LGPLv3+
88
"""
9+
910
import sys
1011

1112
import numpy as np
@@ -20,6 +21,7 @@
2021
found_cudf = False
2122
try:
2223
import cudf
24+
2325
found_cudf = True
2426
except ImportError:
2527
print("cudf NOT found. Install RAPIDS for CUDA DataFrame example.")
@@ -29,6 +31,7 @@
2931
import dask
3032
import dask.array as da
3133
from dask.delayed import delayed
34+
3235
found_dask = True
3336
except ImportError:
3437
print("dask NOT found. Install dask to run the 2nd example.")
@@ -66,7 +69,7 @@
6669
# the default schedulers are local/threaded, not requiring much.
6770
# But multi-node, "distributed" and local "processes" need object
6871
# pickle capabilities, so we test this here:
69-
dask.config.set(scheduler='processes')
72+
dask.config.set(scheduler="processes")
7073

7174
df = electrons.to_dask(attributes=["particleShape"])
7275
print(df)
@@ -79,20 +82,23 @@
7982
print("<momentum_z>={}".format(df["momentum_z"].mean().compute()))
8083

8184
# example2: momentum histogram
82-
h, bins = da.histogram(df["momentum_z"].to_dask_array(), bins=50,
83-
range=[-8.0e-23, 8.0e-23],
84-
weights=df["weighting"].to_dask_array())
85+
h, bins = da.histogram(
86+
df["momentum_z"].to_dask_array(),
87+
bins=50,
88+
range=[-8.0e-23, 8.0e-23],
89+
weights=df["weighting"].to_dask_array(),
90+
)
8591
print(h.compute())
8692

8793
# example3: longitudinal phase space (dask 2021.04.0+)
8894
z_min = df["position_z"].min().compute()
8995
z_max = df["position_z"].max().compute()
9096

9197
z_pz, z_pz_bins = da.histogramdd(
92-
df[['position_z', 'momentum_z']].to_dask_array(),
98+
df[["position_z", "momentum_z"]].to_dask_array(),
9399
bins=[80, 80],
94100
range=[[z_min, z_max], [-8.0e-23, 8.0e-23]],
95-
weights=df["weighting"].to_dask_array()
101+
weights=df["weighting"].to_dask_array(),
96102
)
97103
print(z_pz.compute())
98104

@@ -114,9 +120,13 @@
114120
Intensity = darr_x * darr_x + darr_y * darr_y + darr_z * darr_z
115121
Intensity_max = Intensity.max().compute()
116122
idx_max = da.argwhere(Intensity == Intensity_max).compute()[0]
117-
pos_max = E.grid_unit_SI * 1.0e6 * (
118-
idx_max * E.grid_spacing + E.grid_global_offset)
119-
print("maximum intensity I={} at index={} z={}mu".format(
120-
Intensity_max, idx_max, pos_max[2]))
123+
pos_max = (
124+
E.grid_unit_SI * 1.0e6 * (idx_max * E.grid_spacing + E.grid_global_offset)
125+
)
126+
print(
127+
"maximum intensity I={} at index={} z={}mu".format(
128+
Intensity_max, idx_max, pos_max[2]
129+
)
130+
)
121131

122132
s.close()

0 commit comments

Comments
 (0)