diff --git a/src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py b/src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py index 992699910..3f21c5c62 100644 --- a/src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py +++ b/src/python/impactx/dashboard/Input/distributionParameters/distributionMain.py @@ -40,18 +40,6 @@ state.distributionTypeDisabled = False -parameter_tooltips = { - "beta_x": "Beta function value (unit: meter) in the x dimension, must be a non-zero positive value.", - "beta_y": "Beta function value (unit: meter) in the y dimension, must be a non-zero positive value.", - "beta_t": "Beta function value (unit: meter) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value.", - "emitt_x": "Emittance value (unit: meter times radian) in the x dimension, must be a non-zero positive value.", - "emitt_y": "Emittance value (unit: meter times radian) in the y dimension, must be a non-zero positive value.", - "emitt_t": "Emittance value (unit: meter times radian) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value.", - "alpha_x": "Alpha function value () in the x dimension, default is 0.0.", - "alpha_y": "Alpha function value in the y dimension, default is 0.0.", - "alpha_t": "Alpha function value in the t dimension, default is 0.0.", -} - # ----------------------------------------------------------------------------- # Main Functions # ----------------------------------------------------------------------------- @@ -63,7 +51,6 @@ def populate_distribution_parameters(selectedDistribution): :param selectedDistribution (str): The name of the selected distribution whose parameters need to be populated. """ - if state.selectedDistributionType == "Twiss": sig = inspect.signature(twiss) state.selectedDistributionParameters = [ @@ -76,7 +63,9 @@ def populate_distribution_parameters(selectedDistribution): "parameter_error_message": generalFunctions.validate_against( param.default if param.default != param.empty else None, "float" ), - "parameter_tooltip": parameter_tooltips.get(param.name, "N/A"), + "parameter_tooltip": generalFunctions.parameter_tooltips.get( + param.name, "N/A" + ), "parameter_units": "m" if "beta" in param.name or "emitt" in param.name else "", @@ -99,7 +88,9 @@ def populate_distribution_parameters(selectedDistribution): "parameter_error_message": generalFunctions.validate_against( parameter[1], parameter[2] ), - "parameter_tooltip": parameter_tooltips.get(parameter[0], "N/A"), + "parameter_tooltip": generalFunctions.parameter_tooltips.get( + parameter[0], "N/A" + ), "parameter_units": "m" if "beta" in parameter[0] or "emitt" in parameter[0] else "", diff --git a/src/python/impactx/dashboard/Input/generalFunctions.py b/src/python/impactx/dashboard/Input/generalFunctions.py index db8d21163..8ab54b150 100644 --- a/src/python/impactx/dashboard/Input/generalFunctions.py +++ b/src/python/impactx/dashboard/Input/generalFunctions.py @@ -285,11 +285,24 @@ def convert_to_correct_type(value, desired_type): # Tooltip Comments # ----------------------------------------------------------------------------- - state.particle_shape_tooltip = "Whether to calculate space charge effects." - state.kin_energy_tooltip = "Get reference particle energy (MeV)" - state.charge_qe_tooltip = ( - "Get reference particle charge (positive elementary charge)" - ) - state.npart_tooltip = "TBD" - state.mass_MeV_tooltip = "Get reference particle rest mass (MeV/c^2)" - state.bunch_charge_C_tooltip = "TBD" + parameter_tooltips = { + # Input Parameters + "particle_shape": "Whether to calculate space charge effects.", + "kin_energy": "Get reference particle energy (MeV).", + "charge_qe": "Get reference particle charge (positive elementary charge).", + "npart": "Number of particles to simulate.", + "mass_MeV": "Get reference particle rest mass (MeV/c^2).", + "bunch_charge_C": "Total charge of the particle bunch (Coulombs).", + # Distribution Parameters + "beta_x": "Beta function value (unit: meter) in the x dimension, must be a non-zero positive value.", + "beta_y": "Beta function value (unit: meter) in the y dimension, must be a non-zero positive value.", + "beta_t": "Beta function value (unit: meter) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value.", + "emitt_x": "Emittance value (unit: meter times radian) in the x dimension, must be a non-zero positive value.", + "emitt_y": "Emittance value (unit: meter times radian) in the y dimension, must be a non-zero positive value.", + "emitt_t": "Emittance value (unit: meter times radian) in the t dimension (arrival time differences multiplied by light speed), must be a non-zero positive value.", + "alpha_x": "Alpha function value () in the x dimension, default is 0.0.", + "alpha_y": "Alpha function value in the y dimension, default is 0.0.", + "alpha_t": "Alpha function value in the t dimension, default is 0.0.", + # Lattice Parameters + "nslice": "testing", + } diff --git a/src/python/impactx/dashboard/Input/inputParameters/inputMain.py b/src/python/impactx/dashboard/Input/inputParameters/inputMain.py index 9b3f2a58a..266571a36 100644 --- a/src/python/impactx/dashboard/Input/inputParameters/inputMain.py +++ b/src/python/impactx/dashboard/Input/inputParameters/inputMain.py @@ -80,6 +80,7 @@ def __init__(self): state.bunch_charge_C_validation = [] state.mass_MeV_validation = [] state.charge_qe_validation = [] + state.parameter_tooltips = generalFunctions.parameter_tooltips def card(self): """ @@ -106,7 +107,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ particle_shape_tooltip }}") + html.Span("{{ parameter_tooltips.particle_shape }}") with vuetify.VRow(classes="my-2"): with vuetify.VCol(cols=6, classes="py-0"): with vuetify.VTooltip(bottom=True, nudge_top="10"): @@ -125,7 +126,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ charge_qe_tooltip }}") + html.Span("{{ parameter_tooltips.charge_qe }}") with vuetify.VCol(cols=6, classes="py-0"): with vuetify.VTooltip(bottom=True, nudge_top="10"): with vuetify.Template(v_slot_activator="{ on, attrs }"): @@ -143,7 +144,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ mass_MeV_tooltip }}") + html.Span("{{ parameter_tooltips.mass_MeV }}") with vuetify.VRow(classes="my-0"): with vuetify.VCol(cols=12, classes="py-0"): with vuetify.VTooltip(bottom=True, nudge_top="10"): @@ -161,7 +162,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ npart_tooltip }}") + html.Span("{{ parameter_tooltips.npart }}") with vuetify.VRow(classes="my-2"): with vuetify.VCol(cols=8, classes="py-0"): with vuetify.VTooltip(bottom=True, nudge_top="10"): @@ -179,7 +180,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ kin_energy_tooltip }}") + html.Span("{{ parameter_tooltips.kin_energy }}") with vuetify.VCol(cols=4, classes="py-0"): vuetify.VSelect( v_model=("kin_energy_unit",), @@ -205,7 +206,7 @@ def card(self): v_on="on", v_bind="attrs", ) - html.Span("{{ bunch_charge_C_tooltip }}") + html.Span("{{ parameter_tooltips.bunch_charge_C }}") with vuetify.VCol(cols=4, classes="py-0"): vuetify.VTextField( label="Unit", diff --git a/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py b/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py index f411676ee..15a4f6131 100644 --- a/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py +++ b/src/python/impactx/dashboard/Input/latticeConfiguration/latticeMain.py @@ -37,10 +37,6 @@ state.nsliceDefaultValue = None -parameter_tooltips = { - "nslice": "testing", -} - # ----------------------------------------------------------------------------- # Main Functions # ----------------------------------------------------------------------------- @@ -68,7 +64,9 @@ def add_lattice_element(): "parameter_error_message": generalFunctions.validate_against( parameter[1], parameter[2] ), - "parameter_tooltip": parameter_tooltips.get(parameter[0], "N/A"), + "parameter_tooltip": generalFunctions.parameter_tooltips.get( + parameter[0], "N/A" + ), } for parameter in selectedLatticeParameters ],