Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added export functionality for user inputs in dashboard #719

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

proy30
Copy link
Contributor

@proy30 proy30 commented Sep 28, 2024

Dashboard users can download a Python file containing their simulation inputs.

Verified accuracy by running trial test with FODO example simulation parameters, comparing results against the FODO example Python file.

Resolves #666.

@proy30 proy30 added the component: dashboard our browser based trame dashboard label Sep 28, 2024
@proy30 proy30 changed the title Added export functionality for user inputs in dashboard [Dashboard] Added export functionality for user inputs in dashboard Sep 28, 2024
@proy30 proy30 changed the title [Dashboard] Added export functionality for user inputs in dashboard Added export functionality for user inputs in dashboard Sep 28, 2024
@proy30 proy30 requested a review from ax3l September 28, 2024 01:05
@proy30
Copy link
Contributor Author

proy30 commented Sep 30, 2024

UI - 9/29/24 (Download user inputs icon on top right side of toolbar)
chrome_0GyNphjVoZ

input_simulation.py (what is downloaded to the user):

from impactx import ImpactX, distribution, elements

sim = ImpactX()

sim.particle_shape = 2
sim.space_charge = False
sim.csr = False
sim.slice_step_diagnostics = True

sim.init_grids()

# Initialize particle beam
kin_energy_MeV = 2000.0
bunch_charge_C = 1e-09
npart = 1000

# Reference particle
ref = sim.particle_container().ref_particle()
ref.set_charge_qe(-1.0).set_mass_MeV(0.510998950).set_kin_energy_MeV(kin_energy_MeV)

distr = distribution.Waterbag(
    lambdaX=3.998488477e-05,
    lambdaY=3.998488477e-05,
    lambdaT=0.001,
    lambdaPx=2.662353876e-05,
    lambdaPy=2.662353876e-05,
    lambdaPt=0.002,
    muxpx=-0.846574929020762,
    muypy=0.846574929020762,
    mutpt=0.0,
)
sim.add_particles(bunch_charge_C, distr, npart)

lattice_configuration = [
    elements.Drift(ds=0.25, dx=0, dy=0, rotation=0, nslice=25),
    elements.Quad(ds=1, k=1, dx=0, dy=0, rotation=0, nslice=25),
    elements.Drift(ds=0.5, dx=0, dy=0, rotation=0, nslice=25),
    elements.Quad(ds=1, k=-1, dx=0, dy=0, rotation=0, nslice=25),
    elements.Drift(ds=0.25, dx=0, dy=0, rotation=0, nslice=25)
]
sim.lattice.extend(lattice_configuration)

# Simulate
sim.evolve()

sim.finalize()

@ax3l ax3l self-assigned this Oct 2, 2024
Copy link
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, very nice!

Please don't forget to update the template one you add control for collective effects #690

@ax3l ax3l merged commit 3f26348 into ECP-WarpX:development Oct 2, 2024
16 checks passed
@proy30 proy30 deleted the dashboard/export_inputs branch October 3, 2024 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: dashboard our browser based trame dashboard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dashboard] File exporting for users
2 participants