Skip to content

Commit df0844b

Browse files
authored
Merge pull request #167 from desy-ml/rename-converters
Rename converter modules
2 parents f480224 + 4e1ac9c commit df0844b

15 files changed

+29
-34
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Update versions in pre-commit config (see #148) (@jank324)
2424
- Split `accelerator` and `beam` into separate submodules (see #158) (@jank324)
2525
- Update reference from arXiv preprint to PRAB publication (see #166) (@jank324)
26+
- Rename converter modules to the respective name of the accelerator code (see #167) (@jank324)
2627

2728
## [v0.6.3](https://github.com/desy-ml/cheetah/releases/tag/v0.6.3) (2024-03-28)
2829

cheetah/accelerator/segment.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from scipy.constants import physical_constants
1010
from torch import Size, nn
1111

12-
from cheetah.converters.dontbmad import convert_bmad_lattice
12+
from cheetah.converters.bmad import convert_bmad_lattice
1313
from cheetah.converters.nxtables import read_nx_tables
1414
from cheetah.latticejson import load_cheetah_model, save_cheetah_model
1515
from cheetah.particles import Beam, ParticleBeam
@@ -273,7 +273,7 @@ def from_ocelot(
273273
Cheetah or converted with potentially unexpected behavior.
274274
:return: Cheetah segment closely resembling the Ocelot cell.
275275
"""
276-
from cheetah.converters.nocelot import ocelot2cheetah
276+
from cheetah.converters.ocelot import ocelot2cheetah
277277

278278
converted = [
279279
ocelot2cheetah(element, warnings=warnings, device=device, dtype=dtype)

cheetah/converters/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# flake8: noqa
2-
from cheetah.converters import astralavista, dontbmad, nocelot, nxtables
2+
from cheetah.converters import astra, bmad, nxtables, ocelot
File renamed without changes.
File renamed without changes.
File renamed without changes.

cheetah/particles/parameter_beam.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def from_ocelot(cls, parray, device=None, dtype=torch.float32) -> "ParameterBeam
256256
@classmethod
257257
def from_astra(cls, path: str, device=None, dtype=torch.float32) -> "ParameterBeam":
258258
"""Load an Astra particle distribution as a Cheetah Beam."""
259-
from cheetah.converters.astralavista import from_astrabeam
259+
from cheetah.converters.astra import from_astrabeam
260260

261261
particles, energy, particle_charges = from_astrabeam(path)
262262
mu = torch.ones(7)

cheetah/particles/particle_beam.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def from_ocelot(cls, parray, device=None, dtype=torch.float32) -> "ParticleBeam"
571571
@classmethod
572572
def from_astra(cls, path: str, device=None, dtype=torch.float32) -> "ParticleBeam":
573573
"""Load an Astra particle distribution as a Cheetah Beam."""
574-
from cheetah.converters.astralavista import from_astrabeam
574+
from cheetah.converters.astra import from_astrabeam
575575

576576
particles, energy, particle_charges = from_astrabeam(path)
577577
particles_7d = torch.ones((particles.shape[0], 7))

docs/astralavista.rst

-8
This file was deleted.

docs/converters.rst

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. Documents converters
2+
3+
Converters
4+
==========
5+
6+
.. automodule:: converters.astra
7+
:members:
8+
:undoc-members:
9+
10+
.. automodule:: converters.bmad
11+
:members:
12+
:undoc-members:
13+
14+
.. automodule:: converters.nxtables
15+
:members:
16+
:undoc-members:
17+
18+
.. automodule:: converters.ocelot
19+
:members:
20+
:undoc-members:

docs/dontbmad.rst

-8
This file was deleted.

docs/index.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ For more advanced usage, please refer to the in-depth documentation.
4848
:caption: Documentation
4949

5050
accelerator
51-
astralavista
52-
dontbmad
51+
converters
5352
error
5453
latticejson
55-
nocelot
5654
particles
5755
track_methods
5856
utils

docs/nocelot.rst

-8
This file was deleted.

tests/test_compare_ocelot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_ares_ea():
256256
Test that the tracking results through a Experimental Area (EA) lattice of the ARES
257257
accelerator at DESY match those using Ocelot.
258258
"""
259-
cell = cheetah.converters.nocelot.subcell_of_ocelot(
259+
cell = cheetah.converters.ocelot.subcell_of_ocelot(
260260
ares.cell, "AREASOLA1", "AREABSCR1"
261261
)
262262
ares.areamqzm1.k1 = 5.0

tests/test_speed.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# TODO: Test that Cheeath tracks faster than Ocelot
1111
def test_tracking_speed():
1212
"""Really only tests that Cheetah isn't super slow."""
13-
cell = cheetah.converters.nocelot.subcell_of_ocelot(
13+
cell = cheetah.converters.ocelot.subcell_of_ocelot(
1414
ares.cell, "AREASOLA1", "AREABSCR1"
1515
)
1616
segment = cheetah.Segment.from_ocelot(cell)

0 commit comments

Comments
 (0)