Jul-25-2021, 07:15 PM
Occasional numpy user here, the following example may help
>>> import numpy as np >>> t = np.linspace(0, 12, 30) >>> t array([ 0. , 0.4137931 , 0.82758621, 1.24137931, 1.65517241, 2.06896552, 2.48275862, 2.89655172, 3.31034483, 3.72413793, 4.13793103, 4.55172414, 4.96551724, 5.37931034, 5.79310345, 6.20689655, 6.62068966, 7.03448276, 7.44827586, 7.86206897, 8.27586207, 8.68965517, 9.10344828, 9.51724138, 9.93103448, 10.34482759, 10.75862069, 11.17241379, 11.5862069 , 12. ]) >>> np.where(np.logical_and(0 < t, t < 1), 150.0, 0.0) + np.where(np.logical_and(10.0 < t, t < 11.0), 50.0, 0.0) array([ 0., 150., 150., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 50., 50., 0., 0., 0.])