Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Cycle through Numpy range within another range(?)
This script needs refining, not really a coder so what I have produced so far is quite something for present this script outputs a text file which I feed into a Windows cmd shell to create and output files, using an image processing framework (GMIC)

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,"+
    ",7,0 mul 255 o lby_%04d.png \n" % line)
I'd like to output 1008 image files and in this case the variables (a,b,c,d,e) will obviously extend their ranges throughout all 1008 files.
What I require though is for the variables to cycle through their ranges every 63 files (so the numbers in the np.linspace examples above are wrong atm), and then the variables should return to the starting values and continue again, 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. file_0001.png - file_1008.png)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting Index Error - list index out of range RahulSingh 2 926 Feb-03-2020, 07:17 AM
Last Post: RahulSingh
  pandas.read_sas with chunksize: IndexError list index out of range axelle 0 319 Jan-28-2020, 09:30 AM
Last Post: axelle
  itertuples, datetime, pandas, groupby, in range karlito 0 688 Nov-29-2019, 11:35 AM
Last Post: karlito
  iterate over index and define each range as a day karlito 7 644 Nov-19-2019, 06:37 AM
Last Post: karlito
  numpy.copy / numpy.delete paul18fr 3 716 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 767 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  python range function and data aggregation forestconsulting 2 937 Dec-28-2018, 01:43 PM
Last Post: forestconsulting
  OverflowError: math range error Nick_helps 4 6,863 Jul-29-2018, 11:29 AM
Last Post: wavic
  Finding date count from a list of date range in pandas trillerducas72 0 979 May-24-2018, 02:30 AM
Last Post: trillerducas72
  IndexEroor : index out of range adithyakrish 7 3,270 May-19-2017, 07:34 PM
Last Post: buran

Forum Jump:

Users browsing this thread: 1 Guest(s)