[Yt-svn] yt: Adding double-check for bin_id in FIT_get_value.

hg at spacepope.org hg at spacepope.org
Wed Feb 2 10:23:36 PST 2011


hg Repository: yt
details:   yt/rev/8aa4415984d8
changeset: 3705:8aa4415984d8
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Feb 02 13:22:45 2011 -0500
description:
Adding double-check for bin_id in FIT_get_value.

diffstat:

 yt/utilities/_amr_utils/VolumeIntegrator.pyx |  1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diffs (11 lines):

diff -r 67ca50b0cc59 -r 8aa4415984d8 yt/utilities/_amr_utils/VolumeIntegrator.pyx
--- a/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Tue Feb 01 22:35:44 2011 -0500
+++ b/yt/utilities/_amr_utils/VolumeIntegrator.pyx	Wed Feb 02 13:22:45 2011 -0500
@@ -131,6 +131,7 @@
     if fit.pass_through == 1: return dvs[fit.field_id]
     if dvs[fit.field_id] > fit.bounds[1] or dvs[fit.field_id] < fit.bounds[0]: return 0.0
     bin_id = <int> ((dvs[fit.field_id] - fit.bounds[0]) * fit.idbin)
+    if bin_id < 0 or bin_id + 2 > fit.nbins: return 0.0
     dd = dvs[fit.field_id] - (fit.bounds[0] + bin_id * fit.dbin) # x - x0
     bv = fit.values[bin_id]
     dy = fit.values[bin_id + 1] - bv



More information about the yt-svn mailing list