Skip to content

Commit

Permalink
remove isfloat
Browse files Browse the repository at this point in the history
  • Loading branch information
roussel-ryan committed Feb 11, 2025
1 parent 80a0d39 commit b32e129
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"xopt"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
11 changes: 5 additions & 6 deletions xopt/generators/ga/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import numpy as np
import pandas as pd
from IPython.core.display_functions import display
from fastnumbers import isfloat
from matplotlib.backend_bases import MouseButton
from scipy.optimize import curve_fit

Expand Down Expand Up @@ -745,7 +744,7 @@ def save_best_of_SIRS(self, click):
pop_filenames = list(self.file_select.value)

if self.best_n_checkbox.value:
if isfloat(self.best_n_value.value):
if isinstance(self.best_n_value.value, float):
best_n = int(np.ceil(float(self.best_n_value.value)))
for ii, pop in enumerate(self.pop_list):
if best_n == len(pop):
Expand Down Expand Up @@ -899,7 +898,7 @@ def make_plot(self):
if ii == 0:
line_alpha = 1.0
else:
if isfloat(self.color_fading_alpha.value):
if isinstance(self.color_fading_alpha.value, float):
line_alpha = float(self.color_fading_alpha.value)
line_alpha = np.min([np.max([0.001, line_alpha]), 1.0])
else:
Expand All @@ -922,12 +921,12 @@ def make_plot(self):
n1 = float(self.cheb_value.value)
n2 = float(self.cheb_value2.value)

if isfloat(n1):
if isinstance(n1, float):
n1_cheb = int(np.min([5, np.max([0, n1])]))
else:
n1_cheb = int(0)

if isfloat(n2):
if isinstance(n2, float):
n2_cheb = int(np.min([5, np.max([0, n2])]))
else:
n2_cheb = int(0)
Expand Down Expand Up @@ -1061,7 +1060,7 @@ def show_settings(self, change):

def edit_settings_to_run(self, change):
if type(self.settings[self.settings_menu.value]) is not str:
if isfloat(self.settings_value.value):
if isinstance(self.settings_value.value, float):
self.run_settings[self.settings_menu.value] = float(
self.settings_value.value
)
Expand Down

0 comments on commit b32e129

Please sign in to comment.