Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cycle of numpy variables
#1
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to fix SyntaxError in cycle try alexfrol86 14 3,139 Mar-27-2022, 07:53 AM
Last Post: stevendaprano
  Trying to cycle through a list of charcters pooky2483 12 4,434 Sep-28-2020, 06:55 AM
Last Post: pooky2483
  <while> cycle is not interrupted when using the <random>module ShityCoder 3 2,154 Sep-04-2020, 04:05 PM
Last Post: ShityCoder
  stop cycle while windows11 1 2,000 May-16-2020, 03:17 PM
Last Post: deanhystad
  Occurrences using FOR and IF cycle P86 2 2,514 Jul-29-2019, 04:37 PM
Last Post: ThomasL
  pool map cycle skorost5 5 3,805 Apr-07-2019, 09:21 AM
Last Post: skorost5
  lifetime cycle counter Ixxxxxx 0 2,483 Mar-07-2018, 07:26 PM
Last Post: Ixxxxxx

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020