From 29605f00992b343f09936a01cb095885c5b08956 Mon Sep 17 00:00:00 2001 From: BrianMarre Date: Mon, 28 Nov 2022 14:41:13 +0000 Subject: [PATCH] fix pyflake errors --- lib/python/picongpu/picmi/grid.py | 32 +++++++++++++------ lib/python/picongpu/picmi/simulation.py | 15 +++++---- test/python/picongpu/compiling/species.py | 2 +- .../picongpu/quick/picmi/gaussian_laser.py | 6 ++-- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/lib/python/picongpu/picmi/grid.py b/lib/python/picongpu/picmi/grid.py index 596afe06c73..2797d87ee53 100644 --- a/lib/python/picongpu/picmi/grid.py +++ b/lib/python/picongpu/picmi/grid.py @@ -59,26 +59,35 @@ def get_as_pypicongpu(self): "periodic": grid.BoundaryCondition.PERIODIC, } - assert self.lower_boundary_conditions[0] in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[0] in \ + picongpu_boundary_condition_by_picmi_id, \ "X: boundary condition not supported" - assert self.lower_boundary_conditions[1] in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[1] in \ + picongpu_boundary_condition_by_picmi_id, \ "Y: boundary condition not supported" - assert self.lower_boundary_conditions[2] in picongpu_boundary_condition_by_picmi_id, \ + assert self.lower_boundary_conditions[2] in \ + picongpu_boundary_condition_by_picmi_id, \ "Z: boundary condition not supported" g = grid.Grid3D() - g.cell_size_x_si = (self.upper_bound[0] - self.lower_bound[0]) / self.number_of_cells[0] - g.cell_size_y_si = (self.upper_bound[1] - self.lower_bound[1]) / self.number_of_cells[1] - g.cell_size_z_si = (self.upper_bound[2] - self.lower_bound[2]) / self.number_of_cells[2] + g.cell_size_x_si = (self.upper_bound[0] - self.lower_bound[0]) \ + / self.number_of_cells[0] + g.cell_size_y_si = (self.upper_bound[1] - self.lower_bound[1]) \ + / self.number_of_cells[1] + g.cell_size_z_si = (self.upper_bound[2] - self.lower_bound[2]) \ + / self.number_of_cells[2] g.cell_cnt_x = self.number_of_cells[0] g.cell_cnt_y = self.number_of_cells[1] g.cell_cnt_z = self.number_of_cells[2] g.boundary_condition_x = \ - picongpu_boundary_condition_by_picmi_id[self.lower_boundary_conditions[0]] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[0]] g.boundary_condition_y = \ - picongpu_boundary_condition_by_picmi_id[self.lower_boundary_conditions[1]] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[1]] g.boundary_condition_z = \ - picongpu_boundary_condition_by_picmi_id[self.lower_boundary_conditions[2]] + picongpu_boundary_condition_by_picmi_id[ + self.lower_boundary_conditions[2]] # gpu distribution # convert input to 3 integer list @@ -100,7 +109,10 @@ def get_as_pypicongpu(self): # check if gpu distribution fits grid # TODO: super_cell_size still hard coded super_cell_size = [8, 8, 4] - cells = [self.number_of_cells[0], self.number_of_cells[1], self.number_of_cells[2]] + cells = [ + self.number_of_cells[0], + self.number_of_cells[1], + self.number_of_cells[2]] dim_name = ["x", "y", "z"] for dim in range(3): assert (((cells[dim] // g.n_gpus[dim]) // super_cell_size[dim]) diff --git a/lib/python/picongpu/picmi/simulation.py b/lib/python/picongpu/picmi/simulation.py index c5ce7c642da..a6ed7e6bf23 100644 --- a/lib/python/picongpu/picmi/simulation.py +++ b/lib/python/picongpu/picmi/simulation.py @@ -58,12 +58,15 @@ def __yee_compute_cfl_or_delta_t(self) -> None: assert "Yee" == self.solver.method assert isinstance(self.solver.grid, Cartesian3DGrid) - delta_x = (self.solver.grid.upper_bound[0] - self.solver.grid.lower_bound[0]) \ - / self.solver.grid.number_of_cells[0] - delta_y = (self.solver.grid.upper_bound[1] - self.solver.grid.lower_bound[1]) \ - / self.solver.grid.number_of_cells[1] - delta_z = (self.solver.grid.upper_bound[2] - self.solver.grid.lower_bound[2]) \ - / self.solver.grid.number_of_cells[2] + delta_x = (self.solver.grid.upper_bound[0] + - self.solver.grid.lower_bound[0]) \ + / self.solver.grid.number_of_cells[0] + delta_y = (self.solver.grid.upper_bound[1] + - self.solver.grid.lower_bound[1]) \ + / self.solver.grid.number_of_cells[1] + delta_z = (self.solver.grid.upper_bound[2] + - self.solver.grid.lower_bound[2]) \ + / self.solver.grid.number_of_cells[2] if self.time_step_size is not None and \ self.solver.cfl is not None: diff --git a/test/python/picongpu/compiling/species.py b/test/python/picongpu/compiling/species.py index 08cd564c9a4..e6df4283874 100644 --- a/test/python/picongpu/compiling/species.py +++ b/test/python/picongpu/compiling/species.py @@ -28,7 +28,7 @@ def setUp(self): laser = picmi.GaussianLaser(0.8e-6, 5.0e-6 / 1.17741, 5.0e-15, a0=8, propagation_direction=[0, 1, 0], - polarization_Driection=[1, 0, 0], + polarization_direction=[1, 0, 0], centroid_position=[ 0.5*grid.upper_bound[0], 0, diff --git a/test/python/picongpu/quick/picmi/gaussian_laser.py b/test/python/picongpu/quick/picmi/gaussian_laser.py index 9fa751037a7..32170f7225b 100644 --- a/test/python/picongpu/quick/picmi/gaussian_laser.py +++ b/test/python/picongpu/quick/picmi/gaussian_laser.py @@ -173,7 +173,7 @@ def test_minimal(self): focal_position=[0, 0, 0], centroid_position=[0, 0, 0], propagation_direction=[0, 1, 0], - polarization_direction=[1,0,0], + polarization_direction=[1, 0, 0], E0=1) pypic_laser = picmi_laser.get_as_pypicongpu() self.assertNotEqual({}, pypic_laser.get_rendering_context()) @@ -231,7 +231,7 @@ def test_laguerre_modes_optional(self): centroid_position=[0, 0, 0], E0=5, propagation_direction=[0, 1, 0], - polarization_direction=[1 ,0, 0]) + polarization_direction=[1, 0, 0]) pypic_laser = picmi_laser.get_as_pypicongpu() self.assertEqual([1.0], pypic_laser.laguerre_modes) self.assertEqual([0.0], pypic_laser.laguerre_phases) @@ -245,7 +245,7 @@ def test_laguerre_modes_optional(self): centroid_position=[0, 0, 0], E0=5, propagation_direction=[0, 1, 0], - polarization_direction=[1 ,0, 0], + polarization_direction=[1, 0, 0], picongpu_laguerre_modes=None, picongpu_laguerre_phases=None) pypic_laser = picmi_laser.get_as_pypicongpu()