Example #1
0
import sys, shelve
sys.path.append("/home/ralph/thesis/pga/chaos_control_ga")

import maps, metrics, misc
from random import random
from math import tanh

# Python Image Library
from PIL import Image


start1, stop1, step1, start2, stop2, step2, input_len = \
        [float(ele) for ele in sys.argv[1:]]
input_len = int(input_len)
res1 = misc.arange(start1, stop1, step1)
res2 = misc.arange(start2, stop2, step2)
l1 = len(res1)
l2 = len(res2)

print l1, "by", l2, "is", l1*l2

name = "exhaustive-(" + str(input_len) + \
        ").dim." + str(l1) + "x" + str(l2) + "." + \
        str(start1) + ".to." + str(stop1) + \
        ".step_is." + str(step1) + ".and." + \
        str(start2) + ".to." + str(stop2) + ".step_is." + str(step2)

print "Working with", name + ".*"

n = Image.open(name + ".jpg")
Example #2
0
if len(sys.argv) != 3:
    print "Invalid number of arguments."
    print "./pop_lyapunov.py <ID> <size>"
    sys.exit(0)
ID = sys.argv[1]
size = sys.argv[2]

#The hero!
o = shelve.open("../dat/"+ID+"/"+ID+".2999.pop")['pop'][0]
if size == 'local':
    step = 0.000000001
    # Increase back up to 1000
    start = o['amplitude'] - step*1000
    stop = o['amplitude'] + step*1000
elif size == 'global':
    start = 0
    step = 0.000001
    stop = 0.03
else:
    raise ValueError, "wtf!"
input = o['org']

for amplitude in misc.arange(start, stop+step, step):
    lyaps = [metrics._lyapunov( input,
                                maps.network,
                                [random(), random()],
                                amplitude)
                                    for i in range(10)]
    print amplitude, sum(lyaps)/float(len(lyaps))

#!/usr/bin/python

import sys, shelve
sys.path.append("/home/ralph/thesis/pga/chaos_control_ga")

import maps, metrics, misc
from random import random

# Python Image Library
from PIL import Image

start, stop, step = [float(ele) for ele in sys.argv[1:]]

res = misc.arange(start, stop, step)
l = len(res)
print len(res), "is len(res). ", len(res)**2, "is len(res)**2."
n = Image.new('RGB', (len(res), len(res) / 2.0 ))
d = shelve.open("vals-" + str(l) + "x" + str(l/2.0) + ".shelf")
if 'vals' in d:
    vals = d['vals']
    print "Awesome!  Skipping calc."
else:
    vals = [ [0 for j in range(len(res))] for i in range(len(res)) ]
    for i in range(len(res)):
        done = 100 * i / float(len(res))
        print "\rDone:  %%%f.  i=%i of %i." % (done, i, len(res)),
        sys.stdout.flush()

        for j in range(len(res) / 2.0 ):
            x, y = res[i], res[j]
Example #4
0
#!/usr/bin/python

import sys, shelve
sys.path.append("/home/ralph/thesis/pga/chaos_control_ga")

from fourier import ifft as idct

import maps, metrics, misc
from random import random
from math import cos, sin


for r in misc.arange(0,2,0.5):
    for theta in misc.arange(0,2*3.14, 0.1):
        x = r * cos(theta)
        y = r * sin(theta)
        x,y = [ele.real for ele in idct([x,y])]
        print x,y