In [1]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import sys
sys.path.append("..")
import splitwavepy as sw
import numpy as np
import matplotlib.pyplot as plt
In [2]:
def splittingintensity(rdiff,trans):
"""
Calculate splitting intensity.
"""
s = -2 * np.trapz(trans * rdiff) / np.trapz(rdiff**2)
return s
In [17]:
a = sw.Pair(delta=0.05)
In [18]:
a.plot()
In [19]:
rdiff = np.gradient(a.x)
trans = a.y
print(splittingintensity(rdiff,trans))
In [32]:
split=(0,4)
p = []
s = []
for pol in np.arange(0,365,5):
data = sw.Pair(split=split,pol=pol,noise=0.01,delta=0.05)
data.rotateto(pol)
rdiff = np.gradient(data.x)
trans = data.y
p.append(pol)
s.append(splittingintensity(rdiff,trans))
plt.plot(p,s)
Out[32]:
In [7]:
data = sw.Pair(split=split,pol=45,noise=0.01,delta=0.05)
data.plot()
In [25]:
def dft(k,s,p):
const = 2 * np.pi * 1j / 360
return np.sum([ a * np.exp(const * k * b) for a,b in zip(s,p) ])
def h(k,s,p):
n = len(p)
return 2 * np.abs(dft(k,s,p)) / n
In [26]:
h(1,s,p)
Out[26]:
In [20]:
[ print(a,b) for a,b in zip(s,p) ]
Out[20]:
In [ ]: