Skip to content
aperturecontrol.py 1.48 KiB
Newer Older
Nicolas Nunez Barreto's avatar
Nicolas Nunez Barreto committed
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 24 14:24:05 2024

@author: liaf-ankylosaurus-admin
"""


import numpy as np
from artiq.experiment import *
#from pyliaf.GenFun.generador import nombredelaclase
from time import sleep


PORT = 60000
PASS = b'Secr3t Pa55W0rd'
from multiprocessing.connection import Client
Nicolas Nunez Barreto's avatar
Nicolas Nunez Barreto committed

class InOut(EnvExperiment):
    """
    Control de shutter prueba
    """
    def build(self):
        self.setattr_device("core")
        self.setattr_device("ccb")
        self.ttl6 = self.get_device("ttl6")
        
        self.setattr_argument("N_blinks", NumberValue(1, min=1, max=200, ndecimals=0, step=1), "Experiment params")


    @rpc
    def initialize_tca_com(self):
        address = ('localhost', PORT)
        self.conn = Client(address, authkey=PASS)
        sleep(0.1)


    @rpc
    def blinkRF(self,cmd='turnOnOffRF'):
        self.conn.send(f'{cmd} blink')
        rta = self.conn.recv()


Nicolas Nunez Barreto's avatar
Nicolas Nunez Barreto committed
    @kernel
    def run(self): 
        #Preparamos las variables
        
        self.initialize_tca_com()

Nicolas Nunez Barreto's avatar
Nicolas Nunez Barreto committed
        #Se prenden los "canales" a usar
        self.core.reset()
        self.ttl6.output()
        
        delay(200*ms)  # time for the artiq init.
        
        self.ttl6.on()
Nicolas Nunez Barreto's avatar
Nicolas Nunez Barreto committed

        delay(100*ms)
           
        self.blinkRF()

#        for i in range(self.N_blinks):
#            self.ttl6.on()   #ON CIERRA
#            delay(1000*ms)
#            self.ttl6.off()  #OFF ABRE
#            delay(1000*ms)