Files
sf-rf/script/RFscan/RF_phase_scan.py
2016-06-06 17:18:03 +02:00

26 lines
759 B
Python

rsys = "SINSB01-RSYS"
bpm = "SINLH02-DBPM210"
phi1 = -175.0
phi2 = 180.0
dphi = 5.0
def laser_on():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 0)
def laser_off():
caput("SIN-CVME-TIMAST-TMA:LaserDelayControl", 1)
phi_set = Channel(rsys + ":SET-VSUM-PHASE")
phi_get = Channel(rsys + ":GET-VSUM-PHASE")
amp_get = Channel(rsys + ":GET-VSUM-AMPLT")
bpm_x = Channel(bpm + ":X1")
r = lscan(phi_set, [phi_get, amp_get, bpm_x], phi1, phi2, dphi, 0.5, before_read = laser_on(), after_read = laser_off())
plot(r.getReadable(2), xdata = r.getReadable(0), title = "Phase scan")
(amplitude, angular_frequency, phase, ok, maximum) = hfit(r.getReadable(2), xdata = r.getReadable(0))
caput(rsys + ":SET-ON-CREST-VSUM-PHASE", maximum)
set_return(r.print())