dynamicslab / pysindy

A package for the sparse identification of nonlinear dynamical systems from data
https://pysindy.readthedocs.io/en/latest/
Other
1.46k stars 324 forks source link

SINDyPI was added to init. It is not recognizable otherwise #577

Closed heidariarash closed 2 weeks ago

heidariarash commented 4 weeks ago

SINDyPI is not recognizable by following the documenations. I added it to both the init file of the optimizer.py and _init__.py

Jacob-Stevens-Haas commented 2 weeks ago

Can you describe what issue this is supposed to fix? SINDy-PI is already imported in these files if you have the extras for cvxpy available

heidariarash commented 2 weeks ago

Thanks for the comment.

Yes, I didn't realize the import statements in the try-except statement, maybe I should have raised this as an issue, as my colleuge also encountered this problem.

If cvxpy is not installed, SINDyPI won't be imported, and an error showing the SINDyPI module is not available (or not found) will be shown, without any more information. I added SINDyPI import statements manually, and I realized that cvxpy is not installed. Maybe it's better to just add cvxpy as a dependency, or to give a more informative error/warning, by importing SINDy in the beginning (Such as cvxpy not found, some modules such as SINDyPI might not be available).

It would be also beneficial to add this in the documentation for SINDyPI notebook: "Make sure to install cvxpy before running this example". I am not sure if this is mentioned anywhere in the documentation, because I was not able to find it.