Fix PyAPI filter for numpy isinstance bug

This commit is contained in:
Sterling Harper 2015-09-14 20:45:21 -04:00
parent f8bfa401cb
commit ba659b3f0c

View file

@ -7,7 +7,7 @@ import numpy as np
from openmc import Mesh
from openmc.constants import *
from openmc.checkvalue import check_type, check_iterable_type, \
check_greater_than
check_greater_than, _isinstance
class Filter(object):
"""A filter used to constrain a tally to a specific criterion, e.g. only tally
@ -126,7 +126,7 @@ class Filter(object):
raise ValueError(msg)
# If the bin edge is a single value, it is a Cell, Material, etc. ID
if not isinstance(bins, Iterable):
if not _isinstance(bins, Iterable):
bins = [bins]
# If the bins are in a collection, convert it to a list
@ -141,7 +141,7 @@ class Filter(object):
elif self._type in ['energy', 'energyout']:
for edge in bins:
if not isinstance(edge, Real):
if not _isinstance(edge, Real):
msg = 'Unable to add bin edge "{0}" to a "{1}" Filter ' \
'since it is a non-integer or floating point ' \
'value'.format(edge, self.type)
@ -165,7 +165,7 @@ class Filter(object):
msg = 'Unable to add bins "{0}" to a mesh Filter since ' \
'only a single mesh can be used per tally'.format(bins)
raise ValueError(msg)
elif not isinstance(bins[0], Integral):
elif not _isinstance(bins[0], Integral):
msg = 'Unable to add bin "{0}" to mesh Filter since it ' \
'is a non-integer'.format(bins[0])
raise ValueError(msg)