Skip to content

Commit 6e05a84

Browse files
committed
Change to the use of UpperCamelCase for class names
1 parent 25d9753 commit 6e05a84

File tree

4 files changed

+40
-39
lines changed

4 files changed

+40
-39
lines changed

lcode2dPy/diagnostics/diagnostics_3d.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def dt(self, *parameters):
5252
print(f'{diag} type of diagnostics is not supported.')
5353

5454

55-
class Diagnostics_f_xi:
55+
class DiagnosticsFXi:
5656
__allowed_f_xi = ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'ne', 'nb',
5757
'Ez2', 'Bz2', 'nb2', 'Phi']
5858
# 'ni']
@@ -170,7 +170,7 @@ def dt(self, *params):
170170
self.__data[name] = []
171171

172172

173-
class Diagnostics_colormaps:
173+
class DiagnosticsColormaps:
174174
__allowed_colormaps = ['Ex', 'Ey', 'Ez', 'Bx', 'By', 'Bz', 'ne', 'nb',
175175
'px', 'py', 'pz', 'Phi']
176176
# 'ni']
@@ -311,7 +311,7 @@ def dt(self, *params):
311311
self.__data[name] = []
312312

313313

314-
class Save_run_state:
314+
class SaveRunState:
315315
def __init__(self, saving_period=1000., save_beam=False, save_plasma=False):
316316
self.__saving_period = saving_period
317317
self.__save_beam = bool(save_beam)

lcode2dPy/simulation/three_dimensional.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
from lcode2dPy.alt_beam_generator.beam_shape import BeamShape, BeamSegmentShape
1616

1717
# Imports for 3d simulation
18-
from lcode2dPy.push_solvers.push_solver_3d import PushAndSolver3d as PushAndSolver3d_cpu
18+
from lcode2dPy.push_solvers.push_solver_3d import PushAndSolver3d as PushAndSolver3dCPU
1919
from lcode2dPy.beam3d import beam as beam3d_cpu
2020
from lcode2dPy.plasma3d.initialization import init_plasma as init_plasma_cpu
2121
from lcode2dPy.plasma3d.initialization import load_plasma as load_plasma_cpu
2222

23-
from lcode2dPy.push_solvers.push_solver_3d_gpu import PushAndSolver3d as PushAndSolver3d_gpu
23+
from lcode2dPy.push_solvers.push_solver_3d_gpu import PushAndSolver3d as PushAndSolver3dGPU
2424
from lcode2dPy.beam3d_gpu import beam as beam3d_gpu
2525
from lcode2dPy.plasma3d_gpu.initialization import init_plasma as init_plasma_gpu
2626
from lcode2dPy.plasma3d_gpu.initialization import load_plasma as load_plasma_gpu
@@ -60,6 +60,7 @@ def __init__(self, config=default_config_values, beam_parameters={},
6060
def __pull_config(self):
6161
# 0. We set __config__ as a Config class instance:
6262
self.__config = Config(self.config)
63+
self.full_config = self.__config.config_values
6364

6465
# Firstly, we check that the geomtry was set right:
6566
geometry = self.__config.get('geometry').lower()
@@ -81,12 +82,12 @@ def __pull_config(self):
8182
pu_type = self.__config.get('processing-unit-type').lower()
8283

8384
if pu_type == 'cpu':
84-
self.__push_solver = PushAndSolver3d_cpu(self.__config)
85+
self.__push_solver = PushAndSolver3dCPU(self.__config)
8586
self.__init_plasma = init_plasma_cpu
8687
self.__load_plasma = load_plasma_cpu
8788
self.__beam_module = beam3d_cpu
8889
elif pu_type == 'gpu':
89-
self.__push_solver = PushAndSolver3d_gpu(self.__config)
90+
self.__push_solver = PushAndSolver3dGPU(self.__config)
9091
self.__init_plasma = init_plasma_gpu
9192
self.__load_plasma = load_plasma_gpu
9293
self.__beam_module = beam3d_gpu

t-step-test1-3d-gpu.ipynb

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"source": [
2424
"# Import required modules\n",
2525
"from lcode2dPy.simulation.three_dimensional import Cartesian3dSimulation\n",
26-
"from lcode2dPy.diagnostics.diagnostics_3d import (Diagnostics_f_xi,\n",
27-
" Diagnostics_colormaps,\n",
28-
" Save_run_state)\n",
26+
"from lcode2dPy.diagnostics.diagnostics_3d import (DiagnosticsFXi,\n",
27+
" DiagnosticsColormaps,\n",
28+
" SaveRunState)\n",
2929
"\n",
3030
"# Set some parameters of the config:\n",
3131
"config = {\n",
@@ -49,9 +49,9 @@
4949
"beam_parameters = {'current': 0.01 * (2*pi), 'particles_in_layer': 2000}\n",
5050
"\n",
5151
"# Set diagnostics\n",
52-
"diag = [Diagnostics_f_xi(f_xi='Ez', output_period=0),\n",
53-
" Diagnostics_colormaps(output_period=0, colormaps='Ez'),\n",
54-
" Save_run_state(saving_period=0, save_beam=True, save_plasma=True)]"
52+
"diag = [DiagnosticsFXi(f_xi='Ez', output_period=0),\n",
53+
" DiagnosticsColormaps(output_period=0, colormaps='Ez'),\n",
54+
" SaveRunState(saving_period=0, save_beam=True, save_plasma=True)]"
5555
],
5656
"outputs": [],
5757
"metadata": {}

t-step-test1-3d.ipynb

+26-26
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"metadata": {},
65
"source": [
76
"### Test 1 for lcode 3d with a single time step and an alternative beam generator."
8-
]
7+
],
8+
"metadata": {}
99
},
1010
{
1111
"cell_type": "code",
1212
"execution_count": null,
13-
"metadata": {},
14-
"outputs": [],
1513
"source": [
1614
"# Import required modules\n",
1715
"from math import pi, inf\n",
1816
"\n",
1917
"from lcode2dPy.alt_beam_generator.beam_generator import generate_beam\n",
2018
"from lcode2dPy.simulation.three_dimensional import Cartesian3dSimulation\n",
21-
"from lcode2dPy.diagnostics.diagnostics_3d import (Diagnostics_f_xi,\n",
22-
" Diagnostics_colormaps,\n",
23-
" Save_run_state)\n",
19+
"from lcode2dPy.diagnostics.diagnostics_3d import (DiagnosticsFXi,\n",
20+
" DiagnosticsColormaps,\n",
21+
" SaveRunState)\n",
2422
"\n",
2523
"# Set some parameters of the config:\n",
2624
"config = {\n",
@@ -39,50 +37,50 @@
3937
"}\n",
4038
"\n",
4139
"# Set diagnostics\n",
42-
"diag = [Diagnostics_f_xi(f_xi='Ez, Ex', output_period=0),\n",
43-
" Diagnostics_colormaps(output_period=0, colormaps='Ez'),\n",
44-
" Save_run_state(saving_period=0, save_beam=True)]"
45-
]
40+
"diag = [DiagnosticsFXi(f_xi='Ez, Ex', output_period=0),\n",
41+
" DiagnosticsColormaps(output_period=0, colormaps='Ez'),\n",
42+
" SaveRunState(saving_period=0, save_beam=True)]"
43+
],
44+
"outputs": [],
45+
"metadata": {}
4646
},
4747
{
4848
"cell_type": "code",
4949
"execution_count": null,
50-
"metadata": {},
51-
"outputs": [],
5250
"source": [
5351
"# Create a beam\n",
5452
"\n",
5553
"beam_parameters = {'current': 0.01 * (2*pi), 'particles_in_layer': 2000}\n",
5654
"\n",
5755
"beam_particles = generate_beam(config=config, beam_parameters=beam_parameters)\n",
5856
"beam_particles.save('beamfile_1')"
59-
]
57+
],
58+
"outputs": [],
59+
"metadata": {}
6060
},
6161
{
6262
"cell_type": "code",
6363
"execution_count": null,
64-
"metadata": {},
65-
"outputs": [],
6664
"source": [
6765
"sim = Cartesian3dSimulation(config=config, diagnostics=diag)\n",
6866
"sim.load_beamfile('beamfile_1.npz')\n",
6967
"# sim.load_plasmastate('plasmastate.npz')"
70-
]
68+
],
69+
"outputs": [],
70+
"metadata": {}
7171
},
7272
{
7373
"cell_type": "code",
7474
"execution_count": null,
75-
"metadata": {},
76-
"outputs": [],
7775
"source": [
7876
"sim.step()"
79-
]
77+
],
78+
"outputs": [],
79+
"metadata": {}
8080
},
8181
{
8282
"cell_type": "code",
8383
"execution_count": null,
84-
"metadata": {},
85-
"outputs": [],
8684
"source": [
8785
"# Should work correctly. Compare results with the test 1 result with a rigid beam:\n",
8886
"# xi Ez_00\n",
@@ -112,14 +110,16 @@
112110
"# xi=+0.4600 -6.0912e-04\n",
113111
"# xi=+0.4800 -6.8855e-04\n",
114112
"# xi=+0.5000 -7.7437e-04"
115-
]
113+
],
114+
"outputs": [],
115+
"metadata": {}
116116
},
117117
{
118118
"cell_type": "code",
119119
"execution_count": null,
120-
"metadata": {},
120+
"source": [],
121121
"outputs": [],
122-
"source": []
122+
"metadata": {}
123123
}
124124
],
125125
"metadata": {
@@ -148,4 +148,4 @@
148148
},
149149
"nbformat": 4,
150150
"nbformat_minor": 2
151-
}
151+
}

0 commit comments

Comments
 (0)