In [6]:
%matplotlib inline
In [77]:
import optoanalysis as oa
import numpy as np
import matplotlib.pyplot as plt
import scipy.constants
In [3]:
data = oa.load_data("testData.raw")
In [8]:
data.get_fit_auto?
In [9]:
w0, A, G, _, _ = data.get_fit_auto(70e3)
In [26]:
f = (w0.n/(2*np.pi))
f2 = 2*(w0.n/(2*np.pi))
data.plot_PSD([f2/1e3-10, f2/1e3+10])
Out[26]:
In [27]:
w20, A2, G2, _, _ = data.get_fit_auto(f2)
In [43]:
z = oa.butterworth_filter(data.voltage[::2], data.SampleFreq/2, f-10e3, f+10e3)
z2 = oa.butterworth_filter(data.voltage[::2], data.SampleFreq/2, f2-10e3, f2+10e3)
In [44]:
print(len(data.time), len(z), len(z2))
In [46]:
plt.plot(data.time.get_array()[0:5000], z[0:5000])
plt.plot(data.time.get_array()[0:5000], z2[0:5000])
Out[46]:
In [55]:
s = 20*np.sin(np.arange(0, 100, 0.01))
In [56]:
np.sqrt(2*np.mean(s**2))
Out[56]:
In [57]:
def MeanAmp(signal):
return np.sqrt(2*np.mean(signal**2))
In [63]:
V1 = MeanAmp(z)
In [62]:
V2 = MeanAmp(z2)
In [102]:
r = V2/V1
In [103]:
beta = 4*r
In [104]:
k0 = (2*np.pi)/(1550e-9)
In [181]:
NA = 0.999
WaistSize = 1550e-9/(np.pi*NA)
Zr = np.pi*WaistSize**2/1550e-9
In [182]:
z0 = beta/(k0 - 1/Zr)
In [183]:
ConvFactor = V1/z0
In [184]:
ConvFactor
Out[184]:
In [185]:
mFromA = 2*scipy.constants.Boltzmann*300/(np.pi*A) * ConvFactor**2 * G
In [186]:
mFromEquipartition = scipy.constants.Boltzmann*300/(w0**2 * z0**2)
In [187]:
mFromA
Out[187]:
In [188]:
mFromEquipartition
Out[188]:
In [189]:
def CalcR(Mass):
density = 1800
Radius = (3*Mass/(4*np.pi*density))**(1/3)
return Radius
In [190]:
CalcR(mFromA)*1e9
Out[190]:
In [191]:
CalcR(mFromEquipartition)*1e9
Out[191]:
In [192]:
0.05**0.5
Out[192]:
$(stdDev/mean)^2 <= 0.05$
$stdDev/mean <= 0.22$
$stdDev <= 0.22*mean$
In [206]:
0.05**2*50
Out[206]:
In [ ]: