Skip to main content

Cheetah-specific implementation of LUMEModel classes for virtual accelerators

Project description

lume-cheetah

Cheetah-specific implementation of LUMEModel classes for virtual accelerators

What this package provides

  • CheetahSimulator: wraps a Cheetah accelerator Segment and initial beam distribution.
  • LUMECheetahModel: a LUME action model driven by simulator-backed variables.

Example: implementing a LUMECheetahModel object

import torch
from cheetah.accelerator import Drift, Quadrupole, Segment
from cheetah.particles import ParticleBeam

from lume_cheetah import CheetahSimulator, LUMECheetahModel
from lume_cheetah.actions import CheetahWritableScalarVariable


# 1) Build a Cheetah lattice segment
segment = Segment(
	[
		Quadrupole(name="Q1", length=torch.tensor(0.5), k1=torch.tensor(1.0)),
		Drift(name="D1", length=torch.tensor(1.0)),
	]
)

# 2) Create an initial beam distribution
beam = ParticleBeam.from_twiss(
	beta_x=torch.tensor(1.0),
	beta_y=torch.tensor(1.0),
	num_particles=1000,
	energy=torch.tensor(1e6),
)

# 3) Wrap the segment and beam in a CheetahSimulator
simulator = CheetahSimulator(segment=segment, initial_beam_distribution=beam)

# 4) Define LUME action variables that map to Cheetah element attributes
action_variables = [
	CheetahWritableScalarVariable(
		name="Q1_k1",
		element_name="Q1",
		element_attribute="k1",
	)
]

# 5) Create the LUME model object
model = LUMECheetahModel(simulator=simulator, action_variables=action_variables)

# 6) Use the model API
model.set({"Q1_k1": torch.tensor(2.0)})
current_value = model.get("Q1_k1")
print("Q1.k1 =", current_value)

# Optional: sync model state if the simulator was changed externally
model.update_state()

# Optional: reset simulator + model state to initial conditions
model.reset()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lume_cheetah-0.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lume_cheetah-0.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file lume_cheetah-0.1.0.tar.gz.

File metadata

  • Download URL: lume_cheetah-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lume_cheetah-0.1.0.tar.gz
Algorithm Hash digest
SHA256 520ade89d069790d7a2f164ceb848f6865f17114a759749e5203643f1fab653e
MD5 1b65d88471d3e93d3b039dd53dec1fd0
BLAKE2b-256 d79c269b0e874a7d9ade8e127ae50b358410d0d8da4f6595a2147c100b55f21f

See more details on using hashes here.

File details

Details for the file lume_cheetah-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lume_cheetah-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lume_cheetah-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 178317ff0dff659f0f990038b05ee35d9b232140e345445145c8a8a570f29afe
MD5 f0ac560fa1763209eff3cbe2f4dd8f5f
BLAKE2b-256 e1f661330070073da06569a007edb7eba3149af4233324c53c4a0bdd8773b8b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page