Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Numpy slicing problem
#4
Pi is a red-herring here I'm afraid!! It's an arbitrary value, I could have divided by 5 or 10 or anythibg but chose pi for no particular reason...

Well, I managed to get somewhere with my code, thanks for your help..  I used np.clip in the end to help acheive the results I desired.

(Even though in the example given, no values of e are over 360, I checked with different array parameters and the code I used (below) clamps the result to 360 or below.)
Thanks again Ofnuts !!


Code:
import numpy as np

a  = np.concatenate((np.linspace(13.76,239.04,100),np.geomspace(239.04,360,100)))
b  = np.concatenate((np.linspace(20.16,-184.32,100),np.linspace(-184.32,229.68,100)))

e = np.clip((np.linspace(a[0]+b[0],a[-1]+b[-1],200)/np.pi),-360,360)

f = open("newl.txt","w")
for i in range(200):
   f.write("gmic v -99 rund.png mercator "+str(a[i])+","+str(b[i])+","+str(e[i])+",0,85 resize 1280,720 normalize 0,255 o merc_%04d.png \n" % i)
f.close()
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: