Commit 9aaba6be authored by Anna Green's avatar Anna Green
Browse files

map images with z-axis scaled by k

parent bfd9402d
import h5py
import numpy as np
import pickle
import os.path
import pylab
import matplotlib
from scipy.interpolate import griddata
from pykat.optics.maps import surfacemap
xi = np.linspace(-0.17, 0.17, 200)
yi = np.linspace(-0.17, 0.17, 200)
mode = 0
####rescaling to [m]/[N] units
E = 72.6e9#Pa = kg/m/s**2
r1 = 0.17#m
r2 = 0.16325#m
A1 = np.pi*r1**2
A2 = r2**2
A = 0.5*(A1 + A2)
d = 0.2#m
kval = E*A/d
####
files = ["./raw/aLIGO_0-47kHz_surface.txt", "./raw/aLIGO_47-60kHz_surface.txt"]
eigenfreqs = np.loadtxt("./raw/aLIGO_eigenmodes.txt", dtype=np.float64)
for f in files:
D = np.loadtxt(f, comments="%")
x,y,z = (D[:, 0], D[:, 1], D[:, 2]) # get x,y,z
U = D[:, 3::3]
for i in range(U.shape[1]):
zi = griddata((y, z), U[:, i],(xi[None,:], xi[:,None]), method='cubic')
zi = np.ma.array (zi, mask=np.isnan(zi))
cmap = matplotlib.cm.jet
cmap.set_bad('w',0.)
fig = pylab.figure(figsize=(7,6))
l = pylab.pcolormesh(xi/1e-2,yi/1e-2,zi/(kval/1e12))
l.set_zorder(100)
l.set_rasterized(True)
pylab.grid(zorder=-100)
pylab.axes().set_aspect('equal', 'datalim')
pylab.xlabel("x [cm]")
pylab.ylabel("y [cm]")
pylab.title("Eigenmode=%i, f=%g [Hz]" % (mode, eigenfreqs[mode]))
cb = pylab.colorbar()
cb.set_label("Surface displacement [pm/N]")
cb.solids.set_rasterized(True)
pylab.tight_layout()
pylab.savefig("./images_kscaled/aligo_mode_%i.pdf" % mode, bbox_inches='tight', dpi=300)
pylab.close()
mode += 1
print(mode)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment