Skip to content

Commit

Permalink
Updated functionality to correctly display 'Thermal' distribution par…
Browse files Browse the repository at this point in the history
…ameters

Thermal is set to have a single set of parameters - 'k', 'kT', 'kT_halo', 'normali
ze', 'normalize_halo', halo'
  • Loading branch information
proy30 committed Oct 20, 2024
1 parent b3880f4 commit 6e687d0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
state.selectedDistribution = "Waterbag"
state.selectedDistributionType = "Twiss"
state.selectedDistributionParameters = []
state.distributionTypeDisabled = False

# -----------------------------------------------------------------------------
# Main Functions
Expand All @@ -47,7 +48,7 @@ def populate_distribution_parameters(selectedDistribution):
"""
Populates distribution parameters based on the selected distribution.
:param selectedDistribution (str): The name of the selected distribution
whos parameters need to be populated.
whose parameters need to be populated.
"""

if state.selectedDistributionType == "Twiss":
Expand All @@ -58,7 +59,7 @@ def populate_distribution_parameters(selectedDistribution):
"parameter_default_value": param.default
if param.default != param.empty
else None,
"parameter_type": "float", # Harcoding Twiss to 'float' type.
"parameter_type": "float", # Hardcoding Twiss to 'float' type.
"parameter_error_message": generalFunctions.validate_against(
param.default if param.default != param.empty else None, "float"
),
Expand Down Expand Up @@ -139,6 +140,12 @@ def distribution_parameters():

@state.change("selectedDistribution")
def on_distribution_name_change(selectedDistribution, **kwargs):
if selectedDistribution == "Thermal":
state.selectedDistributionType = "Quadratic Form"
state.distributionTypeDisabled = True
state.dirty("selectedDistributionType")
else:
state.distributionTypeDisabled = False
populate_distribution_parameters(selectedDistribution)


Expand Down Expand Up @@ -195,6 +202,7 @@ def card():
label="Type",
items=(["Twiss", "Quadratic Form"],),
dense=True,
disabled=("distributionTypeDisabled",),
)
with vuetify.VRow(classes="my-2"):
for i in range(3):
Expand Down

0 comments on commit 6e687d0

Please sign in to comment.