CPT_plotter_20211201.py 7.03 KB
import h5py
import matplotlib.pyplot as plt
import numpy as np
import sys
import re
import ast
from scipy.optimize import curve_fit
import os
from scipy import interpolate

#BUENAS MEDICIONES VARIANDO PARAMETROS

#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211201_CPT_DosLaseres_v05\Data

ALL_FILES = """000006238-IR_Scan_withcal_optimized
000006239-IR_Scan_withcal_optimized
000006247-IR_Scan_withcal_optimized
000006254-IR_Scan_withcal_optimized
000006308-IR_Scan_withcal_optimized
000006309-IR_Scan_withcal_optimized
000006310-IR_Scan_withcal_optimized
000006313-IR_Scan_withcal_optimized
000006314-IR_Scan_withcal_optimized
000006315-IR_Scan_withcal_optimized
000006316-IR_Scan_withcal_optimized
000006317-IR_Scan_withcal_optimized
000006382-IR_Scan_withcal_optimized
000006422-IR_Scan_withcal_optimized
000006423-IR_Scan_withcal_optimized
000006424-IR_Scan_withcal_optimized
000006425-IR_Scan_withcal_optimized
000006469-IR_Scan_withcal_optimized
000006470-IR_Scan_withcal_optimized
000006471-IR_Scan_withcal_optimized
000006497-IR_Scan_withcal_optimized
000006498-IR_Scan_withcal_optimized
000006499-IR_Scan_withcal_optimized
000006500-IR_Scan_withcal_optimized
000006501-IR_Scan_withcal_optimized
000006502-IR_Scan_withcal_optimized
000006503-IR_Scan_withcal_optimized
000006504-IR_Scan_withcal_optimized
000006505-IR_Scan_withcal_optimized
000006506-IR_Scan_withcal_optimized
000006507-IR_Scan_withcal_optimized
000006508-IR_Scan_withcal_optimized
""" 


def SeeKeys(files):
    for i, fname in enumerate(files.split()):
        data = h5py.File(fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'
        print(fname)
        print(list(data['datasets'].keys()))

print(SeeKeys(ALL_FILES))
#carpeta pc nico labo escritorio:
#C:\Users\Usuario\Documents\artiq\artiq_experiments\analisis\plots\20211101_CPT_DosLaseres_v03\Data

Counts = []
Freqs = []

AmpTisa = []
UVCPTAmp = []
No_measures = []

for i, fname in enumerate(ALL_FILES.split()):
    print(str(i) + ' - ' + fname)
    #print(fname)
    data = h5py.File(fname+'.h5', 'r') # Leo el h5: Recordar que nuestros datos estan en 'datasets'

    # Aca hago algo repugnante para poder levantar los strings que dejamos
    # que además tenian un error de tipeo al final. Esto no deberá ser necesario
    # cuando se solucione el error este del guardado.
    Freqs.append(np.array(data['datasets']['IR_Frequencies']))
    Counts.append(np.array(data['datasets']['counts_spectrum']))
    AmpTisa.append(np.array(data['datasets']['TISA_CPT_amp']))
    UVCPTAmp.append(np.array(data['datasets']['UV_CPT_amp']))
    No_measures.append(np.array(data['datasets']['no_measures']))

#%%
#VARIANDO POTENCIA IR se ve que aparecen las DR

jvec = [1]


plt.figure()
i = 0
for j in jvec:
    plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()


#%%
#TISA ON. Dos configuraciones de polarizaciones cruzadas de los dos laseres infrarrojos
#Poca estadistica, 15k mediciones

jvec = [3]


plt.figure()
i = 0
for j in jvec:
    plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()



#%%

#CAMBIO POLARIZACIONES: ahora pongo ambas en sigma+ + sigma-
#Voy variando la potencia del tisa a ver si veo que se apaguen todas las resonancias.
#20 k mediciones

jvec = [8, 9, 7]
AmpTisa = [0.1, 0.05, 0]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', label=f'Amp Tisa: {AmpTisa[i]}', capsize=2, markersize=2)

    #plt.plot([2*f*1e-6 for f in Freqs[j]], Counts[j], 'o-', label=f'Amp Tisa: {AmpTisa[i]}', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.legend()


#%%

#SE CHOTEO CUANDO TOQUE EL PINHOLE, PASE DE 4 DR A UNA COSA RARA

jvec = [10, 11]

plt.figure()
i = 0
for j in jvec:
    if j==10:
        plt.plot([2*f*1e-6 for f in Freqs[j]], [1*c for c in Counts[j]], 'o-', markersize=3)
    else:
        plt.plot([2*f*1e-6 for f in Freqs[j]], [1*c for c in Counts[j]], 'o-', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()

#%%

#4 DR muy bullish

jvec = [12]

plt.figure()
i = 0
for j in jvec:
    if j==10:
        plt.plot([2*f*1e-6 for f in Freqs[j]], [1*c for c in Counts[j]], 'o-', markersize=3)
    else:
        plt.plot([2*f*1e-6 for f in Freqs[j]], [1*c for c in Counts[j]], 'o-', markersize=3)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()

#%%

#Variando potencia UV

jvec = [14, 15, 16]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', label=f'Amp Tisa: {AmpTisa[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()

#%%

#AHORA SI: VARIANDO POTENCIA TISA, CON DOS IR EN SIGMAM M SIGMAM

jvec = [17, 18, 19]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='o', label=f'Amp Tisa: {AmpTisa[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.legend()


#%%
#MEJORES MEDS
#VARIANDO POLARIZACION TISA LINEAL. Doy fe que el detuning se mantuvo recontra estable en todas las mediciones

jvec = [20, 21, 22]
Angle = ['tisaoff', 0, 90]
plt.figure()
i = 0
for j in jvec:
    if j==20:
        plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', label=f'Tisa off', capsize=2, markersize=2)
    else:
        plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', label=f'Tisa ang: {Angle[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.legend()

#%%
#MEJORES MEDS
#VARIANDO POLARIZACION TISA LINEAL, 3 angulos

jvec = [21, 23, 22]
Angle = [0, 45, 90]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', label=f'Tisa ang: {Angle[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.ylim(2500, 6100)
plt.legend()


#%%
#MEJORES MEDS
#VARIANDO POLARIZACION TISA LINEAL

jvec = [21, 22, 23, 24, 25, 26, 27]
Angle = [0, 90, 45, 30, 60, 15, 75]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', label=f'Tisa ang: {Angle[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
plt.ylim(2500, 6100)
plt.legend()


#%%
#MEJORES MEDS
#VARIANDO POTENCIA TISA, A 90°

jvec = [28, 29, 30]
Amp = [0.25, 0.3, 0.1]

plt.figure()
i = 0
for j in jvec:
    plt.errorbar([2*f*1e-6 for f in Freqs[j]], Counts[j], yerr=np.sqrt(Counts[j]), fmt='-o', label=f'Tisa amp: {Amp[i]}', capsize=2, markersize=2)
    i = i + 1
plt.xlabel('Frecuencia (MHz)')
plt.ylabel('counts')
plt.grid()
#plt.ylim(2500, 6100)
plt.legend()