The following message is returned.
============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-5.0.1, py-1.8.0, pluggy-0.12.0
rootdir: /home/nguarinz/workspace/simplebendingpractice, inifile: setup.cfg
plugins: cov-2.7.1
collected 18 items
beambending/beam.py ..... [ 27%]
examples/example_1.py F [ 33%]
examples/example_normal0.py . [ 38%]
examples/example_normal1.py . [ 44%]
examples/example_shear0.py . [ 50%]
examples/example_shear1.py F [ 55%]
test/test_beam.py .....FFF [100%]
=================================== FAILURES ===================================
__________________________________ example_1 ___________________________________
def example_1():
"""Run example 1"""
beam = Beam(9) # Initialize a Beam object of length 9m
beam.pinned_support = 2 # x-coordinate of the pinned support
beam.rolling_support = 7 # x-coordinate of the rolling support
beam.add_loads((
PointLoadH(10, 3), # 10kN pointing right, at x=3m
PointLoadV(-20, 3), # 20kN downwards, at x=3m
DistributedLoadV(-10, (3, 9)), # 10 kN/m, downwards, for 3m <= x <= 9m
DistributedLoadV(-20 + x**2, (0, 2)), # variable load, for 0m <= x <= 2m
))
> fig = beam.plot()
examples/example_1.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
beambending/beam.py:224: in plot
self.plot_shear_force(ax3)
beambending/beam.py:264: in plot_shear_force
self._plot_analytical(ax, -1* sum(self._shear_forces), **plot03_params)
beambending/beam.py:297: in _plot_analytical
y_vec = lambdify(x, sym_func, "numpy")(x_vec)
<lambdifygenerated-3>:2: in _lambdifygenerated
return (-select([less(x, 0),True], [0,(1/3)*amin((2,x))**3 - 20*amin((2,x))], default=numpy.nan) - select([less(x, 0),True], [0,10*amin((3,x)) - 10*amin((9,x))], default=numpy.nan) - select([less(x, 2),True], [0,73.0666666666666], default=numpy.nan) - select([less(x, 3),True], [0,-20], default=numpy.nan) - select([less(x, 7),True], [0,44.2666666666667], default=numpy.nan))
<__array_function__ internals>:6: in amin
???
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2746: in amin
keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = (2, array([0.000e+00, 1.000e-03, 2.000e-03, ..., 8.998e+00, 8.999e+00,
9.000e+00]))
ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
passkwargs = {k: v for k, v in kwargs.items()
if v is not np._NoValue}
if type(obj) is not mu.ndarray:
try:
reduction = getattr(obj, method)
except AttributeError:
pass
else:
# This branch is needed for reductions like any which don't
# support a dtype.
if dtype is not None:
return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
else:
return reduction(axis=axis, out=out, **passkwargs)
> return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError
________________________________ example_shear1 ________________________________
def example_shear1():
"""Generate shear force introductory problem schematic"""
my_beam = Beam(6)
my_beam.rolling_support = 0 # x-coordinate of the rolling support
my_beam.pinned_support = 3 # x-coordinate of the pinned support
my_beam.add_loads([PointLoadV(10, 6)]) # 10kN pointing upwards, at x=6m
fig = plt.figure()
my_beam.plot_shear_force(fig.add_subplot(2, 1, 1))
> my_beam.plot_bending_moment(fig.add_subplot(2, 1, 2))
examples/example_shear1.py:17:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
beambending/beam.py:275: in plot_bending_moment
self._plot_analytical(ax, -1* sum(self._bending_moments), **plot04_params)
beambending/beam.py:297: in _plot_analytical
y_vec = lambdify(x, sym_func, "numpy")(x_vec)
<lambdifygenerated-8>:2: in _lambdifygenerated
return (-select([less(x, 0),True], [0,10.0*x], default=numpy.nan) - select([less(x, 0),True], [0,-20.0*x + 20.0*amin((3,x))], default=numpy.nan) - select([less(x, 0),True], [0,10*x - 10*amin((6,x))], default=numpy.nan))
<__array_function__ internals>:6: in amin
???
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2746: in amin
keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = (3, array([0.000e+00, 1.000e-03, 2.000e-03, ..., 5.998e+00, 5.999e+00,
6.000e+00]))
ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
passkwargs = {k: v for k, v in kwargs.items()
if v is not np._NoValue}
if type(obj) is not mu.ndarray:
try:
reduction = getattr(obj, method)
except AttributeError:
pass
else:
# This branch is needed for reductions like any which don't
# support a dtype.
if dtype is not None:
return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
else:
return reduction(axis=axis, out=out, **passkwargs)
> return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError
_____________________ test_beam_normal_forces_are_correct ______________________
def test_beam_normal_forces_are_correct():
with defined_canonical_beam() as (the_beam, x, x_vec):
> normal_force_sample = lambdify(x, sum(the_beam._normal_forces), "numpy")(x_vec)
test/test_beam.py:86:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<lambdifygenerated-10>:2: in _lambdifygenerated
return (-select([less(x, 0),True], [0,2*amin((7,x)) - 2*amin((9,x))], default=numpy.nan) - select([less(x, 2),True], [0,-11.0], default=numpy.nan) - select([less(x, 5),True], [0,15], default=numpy.nan))
<__array_function__ internals>:6: in amin
???
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2746: in amin
keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = (7, array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. ,
6.5, 7. , 7.5, 8. , 8.5, 9. ]))
ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
passkwargs = {k: v for k, v in kwargs.items()
if v is not np._NoValue}
if type(obj) is not mu.ndarray:
try:
reduction = getattr(obj, method)
except AttributeError:
pass
else:
# This branch is needed for reductions like any which don't
# support a dtype.
if dtype is not None:
return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
else:
return reduction(axis=axis, out=out, **passkwargs)
> return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError
______________________ test_beam_shear_forces_are_correct ______________________
def test_beam_shear_forces_are_correct():
with defined_canonical_beam() as (the_beam, x, x_vec):
> shear_force_sample = lambdify(x, sum(the_beam._shear_forces), "numpy")(x_vec)
test/test_beam.py:93:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<lambdifygenerated-11>:2: in _lambdifygenerated
return (select([less(x, 0),True], [0,10*amin((3,x)) - 10*amin((9,x))], default=numpy.nan) + select([less(x, 0),True], [0,-20*amin((2,x))], default=numpy.nan) + select([less(x, 2),True], [0,76.0], default=numpy.nan) + select([less(x, 3),True], [0,-20], default=numpy.nan) + select([less(x, 7),True], [0,44.0], default=numpy.nan))
<__array_function__ internals>:6: in amin
???
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2746: in amin
keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = (3, array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. ,
6.5, 7. , 7.5, 8. , 8.5, 9. ]))
ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
passkwargs = {k: v for k, v in kwargs.items()
if v is not np._NoValue}
if type(obj) is not mu.ndarray:
try:
reduction = getattr(obj, method)
except AttributeError:
pass
else:
# This branch is needed for reductions like any which don't
# support a dtype.
if dtype is not None:
return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
else:
return reduction(axis=axis, out=out, **passkwargs)
> return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError
____________________ test_beam_bending_moments_are_correct _____________________
def test_beam_bending_moments_are_correct():
with defined_canonical_beam() as (the_beam, x, x_vec):
> bending_moment_sample = lambdify(x, sum(the_beam._bending_moments), "numpy")(x_vec)
test/test_beam.py:100:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<lambdifygenerated-12>:2: in _lambdifygenerated
return (select([less(x, 0),True], [0,-20*x + 20*amin((3,x))], default=numpy.nan) + select([less(x, 0),True], [0,44.0*x - 44.0*amin((7,x))], default=numpy.nan) + select([less(x, 0),True], [0,76.0*x - 76.0*amin((2,x))], default=numpy.nan) + select([less(x, 0),True], [0,-40*x - 10*amin((2,x))**2 + 40*amin((2,x))], default=numpy.nan) + select([less(x, 0),True], [0,-60*x + 5*amin((3,x))**2 - 30*amin((3,x)) - 5*amin((9,x))**2 + 90*amin((9,x))], default=numpy.nan))
<__array_function__ internals>:6: in amin
???
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:2746: in amin
keepdims=keepdims, initial=initial, where=where)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = (3, array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5, 5. , 5.5, 6. ,
6.5, 7. , 7.5, 8. , 8.5, 9. ]))
ufunc = <ufunc 'minimum'>, method = 'min', axis = None, dtype = None, out = None
kwargs = {'initial': <no value>, 'keepdims': <no value>, 'where': <no value>}
passkwargs = {}
def _wrapreduction(obj, ufunc, method, axis, dtype, out, **kwargs):
passkwargs = {k: v for k, v in kwargs.items()
if v is not np._NoValue}
if type(obj) is not mu.ndarray:
try:
reduction = getattr(obj, method)
except AttributeError:
pass
else:
# This branch is needed for reductions like any which don't
# support a dtype.
if dtype is not None:
return reduction(axis=axis, dtype=dtype, out=out, **passkwargs)
else:
return reduction(axis=axis, out=out, **passkwargs)
> return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
E ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
../../.local/lib/python3.7/site-packages/numpy/core/fromnumeric.py:90: ValueError
===================== 5 failed, 13 passed in 26.34 seconds =====================