Skip to content

Add MagSpec to the simulation/experiment comparison - #26

Merged
RemiLehe merged 6 commits into
BLAST-AI-ML:mainfrom
aeriforme:add_magn_spec
Jul 7, 2025
Merged

Add MagSpec to the simulation/experiment comparison#26
RemiLehe merged 6 commits into
BLAST-AI-ML:mainfrom
aeriforme:add_magn_spec

Conversation

@aeriforme

@aeriforme aeriforme commented Jun 26, 2025

Copy link
Copy Markdown
Collaborator

Include the MagSpec experimental diagnostic (distribution of electrons in energy or in longitudinal momentum) to the training.
Must use Cheetah PR #488.

@aeriforme aeriforme changed the title [WIP] Add MagnSpec to the simulation/experiment comparison Add MagSpec to the simulation/experiment comparison Jul 1, 2025
@aeriforme
aeriforme requested a review from RemiLehe July 1, 2025 17:13
@RemiLehe
RemiLehe merged commit 342b9ef into BLAST-AI-ML:main Jul 7, 2025
1 check passed
@RemiLehe
RemiLehe deleted the add_magn_spec branch July 7, 2025 22:15
aeriforme added a commit that referenced this pull request Jul 8, 2025
* extract magn spec data - first attempt

* train params passed as arguments to initialize the beam, added comments to calculate sim spectrum

* finalize inclusion of MagSpec

* Remove unused file

* Update environment requirement

---------

Co-authored-by: ariannaformenti@lbl.gov <aforment@login32.chn.perlmutter.nersc.gov>
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
RemiLehe added a commit that referenced this pull request Jul 9, 2025
* Add Aline screens

* Use formula for r56 in microns (#18)

* Updates to chicane (angle from R56, angle signs, degrees in ExactSbend)

* Update lattice so that it works with torch

* Add possibility to run lattice with Cheetah linear model (#19)

* Add current-dependence of EMQ quads. (#21)

* Add current-dependence of EMQ quads.

* Separate current dependence for short and long EMQs.

* Minor changes to the code

Update interface

---------

Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>

* Add notebook demonstrating Bayesian optimization with Xopt (#20)

* Add new file for optimization

* Use Xopt for optimization

* Make calculation faster

* Add optimization with prior mean

* Add prior mean

* Add README and environment file

* Update notebook

* Add documentation

* Feed current as input

* Various improvements:
- Use NL model
- Use differentiability in prior
- Better potting

* Fix random seed

* extract magn spec data - first attempt

* train params passed as arguments to initialize the beam, added comments to calculate sim spectrum

* finalize inclusion of MagSpec

* ImpactX: Silent Run

Silent run, holy run. All is calm, all is bright.

* Add Scripts for RL_Controller Development (#15)

* Add gitignore

* Add Scripts for RL Development

* Update environment

* Remove unused files

---------

Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>

* Fix Conda Env (#27)

On Ubuntu 24.04, Conda has issues resolving some of the explicitly
pinned packages. Relaxing them to write a more general environment file
that works better across platforms.

* RL Training: Fix Missing Import

See #30

* Rename `HTUCheetah` to `HTUSimulation`

with new `kwarg` named `code="cheetah"`

* Use SI units for quad magnetic field gradient.

* Modify kicker inputs

* Modify dipole inputs.

* Undo comment hash.

* Notebook containing both Cheetah and ImpactX, draft.

* Update notebook to include additional figures, etc.

* Specify number of macroparticles consistently in both codes.

* Access ImpactX output without going through files.

* RL Training: ImpactX Init

* RL Training: ImpactX Magnet Control

* RL Training: ImpactX Track Particles

* RL Training: Beam Init

* RL Training: get_beam_parameters

* RL Training: get_magnets

* RL Training: get_incoming_parameters

* RL Training: reset_accelerator

* Cleanup unused comment line

Co-authored-by: Chad Mitchell <46825199+cemitch99@users.noreply.github.com>

* Optimize Lattice Files (#38)

This adds two optimizations for the HTU lattice files.

For many workflows, e.g., training, we do not need to
create screens and can save diags/IO time. The new
`get_lattice(..., screens_as_markers=True/False)` option
adds this optimization. By default, screens are `True`,
as before this PR.

For the non-linear maps we use for tracking, we do not need
to apply slicing, since we do not calculate collective effects.
(Sets `nslice=1` for ImpactX.)

* Notebook containing both Cheetah and ImpactX, draft.

* Update notebook to include additional figures, etc.

* Specify number of macroparticles consistently in both codes.

* Add MagSpec to the simulation/experiment comparison (#26)

* extract magn spec data - first attempt

* train params passed as arguments to initialize the beam, added comments to calculate sim spectrum

* finalize inclusion of MagSpec

* Remove unused file

* Update environment requirement

---------

Co-authored-by: ariannaformenti@lbl.gov <aforment@login32.chn.perlmutter.nersc.gov>
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>

* Set manual seed

* add Alines, first attempt

* finalize alines

* Add notebook back

---------

Co-authored-by: Chad Mitchell <ChadMitchell@lbl.gov>
Co-authored-by: Chad Mitchell <46825199+cemitch99@users.noreply.github.com>
Co-authored-by: ariannaformenti@lbl.gov <aforment@login32.chn.perlmutter.nersc.gov>
Co-authored-by: Arianna Formenti <ariannaformenti@lbl.gov>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: dwang2-github <61247286+dwang2-github@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants