Skip to content

Commit

Permalink
[pre-commit.ci] autoformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored and ax3l committed Aug 14, 2024
1 parent 891e09a commit ef28242
Show file tree
Hide file tree
Showing 12 changed files with 1,102 additions and 532 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def __init__(self, stage_i, surrogate_model, surrogate_length, stage_start):
self.ds = surrogate_length

def surrogate_push(self, pc, step):

ref_part = pc.ref_particle()
ref_z_i = ref_part.z
ref_z_i_LPA = ref_z_i - self.stage_start
Expand Down
56 changes: 31 additions & 25 deletions src/python/impactx/MADXParser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,69 @@ from __future__ import annotations
import os as os
import re as re
import warnings as warnings
__all__ = ['MADXInputError', 'MADXInputWarning', 'MADXParser', 'MADXParserError', 'os', 're', 'warnings']

__all__ = [
"MADXInputError",
"MADXInputWarning",
"MADXParser",
"MADXParserError",
"os",
"re",
"warnings",
]

class MADXInputError(MADXParserError):
def __init__(self, args, with_traceback):
...
def __init__(self, args, with_traceback): ...

class MADXInputWarning(UserWarning):
pass

class MADXParser:
"""
Simple MADX parser.
It expects a single line per element.
Simple MADX parser.
It expects a single line per element.
"""
def __init__(self):
...
def __str__(self):
...
def __init__(self): ...
def __str__(self): ...
def _combine(self, lattice):
"""
Combine to one list of all basic
elements.
Combine to one list of all basic
elements.
return a list of of element dictionaries
return a list of of element dictionaries
"""
def _flatten(self, line):
"""
Find sublines.
Find sublines.
"""
def _noWhitespace(self, string):
"""
Remove white space from a string.
Remove white space from a string.
14. Oct. 2017,
https://stackoverflow.com/questions/3739909/how-to-strip-all-whitespace-from-string
14. Oct. 2017,
https://stackoverflow.com/questions/3739909/how-to-strip-all-whitespace-from-string
"""
def getBeamline(self):
...
def getEtot(self):
...
def getParticle(self):
...
def nonblank_lines_to_lowercase(self, f):
...
def getBeamline(self): ...
def getEtot(self): ...
def getParticle(self): ...
def nonblank_lines_to_lowercase(self, f): ...
def parse(self, fn):
"""
fn (str) filename
fn (str) filename
"""

class MADXParserError(Exception):
pass
57 changes: 44 additions & 13 deletions src/python/impactx/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
"""
impactx_pybind
--------------
.. currentmodule:: impactx_pybind
impactx_pybind
--------------
.. currentmodule:: impactx_pybind
.. autosummary::
:toctree: _generate
ImpactX
distribution
elements
.. autosummary::
:toctree: _generate
ImpactX
distribution
elements
"""

from __future__ import annotations
from amrex import space3d as amr
from impactx.extensions.ImpactXParIter import register_ImpactXParIter_extension
from impactx.extensions.ImpactXParticleContainer import register_ImpactXParticleContainer_extension
from impactx.extensions.ImpactXParticleContainer import (
register_ImpactXParticleContainer_extension,
)
from impactx.impactx_pybind import Config
from impactx.impactx_pybind import CoordSystem
from impactx.impactx_pybind import ImpactX
Expand All @@ -33,10 +36,38 @@ from . import MADXParser
from . import extensions
from . import impactx_pybind
from . import madx_to_impactx
__all__ = ['Config', 'CoordSystem', 'ImpactX', 'ImpactXParConstIter', 'ImpactXParIter', 'ImpactXParticleContainer', 'MADXParser', 'RefPart', 'amr', 'coordinate_transformation', 'cxx', 'distribution', 'elements', 'extensions', 'impactx_pybind', 'madx_to_impactx', 'os', 'push', 'read_beam', 'read_lattice', 'register_ImpactXParIter_extension', 'register_ImpactXParticleContainer_extension', 's', 't']
__author__: str = 'Axel Huebl, Chad Mitchell, Ryan Sandberg, Marco Garten, Ji Qiang, et al.'
__license__: str = 'BSD-3-Clause-LBNL'
__version__: str = '24.08'

__all__ = [
"Config",
"CoordSystem",
"ImpactX",
"ImpactXParConstIter",
"ImpactXParIter",
"ImpactXParticleContainer",
"MADXParser",
"RefPart",
"amr",
"coordinate_transformation",
"cxx",
"distribution",
"elements",
"extensions",
"impactx_pybind",
"madx_to_impactx",
"os",
"push",
"read_beam",
"read_lattice",
"register_ImpactXParIter_extension",
"register_ImpactXParticleContainer_extension",
"s",
"t",
]
__author__: str = (
"Axel Huebl, Chad Mitchell, Ryan Sandberg, Marco Garten, Ji Qiang, et al."
)
__license__: str = "BSD-3-Clause-LBNL"
__version__: str = "24.08"
s: impactx_pybind.CoordSystem # value = <CoordSystem.s: 0>
t: impactx_pybind.CoordSystem # value = <CoordSystem.t: 1>
cxx = impactx_pybind
1 change: 0 additions & 1 deletion src/python/impactx/dashboard/Input/generalFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class generalFunctions:

@staticmethod
def documentation(section_name):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/python/impactx/dashboard/Toolbar/toolbarMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def run_toolbar():
Builds toolbar for the 'Run' page.
"""

vuetify.VSpacer(),
ToolbarElements.run_simulation_button(),
(vuetify.VSpacer(),)
(ToolbarElements.run_simulation_button(),)

@staticmethod
def analyze_toolbar():
Expand Down
53 changes: 32 additions & 21 deletions src/python/impactx/extensions/ImpactXParIter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@ Copyright 2023 ImpactX contributors
Authors: Axel Huebl
License: BSD-3-Clause-LBNL
"""

from __future__ import annotations
__all__ = ['register_ImpactXParIter_extension', 'soa', 'soa_int_comps', 'soa_real_comps']

__all__ = [
"register_ImpactXParIter_extension",
"soa",
"soa_int_comps",
"soa_real_comps",
]

def register_ImpactXParIter_extension(impactx_pybind):
"""
ImpactXParIter helper methods
"""

def soa(self):
"""
Get the StructOfArrays on the current tile
Expand All @@ -22,37 +31,39 @@ def soa(self):
used to query particle container component names
"""

def soa_int_comps(pti, num_comps):
"""
Name the ImpactX int components in SoA.
Name the ImpactX int components in SoA.
Parameters
----------
pti : ImpactXParIter or ImpactXParConstIter
used to query particle container component names
num_comps : int
number of components to generate names for.
Parameters
----------
pti : ImpactXParIter or ImpactXParConstIter
used to query particle container component names
num_comps : int
number of components to generate names for.
Returns
-------
A list of length num_comps with values.
Returns
-------
A list of length num_comps with values.
"""

def soa_real_comps(pti, num_comps):
"""
Name the ImpactX ParticleReal components in SoA.
Name the ImpactX ParticleReal components in SoA.
Parameters
----------
pti : ImpactXParIter or ImpactXParConstIter
used to query particle container component names
num_comps : int
number of components to generate names for.
Parameters
----------
pti : ImpactXParIter or ImpactXParConstIter
used to query particle container component names
num_comps : int
number of components to generate names for.
Returns
-------
A list of length num_comps with values.
Returns
-------
A list of length num_comps with values.
"""
34 changes: 19 additions & 15 deletions src/python/impactx/extensions/ImpactXParticleContainer.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,32 @@ Copyright 2023 ImpactX contributors
Authors: Axel Huebl
License: BSD-3-Clause-LBNL
"""

from __future__ import annotations
__all__ = ['ix_pc_plot_mpl_phasespace', 'register_ImpactXParticleContainer_extension']
def ix_pc_plot_mpl_phasespace(self, num_bins = 50, root_rank = 0):

__all__ = ["ix_pc_plot_mpl_phasespace", "register_ImpactXParticleContainer_extension"]

def ix_pc_plot_mpl_phasespace(self, num_bins=50, root_rank=0):
"""
Plot the longitudinal and transverse phase space projections with matplotlib.
Plot the longitudinal and transverse phase space projections with matplotlib.
Parameters
----------
self : ImpactXParticleContainer_*
The particle container class in ImpactX
num_bins : int, default=50
The number of bins for spatial and momentum directions per plot axis.
root_rank : int, default=0
MPI root rank to reduce to in parallel runs.
Parameters
----------
self : ImpactXParticleContainer_*
The particle container class in ImpactX
num_bins : int, default=50
The number of bins for spatial and momentum directions per plot axis.
root_rank : int, default=0
MPI root rank to reduce to in parallel runs.
Returns
-------
A matplotlib figure with containing the plot.
For MPI-parallel ranks, the figure is only created on the root_rank.
Returns
-------
A matplotlib figure with containing the plot.
For MPI-parallel ranks, the figure is only created on the root_rank.
"""

def register_ImpactXParticleContainer_extension(ixpc):
"""
ImpactXParticleContainer helper methods
Expand Down
3 changes: 2 additions & 1 deletion src/python/impactx/extensions/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
from . import ImpactXParIter
from . import ImpactXParticleContainer
__all__ = ['ImpactXParIter', 'ImpactXParticleContainer']

__all__ = ["ImpactXParIter", "ImpactXParticleContainer"]
Loading

0 comments on commit ef28242

Please sign in to comment.