From 117ce45f743ace98c26ceacba51a624f4f846d80 Mon Sep 17 00:00:00 2001 From: Matej Hajnal Date: Fri, 23 Oct 2020 01:21:04 +0200 Subject: [PATCH] minor tweaks --- src/gui.py | 4 ++++ src/sample_n_visualise.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/gui.py b/src/gui.py index cbe82b7..cd68879 100755 --- a/src/gui.py +++ b/src/gui.py @@ -3348,6 +3348,10 @@ def refine_space(self): messagebox.showwarning("Refine space", "No sampling to be used, please run it before Presampled refinement.") return + if int(self.max_depth) > 14: + if not askyesno("Space refinement", "Recursion this deep may cause segmentation fault. Do you want to continue?"): + return + self.status_set("Space refinement is running ...") # print(colored(f"self.space, {self.space.nice_print()}]", "blue")) try: diff --git a/src/sample_n_visualise.py b/src/sample_n_visualise.py index 75b16be..c5af50c 100644 --- a/src/sample_n_visualise.py +++ b/src/sample_n_visualise.py @@ -93,10 +93,6 @@ def eval_and_show(functions, parameter_value, parameters=False, data=False, data debug (bool): if debug extensive output is provided where (tuple or list): output matplotlib sources to output created figure """ - ## Uniformize the intervals - if data_intervals: - data_intervals = to_sympy_intervals(data_intervals) - ## Convert z3 functions for index, function in enumerate(functions): if is_this_z3_function(function): @@ -111,6 +107,9 @@ def eval_and_show(functions, parameter_value, parameters=False, data=False, data print("Parameters: ", parameters) if data: + ## Check the sizes of data and functions + if len(data) != len(functions): + raise Exception(f"Number of data points, {len(data)}, is not equal to number of functions, {len(functions)}.") title = "Rational functions and data \n Parameter values:" else: title = "Rational functions \n Parameter values:" @@ -124,6 +123,13 @@ def eval_and_show(functions, parameter_value, parameters=False, data=False, data title = f"{title} {parameters[param]}={parameter_value[param]}," title = title[:-1] + if data_intervals: + ## Check the sizes of data and functions + if len(data_intervals) != len(functions): + raise Exception(f"Number of data intervals, {len(data_intervals)}, is not equal to number of functions, {len(functions)}.") + ## Uniformize the intervals + data_intervals = to_sympy_intervals(data_intervals) + title = f"{title}\n Function values: " for function in functions: expression = eval(function)