Skip to content

Commit a20b595

Browse files
cemitch99pre-commit-ci[bot]ax3lqianglbldependabot[bot]
authored
Merge development into 2D space charge PR (#9)
* [pre-commit.ci] pre-commit autoupdate (BLAST-ImpactX#1161) updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.1 → v0.13.2](astral-sh/ruff-pre-commit@v0.13.1...v0.13.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * [pre-commit.ci] pre-commit autoupdate (BLAST-ImpactX#1165) updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.2 → v0.13.3](astral-sh/ruff-pre-commit@v0.13.2...v0.13.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Gauss 3D: Fix Push Constants (BLAST-ImpactX#1168) This fixes the push constants for non-equal x,y,z and adds an end-point correction for the integration. It also changes the number of integration points by default to 101 instead of 401. Co-authored-by: Ji Qiang <[email protected]> * [pre-commit.ci] pre-commit autoupdate (BLAST-ImpactX#1174) updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.3 → v0.14.0](astral-sh/ruff-pre-commit@v0.13.3...v0.14.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Bump stefanzweifel/git-auto-commit-action from 6 to 7 (BLAST-ImpactX#1175) Bumps [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) from 6 to 7. - [Release notes](https://github.com/stefanzweifel/git-auto-commit-action/releases) - [Changelog](https://github.com/stefanzweifel/git-auto-commit-action/blob/master/CHANGELOG.md) - [Commits](stefanzweifel/git-auto-commit-action@v6...v7) --- updated-dependencies: - dependency-name: stefanzweifel/git-auto-commit-action dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump github/codeql-action from 3 to 4 (BLAST-ImpactX#1176) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix `BeamMonitor`: Delay Open (BLAST-ImpactX#1178) `BeamMonitor` opens the openPMD series now on first output. This simplifies usage dramatically, now allowing to: * create the lattice (monitor elements) before the `sim` is even initialized * creating a monitor element and not using it in a lattice * CMake `pip_install`: Package Examples (BLAST-ImpactX#1179) Ensure the `examples/` directory is part of the `pip` wheels we build, e.g., on `cmake --build build -j 6 --target pip_install` * Envelope: Silence Warning w/o Space-Charge (BLAST-ImpactX#1173) Consistent with the other two tracking modes, we only print options upfront and do not warn every simulation step if space charge is not used. * Release 25.10 (BLAST-ImpactX#1180) * Update Stub Files * AMReX/ABLASTR/WarpX: development (BLAST-ImpactX#1177) * ABLASTR/WarpX: development Update the ABLASTR dependency to the latest development branch. * pyAMReX: `development` * Python: Improve `KnownElementsList` (BLAST-ImpactX#1181) Add per-element by-reference access for manipulation. * Update Stub Files * Element Selection Syntax (BLAST-ImpactX#1182) * Implementation 5hr vibe pair coded in Cursor. Maybe should have just done it xD * Doc * Fix Type Hints * `select`: Fix All-Selected Path Avoid implicit return of `None` * Cleanup * Update Stub Files * Fix Python import errors (BLAST-ImpactX#1186) * Update Stub Files * Fix RFCavity edge case (BLAST-ImpactX#1185) * Fix RFCavity edge case. * Remove extra semicolon. * Fix el typing (BLAST-ImpactX#1190) * Fix `KnownElementsList` Stubs Avoid importing `typing` for type hints, because pybind11-stubgen forgets the import when generating `pyi` files... * Update Stubs * Update PALS to 0.2.0 (BLAST-ImpactX#1184) * Update PALS version * Fix missing imports in KnownElementsList.pyi * Fix FODO example script * Revert changes to stub file * fix some math issues in examle documentation (BLAST-ImpactX#1191) * "Starting step" Print: Spaces (BLAST-ImpactX#1187) - newline before new step - no space before `++++ Starting step` * Element Names: All, `None` (BLAST-ImpactX#1189) It is easier for user-facing workflows if `.name` exists for all elements, even `Empty`. In Python, instead of throwing an exception we return the `None` value for elements without a user-provided name, which simplifies user-logic. In this case `.has_name` is `False`. * Update Stub Files --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Axel Huebl <[email protected]> Co-authored-by: Ji Qiang <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: ax3l <[email protected]> Co-authored-by: Edoardo Zoni <[email protected]> Co-authored-by: Richard Pausch <[email protected]>
1 parent bbbbb8d commit a20b595

File tree

30 files changed

+1898
-89
lines changed

30 files changed

+1898
-89
lines changed

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ jobs:
5656
cmake -S . -B build -DImpactX_FFT=ON -DImpactX_PYTHON=OFF
5757
5858
- name: Initialize CodeQL
59-
uses: github/codeql-action/init@v3
59+
uses: github/codeql-action/init@v4
6060
with:
6161
config-file: ./.github/codeql/impactx-codeql.yml
6262
languages: ${{ matrix.language }}
6363
queries: +security-and-quality
6464

6565
- name: Build (py)
66-
uses: github/codeql-action/autobuild@v3
66+
uses: github/codeql-action/autobuild@v4
6767
if: ${{ matrix.language == 'python' }}
6868
env:
6969
IMPACTX_FFT: ON
@@ -74,7 +74,7 @@ jobs:
7474
cmake --build build -j 4
7575
7676
- name: Perform CodeQL Analysis
77-
uses: github/codeql-action/analyze@v3
77+
uses: github/codeql-action/analyze@v4
7878
with:
7979
category: "/language:${{ matrix.language }}"
8080
upload: False
@@ -96,6 +96,6 @@ jobs:
9696
output: sarif-results/${{ matrix.language }}.sarif
9797

9898
- name: Upload SARIF
99-
uses: github/codeql-action/upload-sarif@v3
99+
uses: github/codeql-action/upload-sarif@v4
100100
with:
101101
sarif_file: sarif-results/${{ matrix.language }}.sarif

.github/workflows/stubs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
run: |
8484
mpiexec -np 1 python3 -m pytest tests/python/ --ignore=tests/python/dashboard
8585
86-
- uses: stefanzweifel/git-auto-commit-action@v6
86+
- uses: stefanzweifel/git-auto-commit-action@v7
8787
name: Commit Updated Stub Files
8888
if: github.event_name == 'push' && github.repository == 'BLAST-ImpactX/impactx' && github.ref == 'refs/heads/development'
8989
with:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ repos:
6666
# Python: Ruff linter & formatter
6767
# https://docs.astral.sh/ruff/
6868
- repo: https://github.com/astral-sh/ruff-pre-commit
69-
rev: v0.13.1
69+
rev: v0.14.0
7070
hooks:
7171
# Run the linter
7272
- id: ruff-check

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Preamble ####################################################################
22
#
33
cmake_minimum_required(VERSION 3.24.0)
4-
project(ImpactX VERSION 25.09)
4+
project(ImpactX VERSION 25.10)
55

66
include(${ImpactX_SOURCE_DIR}/cmake/ImpactXFunctions.cmake)
77

@@ -492,6 +492,13 @@ if(ImpactX_PYTHON)
492492
pyImpactX
493493
${ImpactX_CUSTOM_TARGET_PREFIX}pip_wheel
494494
)
495+
496+
# copy examples into pip package, e.g., for dashboard GUI
497+
add_custom_command(TARGET pyImpactX POST_BUILD
498+
COMMAND ${CMAKE_COMMAND} -E copy_directory
499+
${ImpactX_SOURCE_DIR}/examples
500+
$<TARGET_FILE_DIR:pyImpactX>/examples
501+
)
495502
endif()
496503

497504

cmake/dependencies/ABLASTR.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ macro(find_ablastr)
139139
set(COMPONENT_DIM 3D)
140140
set(COMPONENT_PRECISION ${ImpactX_PRECISION} P${ImpactX_PRECISION})
141141

142-
find_package(ABLASTR 25.09 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
142+
find_package(ABLASTR 25.10 CONFIG REQUIRED COMPONENTS ${COMPONENT_DIM})
143143
message(STATUS "ABLASTR: Found version '${ABLASTR_VERSION}'")
144144
endif()
145145

cmake/dependencies/pyAMReX.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function(find_pyamrex)
5959
endif()
6060
elseif(NOT ImpactX_pyamrex_internal)
6161
# TODO: MPI control
62-
find_package(pyAMReX 25.09 CONFIG REQUIRED)
62+
find_package(pyAMReX 25.10 CONFIG REQUIRED)
6363
message(STATUS "pyAMReX: Found version '${pyAMReX_VERSION}'")
6464
endif()
6565
endfunction()

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def download_with_headers(url, filename):
9696
# built documents.
9797
#
9898
# The short X.Y version.
99-
version = "25.09"
99+
version = "25.10"
100100
# The full version, including alpha/beta/rc tags.
101-
release = "25.09"
101+
release = "25.10"
102102

103103
# The language for content autogenerated by Sphinx. Refer to documentation
104104
# for a list of supported languages.

docs/source/usage/python.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,60 @@ This module provides elements and methods for the accelerator lattice.
637637
:param pals_line: PALS Python Line with beamline elements
638638
:param nslice: number of slices used for the application of collective effects
639639

640+
.. py:method:: select(kind=None, name=None)
641+
642+
Filter elements by type and/or name.
643+
If both are provided, OR-based logic is applied.
644+
645+
Returns references to original elements, allowing modification and chaining.
646+
Chained ``.select(...).select(...)`` selections are AND-filtered.
647+
648+
:param kind: Element type(s) to filter by. Can be a string (e.g., ``"Drift"``), regex pattern (e.g., ``r".*Quad"``), element type (e.g., ``elements.Drift``), or list/tuple of these.
649+
:param name: Element name(s) to filter by. Can be a string, regex pattern, or ``list``/``tuple`` of these.
650+
651+
**Examples:**
652+
653+
.. code-block:: python
654+
655+
# Filter by element type
656+
drift_elements = lattice.select(kind="Drift")
657+
quad_elements = lattice.select(kind=elements.Quad)
658+
659+
# Filter by regex pattern
660+
all_quads = lattice.select(kind=r".*Quad") # matches Quad, ChrQuad, ExactQuad
661+
662+
# Filter by name
663+
specific_elements = lattice.select(name="quad1")
664+
665+
# Chain filters (AND logic)
666+
drift_named_d1 = lattice.select(kind="Drift").select(name="drift1")
667+
668+
# Modify original elements through references
669+
drift_elements[0].ds = 2.0 # modifies original lattice
670+
671+
.. py:method:: get_kinds()
672+
673+
Get all unique element types in the lattice.
674+
675+
:return: List of unique element types (sorted by name)
676+
:rtype: list[type]
677+
678+
.. py:method:: count_by_kind(kind_pattern)
679+
680+
Count elements of a specific kind.
681+
682+
:param kind_pattern: Element kind to count. Can be string (e.g., "Drift"), regex pattern (e.g., r".*Quad"), or element type (e.g., elements.Drift)
683+
:return: Number of elements of the specified kind
684+
:rtype: int
685+
686+
.. py:method:: has_kind(kind_pattern)
687+
688+
Check if list contains elements of a specific kind.
689+
690+
:param kind_pattern: Element kind to check for. Can be string (e.g., "Drift"), regex pattern (e.g., r".*Quad"), or element type (e.g., elements.Drift)
691+
:return: True if at least one element of the specified kind exists
692+
:rtype: bool
693+
640694
.. py:method:: plot_survey(ref=None, ax=None, legend=True, legend_ncols=5)
641695
642696
Plot over s of all elements in the KnownElementsList.

examples/dogleg/README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The final expected dispersion is 267 mm.
1515
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
1616
agree with nominal values.
1717

18-
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
18+
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
1919
agree with nominal values.
2020

2121

@@ -73,7 +73,7 @@ The initial dispersion is taken to be -267 mm.
7373
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
7474
agree with nominal values.
7575

76-
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
76+
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
7777
agree with nominal values.
7878

7979
Run
@@ -128,10 +128,10 @@ The 2.5% energy offset couples through the lattice R16 (dispersion) to result in
128128
In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must
129129
agree with nominal values.
130130

131-
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`\dispersion_x`, and :math:`\dispersion_px` must
131+
In addition, the initial and final values of :math:`\alpha_x`, :math:`\alpha_y`, :math:`\beta_x`, :math:`\beta_y`, :math:`D_x`, and :math:`D_{px}` must
132132
agree with nominal values.
133133

134-
Finally, the values of :math:`\mean_pt`, :math:`\mean_x`, and :math:`\mean_px` must agree with predicted values.
134+
Finally, the values of :math:`\mean_pt`, :math:`\mean_x`, and :math:`\mean_{px}` must agree with predicted values.
135135

136136
Run
137137
---

examples/initialize_from_array/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this example, a custom beam is specified at fixed t, transformed to fixed s,
1919
then loaded in ImpactX.
2020
The custom beam is a ring in x-y,
2121
with radius r=2 mm,
22-
radial width :math:`\sigma_r = 5\ \mu`m;
22+
radial width :math:`\sigma_r = 5\ \mathrm{\mu m}`;
2323
Gaussian in :math:`p_x` and :math:`p_y` with momentum width :math:`\sigma_p=10`;
2424
and chirped in z-pz with bunch length :math:`\sigma_z=1` mm,
2525
mean energy about 10 GeV, 1% uncorrelated energy spread, and z-pz covariance of -0.18.

0 commit comments

Comments
 (0)