show() # <headingcell level=2> # Approximation as Second Order System # <headingcell level=3> # I) Second Order System Parameters from Step Response # <codecell> figure("AOM Response") ax = subplot(111) p.colorcycle(3) p.grey_title("Measured System Step Response") ax.yaxis.set_major_locator(MultipleLocator(0.2)) ax.yaxis.set_minor_locator(MultipleLocator(0.1)) ax.xaxis.set_minor_locator(MultipleLocator(0.25e-6)) ax.xaxis.set_major_locator(MultipleLocator(1e-6)) #fill_between(tDDS, 0.99, 1.01, color = 'grey', alpha = 0.75) amp = linspace(0,1,10) time = linspace(-1.4e-6, 6.4e-6, 10) plot([0.260e-6]*len(amp), amp, '--', lw = 1.5, color = 'grey') plot([0.520e-6]*len(amp), amp, '--', lw = 1.5, color = 'grey') plot([2e-6]*len(amp), amp, '--', lw = 1.5, color = 'grey') plot(time , [1.43]*len(time), '--', lw = 1.5, color = 'grey') grid(True, which = 'both')
for i in arange(0,len_files): x[i], y[i] = array(data[i][:,0]), array(data[i][:,1]) # <codecell> def center(x_values, y_values): y_values = list(y_values) maximum_index = y_values.index(max(y_values)) centerfreq = x_values[maximum_index] return centerfreq # <codecell> figure() subplot(121) p.grey_title("Data on Linear Scale") p.colorcycle(len_files) for i in arange(0, len_files): plot(x[i], y[i], label = str(i)) p.scale_xaxis(subplot(121),1e-6) xlabel(r'Frequency [MHz]') ylabel(r'Amplitude [dB]') subplot(122) p.grey_title("Data on Log Scale") p.colorcycle(len_files) for i in arange(0, len_files): plot(x[i]-center(x[i],y[i]), y[i], label = 'RBW='+str(RBW[i])) xscale("log") xlabel(r'Offset Frequency [Hz]') ylabel(r'Amplitude [dB]')
# <headingcell level=2> # Plot found Files # <codecell> figure(1) p.colorcycle(len_files) for i in arange(0, len_files): plot(x[i], y[i], label = str(i)) i += 1 legend() xlabel("offset frequency [Hz]") ylabel("amplitude [dBm/Hz]") p.grey_title("comparison_step_1_plot_input_data") savefig("comparison_step_1_plot_input_data.png") show() # <headingcell level=2> # Shift to 0 Hz Center # <codecell> def find_center(x_values, y_values): y_values = list(y_values) maximum_index = y_values.index(max(y_values)) centerfreq = x_values[maximum_index] return centerfreq, maximum_index
def Make_Array(xvals, expr, sub): res = [] for xval in xvals: result = real(expr.subs({sub:xval})) res.append(result) return res # <headingcell level=4> # Without Additional Errors # <codecell> figure() p.colorcycle(3) p.grey_title('Variation of the Trapping Frequency with Errors') thetas = linspace(0,pi,100) P = Make_Array(thetas, P0, theta) plot(thetas, array(P)**0.5, lw = 2, label = r'Trapping Frequency for state $|0\rangle$') P = Make_Array(thetas, P1, theta) plot(thetas, array(P)**0.5, '--', lw = 2, label = r'Trapping Frequency for state $|1\rangle$') #ylim(0.86, 1.005) xticks([0,pi/2,pi], ['0', r'$\pi/2$', r'$\pi$']) xlabel(r'Relative Angle $\theta$') ylabel(r'Trapping Frequency in Multiples of $\omega_{trap}$') leg = legend() leg.get_frame().set_alpha(0.4)
x, y, y_lin, start, stop, phi = [0]*n,[0]*n,[0]*n,[0]*n,[0]*n,[0]*n # <codecell> ########## Step 1: plot all found input data ############ figure(1) p.colorcycle(n+1) for i in arange(0,n): plot(p.x[i], p.y[i], label = str(i)) plot(x_res, y_res, label = r"$S_\phi\ [dB rad^2/Hz]$") legend() xlabel("offset frequency [Hz]") ylabel("amplitude [dBm/Hz]") p.grey_title("comparison_step_1_plot_input_data") savefig("comparison_step_1_plot_input_data.png") show() # <codecell> ######### Step 2: find integration limits ############ for i in arange(0,n): ######## on linear range ############# y_lin[i] = [pow(10, element/10.0) for element in p.y[i]] ######## find integration limits ############ start[i] = p.find_nearest(p.x[i], xmin) stop[i] = p.find_nearest(p.x[i], xmax) y_res_lin = [pow(10, element/10.0) for element in y_res]