Skip to content

Commit bda81f3

Browse files
committed
add fix for include and rename after review
1 parent e48404d commit bda81f3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/python/picongpu/extra/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
from .memory_calculator import MemoryCalculator
33
from .field_ionization import FieldIonization
44
from . import FLYonPICRateCalculationReference
5-
from picmi_density_reader import cpp_fct_reader
5+
from .picmi_density_reader import CppFctReader
66

7-
__all__ = ["FindTime", "MemoryCalculator", "FieldIonization", "FLYonPICRateCalculationReference", "cpp_fct_reader"]
7+
__all__ = ["FindTime", "MemoryCalculator", "FieldIonization", "FLYonPICRateCalculationReference", "CppFctReader"]

lib/python/picongpu/extra/utils/picmi_density_reader.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import json
55

66

7-
class cpp_fct_reader:
7+
class CppFctReader:
88
"""class that alllows to evalute the PIConGPU free density
99
from a c++ code string
1010
"""
@@ -117,14 +117,15 @@ def clean_substring(self, s):
117117

118118
if __name__ == "__main__":
119119
# load pypicongpu.json, convert json to dict and extract equation for density
120+
# a pypicongpu.json is created for every PICMI call
120121
file = open("pypicongpu.json")
121122
sim_dict = json.load(file)
122123
density_fct_str = sim_dict["species_initmanager"]["operations"]["simple_density"][0]["profile"]["data"][
123124
"function_body"
124125
]
125126

126127
# create cpp_fct_reader class for later evaluation
127-
reader = cpp_fct_reader(density_fct_str)
128+
reader = CppFctReader(density_fct_str)
128129

129130
# define positions where to evaluate the density
130131
x_array = np.linspace(0.0, 5.0e-3, 1000)
@@ -137,6 +138,6 @@ def clean_substring(self, s):
137138
# plot density
138139
plt.plot(x_array, n_array)
139140
plt.xlabel(r"$y \, \mathrm{[m]}$")
140-
plt.xlabel(r"$n \, \mathrm{[m^-3]}$")
141+
plt.ylabel(r"$n \, \mathrm{[m^-3]}$")
141142
plt.yscale("log")
142143
plt.show()

0 commit comments

Comments
 (0)