You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Noticed that FragilityFunctionDiscrete can not handle list or array properly as below: a = FragilityFunctionDiscrete(limit_state='slight', imls= [0.0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4], poes = [0.0, 0.771, 0.95, 0.989, 0.997, 0.999, 1., 1.], no_damage_limit=0.05)
It works okay when it takes a single value, but it fails when it takes array and yields a wrong value if it takes a list:
a(0.4) a([0.2, 0.4]) a(numpy.array([0.2, 0.4]))
I changed the code as below to fix the error:
`class FragilityFunctionDiscrete(object):
def __call__(self, iml):
"""
Compute the Probability of Exceedance (PoE) for the given
Intensity Measure Level (IML).
"""
highest_iml = self.imls[-1]
# when the intensity measure level is above
# the range, we use the highest one
try:
iml = [highest_iml if x > highest_iml else x for x in iml]
except TypeError:
temp = self.interp(highest_iml if iml > highest_iml else iml)
else:
temp = self.interp(iml)
if self.no_damage_limit:
temp[iml < self.no_damage_limit] = 0.0
return temp
`
The text was updated successfully, but these errors were encountered:
dynaryu
changed the title
FragilityFunctionDiscrete can not handle list correclty
FragilityFunctionDiscrete can not handle list properly
Oct 10, 2017
Noticed that FragilityFunctionDiscrete can not handle list or array properly as below:
a = FragilityFunctionDiscrete(limit_state='slight',
imls= [0.0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4], poes = [0.0, 0.771, 0.95, 0.989, 0.997, 0.999, 1., 1.], no_damage_limit=0.05)
It works okay when it takes a single value, but it fails when it takes array and yields a wrong value if it takes a list:
a(0.4)
a([0.2, 0.4])
a(numpy.array([0.2, 0.4]))
I changed the code as below to fix the error:
`class FragilityFunctionDiscrete(object):
`
The text was updated successfully, but these errors were encountered: