Created
June 16, 2010 08:22
-
-
Save shhong/440324 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import mod, median | |
from numpy import pi | |
from numpy import vstack, hstack | |
def restrict_phase(theta): | |
return mod(theta+pi, 2*pi)-pi | |
def drmap(i,j, uu): | |
x = restrict_phase(uu[i,1:-1]-uu[j,1:-1]) | |
y = (uu[i,2:]-uu[j,2:]-uu[i,:-2]+uu[j,:-2])/2 | |
ind = x.argsort() | |
# y = y - y.mean() | |
return vstack((x[ind,], y[ind,])) | |
def drmapz(j, uu, z): | |
x = restrict_phase(z[1:-1] - uu[j, 1:-1]) | |
y = (z[2:] - uu[j,2:] - z[:-2]+uu[j,:-2])/2 | |
ind = x.argsort() | |
return vstack((x[ind,], y[ind,])) | |
#z = hstack((drmap(i,236) for i in range(900))) | |
#clf(); plot(z[0,],z[1,],'.'); axis([-pi*1.2, pi*1.2, -2, 2]) | |
def drmap_corrected(i,j, uu, periods): | |
x = restrict_phase(uu[i,1:-1]-uu[j,1:-1]) | |
y = (uu[i,2:]-uu[j,2:]-uu[i,:-2]+uu[j,:-2])/2 | |
ind = x.argsort() | |
y = y - 4*pi*(1/periods[i]-1/periods[j]) | |
return vstack((x[ind,], y[ind,])) | |
def drmap_med(i,j, uu): | |
x = restrict_phase(uu[i,1:-1]-uu[j,1:-1]) | |
y = (uu[i,2:]-uu[j,2:]-uu[i,:-2]+uu[j,:-2])/2 | |
ind = x.argsort() | |
y = y - median(y) | |
return vstack((x[ind,], y[ind,])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment