From 9f09856e7b5971846f2fbd892d54c63cf8bb32e6 Mon Sep 17 00:00:00 2001 From: lpossner Date: Mon, 22 Jul 2024 22:02:05 +0200 Subject: [PATCH] [MOD] - set fastmat as optional dependency --- doc/requirements.txt | 1 - pygpc/GPC.py | 9 ++++----- pygpc/MEGPC.py | 4 ---- requirements.txt | 1 - 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 856a6d09..235377b7 100755 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,5 @@ scipy>=1.10.0 numpy>=1.24.1 -fastmat>=0.2.post0 scikit-learn>=1.2.0 h5py>=3.7.0 matplotlib>=3.6.3 diff --git a/pygpc/GPC.py b/pygpc/GPC.py index 2a1fb548..7f6e092e 100755 --- a/pygpc/GPC.py +++ b/pygpc/GPC.py @@ -16,11 +16,6 @@ from .Computation import * from .Grid import * -try: - import fastmat as fm -except ImportError: - pass - class GPC(object): """ @@ -1001,6 +996,10 @@ def solve(self, results, gradient_results=None, solver=None, settings=None, matr # Orthogonal Matching Pursuit # ############################### elif solver == 'OMP': + try: + import fastmat as fm + except ImportError: + raise ImportError("Please install the fastmat package to use the OMP solver.") # transform gPC matrix to fastmat format matrix_fm = fm.Matrix(matrix) diff --git a/pygpc/MEGPC.py b/pygpc/MEGPC.py index 9667f7b3..ec3d856e 100755 --- a/pygpc/MEGPC.py +++ b/pygpc/MEGPC.py @@ -19,10 +19,6 @@ from .Grid import * from .SGPC import * -try: - import fastmat as fm -except ImportError: - pass class MEGPC(object): """ diff --git a/requirements.txt b/requirements.txt index 6ad4d61a..ca16f35c 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ scipy>=1.10.0 numpy>=1.24.1,<2.0.0 -fastmat>=0.2.post0 scikit-learn>=1.2.0 h5py>=3.7.0 matplotlib>=3.6.3