Ejemplo n.º 1
0
files = filter(lambda x : re.match(".*shelf$", x), files)
files = natsort(files)

files = ["4.shelf"]


figure()

gammasextr = np.linspace(1,1.5,1000)
gammasextr = np.linspace(.5,1.5,1000)
if d == 3:
    gammasextr = np.linspace(.7,1.1,1000)

for file in files:
    shelf = shelve.open(str(d) + "D/" + file)
    Cgammaextr = functions.extrap(gammasextr, shelf["gammas"],shelf["Cgamma"])

    # p = polyfit(shelf["gammas"],shelf["Cgamma"], 1)
    # Cgammaextr = polyval(p,gammasextr)
    
    plot(gammasextr,Cgammaextr)
legend(map(lambda s : s.replace(".shelf",""),files))
plot(gammasextr,ones_like(gammasextr), 'k', linewidth=2)

# for file in files:
#     shelf = shelve.open(str(d) + "D/" + file)
#     plot(shelf["gammas"], shelf["Cgamma"], 'kx')

if d == 2:
    xlim((1,1.3))
    ylim((.98,1.02))
Ejemplo n.º 2
0
d = 1
# L = 40
Vinit_size = 1
# N = 10000
q = 1
init = 'gauss'
init = 'prev'
# init = 'prev_scaled'
# init = 'harm'
#init = 'prev'

g = grid.Grid(N,L,d,q)
N = g.N

if init == 'prev':
    Vinit = functions.extrap(g.x, prev_g.x, V)
elif init == 'prev_scaled':
    scaling = 3
    Vinit = np.interp(g.x, prev_g.x*scaling, V,right=0)
elif init == 'gauss':
    Vinit = -np.exp(-np.abs((g.x)/Vinit_size)**2) * (1 + (g.x/Vinit_size)**2 + (g.x/Vinit_size)**4)
    Vinit = -np.exp(-np.abs((g.x)/Vinit_size)**2) * (1)
elif init == 'harm':
    Vinit = (g.x/Vinit_size)**2 - 1
    Vinit[Vinit > 0] = 0
elif init == 'constant':
    Vinit = -np.ones_like(g.x)
elif init == 'linear':
    Vinit = (g.x-L/2)
    Vinit[Vinit > 0] = 0
else:
Ejemplo n.º 3
0
    sys.stdout.close()

bs = np.array([len(eigs) for eigs in eigss])
if any(bs != bs[0]):
    print ""
    print ""
    print "ALERTE, ALERTE, BS ONT CHANGE"
execfile("save_shelf.py")
import os
os.system("mv computation.log " + str(d) + "D/" + str(bs) + ".log")

Cgamma = np.array(Cgamma)

if(len(Cgamma) > 1):
    gammasextr = np.linspace(.7,1.5,100)
    Cgammaextr = functions.extrap(gammasextr, gammas,Cgamma)

    figure()
    plot(gammasextr,Cgammaextr)
    plot(gammas,Cgamma,'x')
    show()

psis = psiss[-1]

prev_g = g


gammasextr = np.linspace(.8,.9,100)
Cgammaextr = functions.extrap(gammasextr, gammas,Cgamma)
figure()
plot(gammasextr,Cgammaextr)