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

meds

parent a45a43be
......@@ -34,9 +34,10 @@ class InOut(EnvExperiment):
def create_datasets(self):
self.set_dataset('counts', np.zeros(int(self.t_exp/self.t_med), dtype=int) , broadcast=True, archive=True)
self.set_dataset('counts_indefinite',np.zeros(1, dtype=int) , broadcast=True, archive=False)
self.set_dataset('time', np.linspace(0,self.t_exp,int(self.t_exp/self.t_med)), broadcast=True, archive=True)
self.set_dataset('counts', np.zeros(int(self.t_exp/self.t_med), dtype=int) , broadcast=True, archive=True)
#self.set_dataset('counts', [], broadcast=True, archive=True)
self.set_dataset('counts_indefinite',np.array([0.0]), broadcast=True, archive=False)
#self.set_dataset("N ions", self.N_ions, broadcast=False, archive=True)
......@@ -46,7 +47,7 @@ class InOut(EnvExperiment):
self.ccb.issue("create_applet", "test_IR_espectro_fixeddelays",
"${python} -m pyLIAF.artiq.applets.plot_xy "
"counts "
"counts "#Tiene que estar el espacio!!!
"--x time") #Aca habria que definir bien el vector que se use en el eje x
self.ccb.issue("create_applet", "test_histogram_realtime",
......@@ -56,36 +57,36 @@ class InOut(EnvExperiment):
self.ccb.issue("create_applet", "test_histogram_realtime_indefinite",
"${python} -m pyLIAF.artiq.applets.realtime "
"400"
"counts_indefinite "
"--update-delay 0.2")
@rpc(flags={"async"})
def record_result(self, x):
self.ticks.append(x)
def unload_txt(self, save=False):
difs = np.diff(self.ticks)
print('\ntiempo\t diff')
for i, tick in enumerate(self.ticks[:-1]):
print(f"{tick:.4f}", end='')
if i>0:
print(f"\t {difs[i-1]}")
else:
print()
print(f"\ntotal: {len(self.ticks)}")
print(f"repetidos: {np.count_nonzero(difs<1e-4)-1}")
"400 "
"counts_indefinite")
if save:
np.savetxt('escribo_ticks.dat', self.ticks[:-1])
# @rpc(flags={"async"})
# def record_result(self, x):
# self.ticks.append(x)
#
# def unload_txt(self, save=False):
# difs = np.diff(self.ticks)
# print('\ntiempo\t diff')
# for i, tick in enumerate(self.ticks[:-1]):
# print(f"{tick:.4f}", end='')
# if i>0:
# print(f"\t {difs[i-1]}")
# else:
# print()
#
# print(f"\ntotal: {len(self.ticks)}")
# print(f"repetidos: {np.count_nonzero(difs<1e-4)-1}")
#
# if save:
# np.savetxt('escribo_ticks.dat', self.ticks[:-1])
@rpc
def TurnOnRF(self):
blablabla
pass
@rpc
def TurnOffRF(self):
boalbas
pass
@kernel
def run(self):
......@@ -99,55 +100,24 @@ class InOut(EnvExperiment):
self.ttl4.on()
delay(20*ms) # time for the artiq init.
for i in range(int(self.t_exp/self.t_med)):
cuentas=self.ttl0.gate_rising(self.t_med)
cuentas=self.ttl0.count(cuentas)
self.mutate_dataset('counts',i,cuentas)
# tiempo= self.ttl0.timestamp_mu(self.t_med)
# print(tiempo)
# tiempo= self.core.mu_to_seconds(tiempo)
# self.mutate_dataset('time',i,tiempo)
print(cuentas)
self.core.break_realtime()
if self.Measurement_type=="indefinite_time":
while True:
cuentas=self.ttl0.gate_rising(self.t_med)
cuentas=self.ttl0.count(cuentas)
self.mutate_dataset("counts_indefinite",0,cuentas)
print(cuentas)
self.core.break_realtime()
else:
for i in range(int(self.t_exp/self.t_med)):
cuentas=self.ttl0.gate_rising(self.t_med)
cuentas=self.ttl0.count(cuentas)
self.mutate_dataset("counts",i,cuentas)
print(cuentas)
self.core.break_realtime()
start_time = now_mu() # Record the start timeself.core.break_realtime()
self.core.break_realtime()
#self.core.wait_until_mu(now_mu())
#stop_time = start_time + self.core.seconds_to_mu(self.t_exp)
#
# if self.Measurement_type=="indefinite time":
# while cuentas > 0:
# #hasta_aca=self.ttl0.gate_rising(self.t_med)
# #at_mu(self.ttl0.timestamp_mu(hasta_aca))
# #hasta_aca=self.ttl0.gate_rising(100*ms)
# #pulsos=self.ttl0.count(hasta_aca)
# #datos=datos+[pulsos]
# pulsos=3
# self.mutate_dataset('counts_indefinite',0,pulsos)
# #delay(3*ms)
# #t0 = t_end - self.core.seconds_to_mu(self.t_med)
# self.core.break_realtime()
# self.core.wait_until_mu(now_mu())
#
# else:
# for i in range(int(self.t_exp/self.t_med)):
# print(self.t_med)
# #hasta_aca=self.ttl0.gate_rising(self.t_med)
# #hasta_aca=self.ttl0.gate_rising(100*ms)
# #pulsos=self.ttl0.count(hasta_aca)
# pulsos=3
# #datos=datos+[pulsos]
# self.mutate_dataset('counts',i,pulsos)
# tiempo= self.ttl0.timestamp_mu(self.t_med)
# tiempo= self.core.seconds_to_mu(tiempo)
# self.mutate_dataset('time',i,tiempo)
# #delay(3*ms)
# #t0 = t_end - self.core.seconds_to_mu(self.t_med)
# self.core.break_realtime()
# self.core.wait_until_mu(now_mu())
self.core.break_realtime()
\ No newline at end of file
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