#! /usr/bin/env python ## By K. Miyo and Y. Enomoto, 2019/3/20 import ezca import sys import time from e8663d import VoltageControlledOscillator ezca = ezca.Ezca() ### argument check ### if len(sys.argv) != 5: print 'Wrong arguments. Usage: ARM start stop rate' sys.exit() arm = str(sys.argv[1]).upper() ## IP address and etc if arm == 'X': IP = '10.68.150.65' freq_default = 40e6 elif arm == 'Y': IP = '10.68.150.66' freq_default = 45e6 else: print 'ARM is X or Y' sys.exit() with VoltageControlledOscillator(IP, 5025) as vco: if sys.argv[2] == 'current':
import subprocess import ezca from info import picoDict, stepperDict, optics ezca = ezca.Ezca(timeout=0.1) # ------------------------------------------------------------------------------ def hoge(name): ''' ''' try: optic, stage = name.split('_') except: optic, stage = name, None if optic in [ 'MCE', 'MCI', 'MCO', 'IMMT1', 'IMMT2', 'OMMT1', 'OMMT2', 'OSTM' ]: drivername = 'PICO_OP' elif optic in ['ETMX', 'ETMY', 'ITMX', 'ITMY'] and stage == None: drivername = 'PICO_BF' elif stage in ['BF', 'IM']: drivername = 'PICO_{0}'.format(stage) elif stage in ['GAS', 'IP']: drivername = 'STEP_{0}'.format(stage) else: drivername = None chname = 'VIS-{0}_{1}_STATUS'.format(optic, drivername) return chname
# import sys # sys.path.append('/usr/lib/python3/dist-packages/') # sys.path.append('/opt/rtcds/userapps/release/sys/common/guardian') # sys.path.append('/opt/rtcds/userapps/release/vis/common/guardian') # sys.path.append('/opt/rtcds/userapps/release/vis/k1/guardian') # import VIS_OMMT1 import ezca import time hoge = ezca.Ezca() fmt1 = 'GRD-VIS_{OPTIC}_STATE_S' fmt2 = 'GRD-VIS_{OPTIC}_REQUEST_S' def is_finished(OPTIC): state = fmt1.format(OPTIC=OPTIC) request = fmt2.format(OPTIC=OPTIC) return hoge[state] == hoge[request] def huge(now): while True: finished = is_finished(OPTIC) if finished: dt = time.time() - now break else: time.sleep(1) return dt
import threading import subprocess import argparse import ezca ezca = ezca.Ezca(timeout=2) parser = argparse.ArgumentParser() parser.add_argument('fname') parser.add_argument('-optics',nargs='+',required=True) parser.add_argument('-dofs',nargs='+',required=True) parser.add_argument('--rundiag',action='store_true') parser.add_argument('--runcp',action='store_true') args = parser.parse_args() fname = 'PLANT_SRM_IP_BLEND_LEXC.xml' fname = 'PLANT_SRM_IP_IDAMP_LEXC.xml' fname = args.fname runcp = args.runcp rundiag = args.rundiag prefix,optic,stage,func,dof,suffix = fname.replace('.xml','').split('_') def huge(fname): _fname = fname.split('/')[2].replace('.xml','') with open('./log/tmp_{0}_in'.format(_fname),'w') as f: txt = 'open\nrestore {0}\nrun -w\nsave {0}\nquit\n'.format(fname) f.write(txt) print(' - Run {0}'.format(fname)) with open('./log/tmp_{0}_in'.format(_fname),'r') as tmp_in: with open('./log/tmp_{0}_out'.format(_fname),'w') as tmp_out: with open('./log/tmp_{0}_err'.format(_fname),'w') as tmp_err: ret = subprocess.run('diag',shell=True,check=True,
#from ezca import Ezca as ezca import ezca _ezca = ezca.Ezca(ifo='K1') dic = { 'ITMY_L': ['VIS-ITMY_IP_BLEND_LVDTL_INMON', +120], 'ITMY_T': ['VIS-ITMY_IP_BLEND_LVDTT_INMON', -700], 'ITMY_Y': ['VIS-ITMY_IP_BLEND_LVDTY_INMON', -600], 'ETMY_L': ['VIS-ETMY_IP_BLEND_LVDTL_INMON', +900], 'ETMY_T': ['VIS-ETMY_IP_BLEND_LVDTT_INMON', -400], 'ETMY_Y': ['VIS-ETMY_IP_BLEND_LVDTY_INMON', -450], 'ITMX_L': ['VIS-ITMX_IP_BLEND_LVDTL_INMON', +500], 'ITMX_T': ['VIS-ITMX_IP_BLEND_LVDTT_INMON', 1200], 'ITMX_Y': ['VIS-ITMX_IP_BLEND_LVDTY_INMON', -100], } for sus in ['ITMY', 'ITMX', 'ETMY']: for dof in ['L', 'T', 'Y']: chname, good = dic['{0}_{1}'.format(sus, dof)] data = _ezca.read(chname) if abs(data - good) > 200: print(sus, dof, int(data - good)) else: pass