-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change distribution default parameters to Twiss in dashboard (#748)
* Updated UI for distributions Twiss is now default, 'Native' changed to 'Quadratic Form' and placed as secondary option * Refactor distribution helper function Helper function moved to distributionFuntions.py, and simplified code structure. no functionality change * Updated docstring/comments * Updated export_template to handle twiss parameters * Add twiss parameter functionality for distribution * Updated functionality to correctly display 'Thermal' distribution parameters Thermal is set to have a single set of parameters - 'k', 'kT', 'kT_halo', 'normali ze', 'normalize_halo', halo' * Add units for beta/emitt
- Loading branch information
Showing
4 changed files
with
124 additions
and
58 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/python/impactx/dashboard/Input/distributionParameters/distributionFunctions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from ...trame_setup import setup_server | ||
|
||
server, state, ctrl = setup_server() | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Functions | ||
# ----------------------------------------------------------------------------- | ||
|
||
|
||
class DistributionFunctions: | ||
""" | ||
Helper functions for the distribution parameters. | ||
""" | ||
|
||
@staticmethod | ||
def convert_distribution_parameters_to_valid_type(): | ||
""" | ||
Helper function to convert user-inputted distribution parameters | ||
from string type to float type. | ||
:return: A dictionary with parameter names as keys and their validated values. | ||
""" | ||
|
||
parameter_input = { | ||
param["parameter_name"]: float(param["parameter_default_value"]) | ||
if param_is_valid | ||
else 0.0 | ||
for param in state.selectedDistributionParameters | ||
if (param_is_valid := param["parameter_error_message"] == []) | ||
} | ||
|
||
return parameter_input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters