Skip to content

Commit b6c3b77

Browse files
Scipy is an optional requirement
1 parent 97647cd commit b6c3b77

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

pyRDDLGym/core/intervals.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
import traceback
12
import numpy as np
2-
from scipy.special import gamma
3-
import scipy.stats as stats
3+
4+
# try to load scipy
5+
try:
6+
from scipy.special import gamma
7+
import scipy.stats as stats
8+
except Exception:
9+
raise_warning('failed to import scipy: '
10+
'some interval arithmetic operations will fail.', 'red')
11+
traceback.print_exc()
12+
gamma = None
13+
stats = None
414

515
from typing import Dict, Optional, Tuple
616
from enum import Enum
@@ -22,6 +32,7 @@
2232

2333

2434
class IntervalAnalysisStrategy(Enum):
35+
'''Specifies how bounds on random variables should be propagated.'''
2536
SUPPORT = 1
2637
PERCENTILE = 2
2738
MEAN = 3

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ gymnasium
44
numpy>=1.22
55
pygame
66
ply
7-
scipy
87
termcolor

0 commit comments

Comments
 (0)