diff --git a/simopt/GUI.py b/simopt/GUI.py index aed104a5..526256d1 100644 --- a/simopt/GUI.py +++ b/simopt/GUI.py @@ -24,6 +24,7 @@ def main() -> None: root = GUIMaster() root.title("SimOpt Library Graphical User Interface") root.pack_propagate(False) + root.tk.call("tk", "scaling", 1.0) # Parse command line log_level = logging.INFO diff --git a/simopt/experiment_base.py b/simopt/experiment_base.py index 9fa1335c..a20c0def 100644 --- a/simopt/experiment_base.py +++ b/simopt/experiment_base.py @@ -202,12 +202,22 @@ def create_design_list_from_table(design_table: DataFrame) -> list[dict[str, Any # Creates dictonary of table to convert values to proper datatypes. dp_dict = design_table.to_dict(orient="list") - # NOTE: the str cast for the factor name shouldn't be necessary, but it tells the - # typing system that the dict keys are definitely strings and not just hashable. - return [ - {str(factor): literal_eval(str(dp_dict[factor][dp])) for factor in dp_dict} - for dp in range(len(design_table)) - ] + # TODO: this is a hack to get the data type of the factors back. + design_list = [] + for dp in range(len(design_table)): + config = {} + for factor in dp_dict: + key = str(factor) + raw_value = str(dp_dict[factor][dp]) + try: + value = literal_eval(raw_value) + except ValueError: + # This exception handles the case where the value is a string. + value = raw_value + config[key] = value + design_list.append(config) + + return design_list def create_design( diff --git a/simopt/gui/main_menu.py b/simopt/gui/main_menu.py index 9c3e3907..62c70423 100644 --- a/simopt/gui/main_menu.py +++ b/simopt/gui/main_menu.py @@ -9,7 +9,7 @@ from simopt.gui.new_experiment_window import NewExperimentWindow from simopt.gui.toplevel_custom import Toplevel -FONT_SCALE: Final[float] = 1.5 +FONT_SCALE: Final[float] = 1 class MainMenuWindow(Toplevel): diff --git a/simopt/gui/new_experiment_window.py b/simopt/gui/new_experiment_window.py index 7b4696ed..e3ff5b73 100644 --- a/simopt/gui/new_experiment_window.py +++ b/simopt/gui/new_experiment_window.py @@ -1647,6 +1647,13 @@ def __show_data_farming_core( for factor in model_specifications: specifications[factor] = model_specifications[factor] # Convert the specifications to a dictionary of DFFactor objects + + # TODO: This is a hack to remove the step_type and search_direction factors + # because str type is not currently supported in the GUI. + if isinstance(base_object, Solver) and base_object.class_name_abbr == "FCSA": + del specifications["step_type"] + del specifications["search_direction"] + self.factor_dict = spec_dict_to_df_dict(specifications) # Add all the column headers @@ -2355,7 +2362,7 @@ def __log_results_gui(self, experiment_name: str) -> None: self.__update_experiment_label(experiment_name, "Logging") # Try to log the experiment try: - self.post_normalize(experiment_name) + self.log_results(experiment_name) # If successful, update the label and button self.__update_experiment_label(experiment_name, "Logged") self.__update_action_button(experiment_name, "All Steps\nComplete") diff --git a/simopt/solvers/fcsa.py b/simopt/solvers/fcsa.py index 81231927..1adbb2be 100644 --- a/simopt/solvers/fcsa.py +++ b/simopt/solvers/fcsa.py @@ -5,7 +5,7 @@ D. J. Eckman, S. G. Henderson, and S. Shashaani """ -from typing import Annotated, ClassVar, Literal +from typing import Annotated, ClassVar import cvxpy as cp import numpy as np @@ -44,7 +44,9 @@ class FCSAConfig(SolverConfig): ), ] step_type: Annotated[ - Literal["const", "decay"], + # TODO: change back when the old GUI is removed + # Literal["const", "decay"], + str, Field(default="const", description="constant or decaying step size?"), ] step_mult: Annotated[ @@ -60,7 +62,9 @@ class FCSAConfig(SolverConfig): Field(default=0.01, ge=0, description="tolerance function"), ] search_direction: Annotated[ - Literal["FCSA", "CSA-N", "CSA"], + # TODO: change back when the old GUI is removed + # Literal["FCSA", "CSA-N", "CSA"], + str, Field( default="FCSA", description=(