Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
xhajnal committed Oct 22, 2020
1 parent 5ece8f0 commit 117ce45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 10 additions & 4 deletions src/sample_n_visualise.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:"
Expand All @@ -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)
Expand Down

0 comments on commit 117ce45

Please sign in to comment.