Skip to content

Commit

Permalink
Fixed the nest conditionals in pysindy file
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Kaptanoglu authored and Alan Kaptanoglu committed Oct 5, 2022
1 parent a6e3903 commit 8bfa8a0
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions pysindy/pysindy.py
Expand Up @@ -26,7 +26,6 @@
sindy_pi_flag = True
except ImportError:
sindy_pi_flag = False
pass
from .optimizers import STLSQ
from .utils import AxesArray
from .utils import comprehend_axes
Expand Down Expand Up @@ -526,28 +525,21 @@ def print(self, lhs=None, precision=3):
Precision to be used when printing out model coefficients.
"""
eqns = self.equations(precision)
if sindy_pi_flag:
if isinstance(self.optimizer, SINDyPI):
feature_names = self.get_feature_names()
else:
feature_names = self.feature_names
if sindy_pi_flag and isinstance(self.optimizer, SINDyPI):
feature_names = self.get_feature_names()
else:
feature_names = self.feature_names
for i, eqn in enumerate(eqns):
if self.discrete_time:
names = "(" + feature_names[i] + ")"
print(names + "[k+1] = " + eqn)
elif lhs is None:
if sindy_pi_flag:
if not isinstance(self.optimizer, SINDyPI):
names = "(" + feature_names[i] + ")"
print(names + "' = " + eqn)
else:
names = feature_names[i]
print(names + " = " + eqn)
else:
if not sindy_pi_flag or not isinstance(self.optimizer, SINDyPI):
names = "(" + feature_names[i] + ")"
print(names + "' = " + eqn)
else:
names = feature_names[i]
print(names + " = " + eqn)
else:
print(lhs[i] + " = " + eqn)

Expand Down

0 comments on commit 8bfa8a0

Please sign in to comment.