Skip to content

Commit 6818942

Browse files
handichantrynthink
authored andcommitted
Tweak exception handling in run.py
Modify exception handling such that when NaN values are encountered in TSV supporting data files, the simple payback and internal rate of return calculations yield 999 values instead of failing with a LinAlgError exception.
1 parent cfc8679 commit 6818942

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ def metric_update(self, m, life_base, life_meas, scost_base,
11021102
irr_e = npf.irr(cashflows_s_delt + cashflows_e_delt)
11031103
if not math.isfinite(irr_e):
11041104
raise (ValueError)
1105-
except ValueError:
1105+
except (ValueError, LinAlgError):
11061106
irr_e = 999
11071107
try:
11081108
payback_e = self.payback(cashflows_s_delt + cashflows_e_delt)
@@ -1114,7 +1114,7 @@ def metric_update(self, m, life_base, life_meas, scost_base,
11141114
cashflows_s_delt + cashflows_e_delt + cashflows_c_delt)
11151115
if not math.isfinite(irr_ec):
11161116
raise (ValueError)
1117-
except ValueError:
1117+
except (ValueError, LinAlgError):
11181118
irr_ec = 999
11191119
try:
11201120
payback_ec = \

0 commit comments

Comments
 (0)