Commit 6710fb13c2f9cc4cf72e60f353597bdbb141578e
1 parent
5aa6adb3
if model = 0 error on residual for SUBDIV and SUBDIVSQRT set to 0
Showing
1 changed file
with
8 additions
and
2 deletions
examples/show_residuals.py
| ... | ... | @@ -114,9 +114,15 @@ def fill_cmr(row, counts, model, resid, e_counts, e_resid, c_counts, c_model, |
| 114 | 114 | if algorithm == 'SUB': |
| 115 | 115 | e_resid.append(err) |
| 116 | 116 | elif algorithm == 'SUBDIV': |
| 117 | - e_resid.append(err / c_model.real(row)) | |
| 117 | + if c_model.real(row) > 0.: | |
| 118 | + e_resid.append(err / c_model.real(row)) | |
| 119 | + else: | |
| 120 | + e_resid.append(0.) | |
| 118 | 121 | elif algorithm == 'SUBDIVSQRT': |
| 119 | - e_resid.append(err / math.sqrt(c_model.real(row))) | |
| 122 | + if c_model.real(row) > 0.: | |
| 123 | + e_resid.append(err / math.sqrt(c_model.real(row))) | |
| 124 | + else: | |
| 125 | + e_resid.append(0.) | |
| 120 | 126 | elif algorithm == 'SIGNIFICANCE': |
| 121 | 127 | e_resid.append(1.0) |
| 122 | 128 | else: | ... | ... |