From fe67b7d4cda436d3768ffa76739d0455e621540b Mon Sep 17 00:00:00 2001 From: Parthib Roy Date: Fri, 27 Sep 2024 17:48:05 -0700 Subject: [PATCH] Added ref_particle charge & mass as user options in dashboard --- .../plot_PhaseSpaceProjections/phaseSpace.py | 4 +++- .../Input/inputParameters/inputMain.py | 22 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/python/impactx/dashboard/Analyze/plot_PhaseSpaceProjections/phaseSpace.py b/src/python/impactx/dashboard/Analyze/plot_PhaseSpaceProjections/phaseSpace.py index ed027ca71..5421b5c14 100644 --- a/src/python/impactx/dashboard/Analyze/plot_PhaseSpaceProjections/phaseSpace.py +++ b/src/python/impactx/dashboard/Analyze/plot_PhaseSpaceProjections/phaseSpace.py @@ -53,7 +53,9 @@ def run_simulation(): # reference particle pc = sim.particle_container() ref = pc.ref_particle() - ref.set_charge_qe(-1.0).set_mass_MeV(0.510998950).set_kin_energy_MeV(kin_energy_MeV) + ref.set_charge_qe(state.charge_qe).set_mass_MeV(state.mass_MeV).set_kin_energy_MeV( + kin_energy_MeV + ) distribution = distribution_parameters() sim.add_particles(bunch_charge_C, distribution, npart) diff --git a/src/python/impactx/dashboard/Input/inputParameters/inputMain.py b/src/python/impactx/dashboard/Input/inputParameters/inputMain.py index 52e7e63ba..c7f88e1b2 100644 --- a/src/python/impactx/dashboard/Input/inputParameters/inputMain.py +++ b/src/python/impactx/dashboard/Input/inputParameters/inputMain.py @@ -70,6 +70,8 @@ def __init__(self): state.bunch_charge_C = 1.0e-9 state.kin_energy_unit = "MeV" state.old_kin_energy_unit = "MeV" + state.charge_qe = -1.0 + state.mass_MeV = 0.510998950 state.npart_validation = [] state.kin_energy_validation = [] @@ -80,7 +82,7 @@ def card(self): Creates UI content for beam properties. """ - with vuetify.VCard(style="width: 340px; height: 300px"): + with vuetify.VCard(style="width: 340px; height: 350px"): with vuetify.VCardTitle("Input Parameters"): vuetify.VSpacer() vuetify.VIcon( @@ -96,6 +98,24 @@ def card(self): items=([1, 2, 3],), dense=True, ) + + with vuetify.VRow(classes="my-2"): + with vuetify.VCol(cols=6, classes="py-0"): + vuetify.VTextField( + label="Ref. Particle Charge", + v_model=("charge_qe",), + suffix="qe", + type="number", + dense=True, + ) + with vuetify.VCol(cols=6, classes="py-0"): + vuetify.VTextField( + label="Ref. Particle Mass", + v_model=("mass_MeV",), + suffix="MeV", + type="number", + dense=True, + ) with vuetify.VRow(classes="my-0"): with vuetify.VCol(cols=12, classes="py-0"): vuetify.VTextField(