Commit cfdd6617 authored by Nicolas Nunez Barreto's avatar Nicolas Nunez Barreto

modificaciones al archivo de calibrs

parent cf9323b4
......@@ -56,33 +56,91 @@ plt.ylabel('Amplitud Artiq')
plt.xlabel("Voltaje fotodiodo (V)")
plt.legend()
#%%
def RemoveZeros(calib, freqs):
i, j = 0, 1
new_calib = calib
while i < len(calib):
if new_calib[0] == 0:
new_calib = new_calib[1:]
i = i + 1
else:
init_len = len(new_calib)
final_calib = new_calib
while j < init_len:
if final_calib[-1] == 0:
final_calib = final_calib[:-1]
j = j + 1
else:
if j == 1:
return (i, j), freqs[i:], final_calib
else:
return (i, j), freqs[i:-j+1], final_calib
lista = [0, 1, 0, 1, 0, 0, 1, 1, 0, 0]
freqs = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
tupla, new_freqs, calib = RemoveZeros(lista, freqs)
print(new_freqs)
print(calib)
#%%
i = 15
interpolations = []
interpolations_g = []
for i in range(len(PD_T)):
PD = np.array(PD_T[i][0])[0]
amps = Calibration_amps
f = interpolate.interp1d(PD, amps, kind='quadratic')
g = interpolate.interp1d(amps, PD, kind='quadratic')
xs = np.arange(min(PD), max(PD), 1e-4)
interpolations.append(f)
interpolations_g.append(g)
Calibration_PD_value = 0.2
Calibs = []
for fi in interpolations:
try:
Calibs.append(fi(0.2))
Calibs.append(float(fi(Calibration_PD_value)))
except:
Calibs.append(0)
plt.plot(freqs, Calibs, 'o')
fig, ax1 = plt.subplots()
ax2 = ax1.twinx()
ax1.plot([f*1e-6 for f in freqs], Calibs, 'o', label='Amplitudes a setear')
EffectivePD = []
for i in range(len(Calibs)):
try:
EffectivePD.append(interpolations_g[i](Calibs[i]))
except:
EffectivePD.append(0)
ax2.plot([f*1e-6 for f in freqs], EffectivePD, 'ro', label='Potencia')
ax1.set_xlabel('Frecuencia (MHz)')
ax1.set_ylabel('Amplitudes')
ax2.set_ylabel('Potencia PD (V)')
fig.legend()
h = interpolate.interp1d(freqs, Calibs, kind='quadratic')
xs2 = np.arange(min(freqs), max(freqs), 1e5)
plt.figure()
plt.plot(freqs, Calibs, 'o')
plt.plot(xs2, h(xs2))
......
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