Commit 405c667a authored by Marcelo Luda's avatar Marcelo Luda

intentos de ajuste de 3 iones

parent 9f5a811c
......@@ -300,6 +300,9 @@ alpha = 0
voltages_dcA = Voltages[0][SelectedCurveVec]
def hiperbola(x,a,y0,b,x0):
......@@ -441,14 +444,14 @@ x_hip = np.linspace(-0.23,0.005,200)
ax = ax_central
ax.errorbar(voltages_dcA[I],Betas_vec[I],yerr=ErrorBetas_vec[I],fmt='o',
capsize=4,markersize=3,color='C3', label=r'fitted $\beta$')
ax.plot(x_hip,hiperbola(xhip,*popthip),color='C0', label=r'hyperbola model')
ax.plot(x_hip,hiperbola(x_hip,*param),color='C0', label=r'hyperbola model')
ax.set_ylabel(r'Modulation factor $\beta$', labelpad=-5)
ax.set_ylim(-0.05,3)
ax.set_xlim(-0.22,0)
ax.set_title(f'(g)', x=0.95, y=0.006, color='gray')
ax = ax_res
ax.errorbar(voltages_dcA[I],Betas_vec[I]-hiperbola(voltages_dcA[I],*popthip),
ax.errorbar(voltages_dcA[I],Betas_vec[I]-hiperbola(voltages_dcA[I],*param),
yerr=ErrorBetas_vec[I],fmt='o',capsize=4,markersize=3,color='C3')
ax.axhline( 0 , color='C0')
ax.set_ylabel('Res.', labelpad=-5)
......@@ -479,9 +482,9 @@ for jj,ax in zip(selection,axes_vec):
# Leyenda ##############################
h1, l1 = ax_central.get_legend_handles_labels()
h2, l2 = axx[0,0].get_legend_handles_labels()
ax_central.legend(h1+h2, l1+l2, loc='upper left')
# h1, l1 = ax_central.get_legend_handles_labels()
# h2, l2 = axx[0,0].get_legend_handles_labels()
# ax_central.legend(h1+h2, l1+l2, loc='upper left')
......@@ -495,7 +498,7 @@ fig.savefig('grafico_central_opcion_A.pdf')
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#%% Gráfico central OPCION A
#%% Gráfico central OPCION B
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 8})
......@@ -533,7 +536,7 @@ gs2 = gridspec.GridSpec(4,3, width_ratios=width_ratios,left=0.16,right=0.9,botto
ax_central = fig.add_subplot(gs2[1:-1, 1])
ax_dib = fig.add_subplot(gs2[0, 1])
ax_dib = fig.add_subplot(gs2[0, 1], sharex=ax_res)
ax_dib.spines[:].set_visible(False)
ax_dib.xaxis.set_tick_params(labelbottom=False)
ax_dib.yaxis.set_tick_params(labelleft=False)
......@@ -560,12 +563,29 @@ tmp_datos=(Detuningsshort_vec[selection,:],
np.array(selection)+1,
axes_vec,'abcfed')
from scipy.signal import savgol_filter as savgol
for Detunings_3_SA_short,CountsDR,Detunings_3_SA_long,FittedEITpi_3_SA_long,selectedcurve,ax,le in zip(*tmp_datos):
ax.errorbar(Detunings_3_SA_short, CountsDR, yerr=2*np.sqrt(CountsDR),
fmt='o', color='darkgreen', alpha=0.2, capsize=2,
markersize=2, label='measured data')
# ax.errorbar(Detunings_3_SA_short, CountsDR, yerr=2*np.sqrt(CountsDR),
# fmt='o', color='darkgreen', alpha=0.2, capsize=2,
# markersize=2, label='measured data')
yerr_max = CountsDR+2*np.sqrt(CountsDR)
yerr_min = CountsDR-2*np.sqrt(CountsDR)
yerr_max = savgol(yerr_max,3,2)
yerr_min = savgol(yerr_min,3,2)
ax.fill_between(Detunings_3_SA_short, yerr_max, yerr_min,
color='darkgreen', alpha=0.2)
ax.plot(Detunings_3_SA_short, CountsDR, '.', ms=2,
color='darkgreen', alpha=0.9)
ax.plot(Detunings_3_SA_long, FittedEITpi_3_SA_long,
color='black', linewidth=2, label=f'micromotion model', alpha=0.7)
color='black', linewidth=1, label=f'micromotion model', alpha=0.7)
ax.grid(True, ls=":", color='lightgray')
......@@ -597,14 +617,14 @@ x_hip = np.linspace(-0.23,0.005,200)
ax = ax_central
ax.errorbar(voltages_dcA[I],Betas_vec[I],yerr=ErrorBetas_vec[I],fmt='o',
capsize=4,markersize=3,color='C3', label=r'fitted $\beta$')
ax.plot(x_hip,hiperbola(xhip,*popthip),color='C0', label=r'hyperbola model')
ax.plot(x_hip,hiperbola(x_hip,*param),color='C0', label=r'hyperbola model')
ax.set_ylabel(r'Modulation factor $\beta$', labelpad=-5)
ax.set_ylim(-0.05,3)
ax.set_xlim(-0.22,0)
ax.set_title(f'(g)', x=0.95, y=0.006, color='gray')
ax = ax_res
ax.errorbar(voltages_dcA[I],Betas_vec[I]-hiperbola(voltages_dcA[I],*popthip),
ax.errorbar(voltages_dcA[I],Betas_vec[I]-hiperbola(voltages_dcA[I],*param),
yerr=ErrorBetas_vec[I],fmt='o',capsize=4,markersize=3,color='C3')
ax.axhline( 0 , color='C0')
ax.set_ylabel('Res.', labelpad=-5)
......@@ -638,14 +658,29 @@ for jj,ax in zip(selection,axes_vec):
a, y0, b, x0 = param
ax_dib.plot( x_hip , x_hip*0+y0 , color='gray)
ax_dib.set_ylim(0,y0*1.1')
ax_dib.plot( x_hip , x_hip*0+y0 , color='gray')
ax_dib.set_ylim(-y0*0.1,y0*1.2)
ax_dib.plot( [x0], [0], 'x' )
ax_dib.text(x0+0.01, 0, 'trap center', fontsize = 8, ha='left',va='center', color='C0')
ax_dib.plot( voltages_dcA[I], voltages_dcA[I]*0+y0, '.' )
for Vx in voltages_dcA[I]:
ax_dib.plot( [Vx,x0], [y0,0], ':', color='lightgray', lw=1)
import matplotlib.patches as mpatches
arr = mpatches.FancyArrowPatch((x0, y0*1.1), (x0/2, y0*1.1),
arrowstyle='->,head_width=.15', mutation_scale=10, color='C1')
ax_dib.add_patch(arr)
ax_dib.annotate("ion position", (.5, .5), xycoords=arr, ha='center', va='bottom', color='C1')
# Leyenda ##############################
h1, l1 = ax_central.get_legend_handles_labels()
h2, l2 = axx[0,0].get_legend_handles_labels()
ax_central.legend(h1+h2, l1+l2, loc='upper left')
# h1, l1 = ax_central.get_legend_handles_labels()
# h2, l2 = axx[0,0].get_legend_handles_labels()
# ax_central.legend(h1+h2, l1+l2, loc='upper left')
......
Markdown is supported
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