Python Forum

Full Version: Cycle of numpy variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This script needs refining, at present it outputs a text file which I feed into a Windows cmd shell to create and output files, using an image processing framework (GMIC)
i.e.
import numpy as np

a = np.linspace(1.15,1.79,1008)
b = np.linspace(11,20,1008,dtype=int)
c = np.linspace(0,180,1008)
d = np.linspace(2,22,1008)
e = np.linspace(0.28,0.998,1008)

op = open("aop.txt","w")
for line in range(1008):
    op.write("gmic v -99 div 255 file.png fx_layer_cake_2 4,145,0,40.8965,70.4155,2,2,50,0,0 fx_blur_bloom_glare 2.12,"+
    str(a[line])+","+str(b[line])+",0,4,0,1,"+str(c[line])+","+str(d[line])+","+str(e[line])+
    ",7,0 mul 255 o lby_%04d.png \n" % line)
op.close()

What I require though is for the variables (a,b,c,d & e) to cycle through their ranges every 63 files, and then the parameters should reset to the starting values and on and on throughout the 1008 files. Hope that makes sense.
Thanks a lot.

EDIT: the initial 'file.png' will be replaced in Notepad++ by ascending file numbers (i.e. 0001 - 1008)