Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Numpy slicing problem
#3
Strange way to use numpy. The whole point of numpy is do add vectors in one operation, so you can compute an intermediate vector that holds your c and d values using;
Code:
# The vector of the sums:
a+b
# The vector of the sum, clamped at 360:
np.minimum(a+b,360)
# The vector of the sums, clamped and in radians
result=np.minimum(a+b,360)/np.pi

The strange thing in your code is that when you do
Code:
c = a[0]+(b[0])/np.pi


Only the b[0] part is divided by np.pi, which looks odd, and the parentheses around the (b[0]) don't serve any purpose. So I assume you meant:

Code:
c = (a[0]+b[0])/np.pi


Since you have values up to 360, I assume you are trying to cover a full circle so, you may want to divide by 2*np.pi if you really want a value in radians, because a full circle is 2×π

Then I don't really understand what you do with e (linear sample between two values with an interval of 4?)? And what happens when i>=7?
Reply


Messages In This Thread
Numpy slicing problem - by Zero01 - 07-18-2021, 04:21 PM
RE: Numpy slicing problem - by Zero01 - 07-18-2021, 06:38 PM
RE: Numpy slicing problem - by Ofnuts - 07-18-2021, 08:02 PM
RE: Numpy slicing problem - by Zero01 - 07-19-2021, 07:31 AM

Forum Jump: