Fixes & new requests

This commit is contained in:
x07maop
2017-02-08 14:03:07 +01:00
parent 15b1f51023
commit 31879d6ae2
21 changed files with 293 additions and 70 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#Wed Jan 18 15:39:16 CET 2017
#Wed Feb 08 11:09:37 CET 2017
autoSaveScanData=true
createSessionFiles=false
dataLayout=ch.psi.fda.LayoutFDA
+9 -9
View File
@@ -17,19 +17,19 @@ pol_done=ch.psi.pshell.epics.ChannelString|X07MA-ID:DONE|Read||true
ramp_rate_x=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS2:SET:DMD:RAMPRATE:TPM X07MA-PC-PS2:STS:RAMPRATE:TPM|||true
ramp_rate_z=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-PS1:SET:DMD:RAMPRATE:TPM X07MA-PC-PS1:STS:RAMPRATE:TPM|||true
ramp_rate_x_ips=ch.psi.pshell.epics.ControlledVariable|X07MA-ES1-IPS:FRAMP X07MA-ES1-IPS:FRAMP_RBV|||true
sample_hor=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||
sample_vert=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRY1|||
sample_rot=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:ROY1|||
au_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||
sample_hor=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRZ1|||true
sample_vert=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:TRY1|||true
sample_rot=ch.psi.pshell.epics.Motor|X07MA-ES1-MAG:ROY1|||true
au_mesh=ch.psi.pshell.epics.Motor|X07MA-OP-IO1:TR1|||true
needle=ch.psi.pshell.epics.ProcessVariable|X07MA-PC-TC:DMD:LOOP2:MANUAL|||
temperature=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:DMD:LOOP1:SETPOINT|||
temperature_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||
temperature=ch.psi.pshell.epics.ControlledVariable|X07MA-PC-TC:DMD:LOOP1:SETPOINT X07MA-PC-TC:STS:T1|||true
#temperature_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PC-TC:STS:T1|Read||
valve_try_open=ch.psi.pshell.epics.ChannelInteger|X07MA-OP-VG13:WT_SET|||
energy=ch.psi.pshell.epics.ChannelDouble|X07MA-PHS-E:GO.A|||
energy_readback=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:CERBK|Read||
energy_done=ch.psi.pshell.epics.ChannelInteger|X07MA-PHS:alldone|Read||true
cff=ch.psi.pshell.epics.ChannelDouble|X07MA-PGM:cff.A|||
exit_slit=ch.psi.pshell.epics.ProcessVariable|X07MA-OP-SL1SV1:TR_AP|||
exit_slit=ch.psi.pshell.epics.ProcessVariable|X07MA-OP-SL1SV1:TR_AP|||true
harmonic=ch.psi.pshell.epics.ChannelInteger|X07MA-ID:HARMONIC|||
signal_tey=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL0|Read||true
signal_i0=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL1|Read||true
@@ -38,6 +38,6 @@ signal_field_analog_x=ch.psi.pshell.epics.ChannelDouble|X07MA-ES1-AI:SIGNAL4|Rea
#k10=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI10:SETVOLTAGE|||
#k11=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI11:SETVOLTAGE|||
#k24=ch.psi.pshell.epics.ChannelDouble|X07MA-KEI2400:setVoltAO|||
aperture=ch.psi.pshell.epics.DiscretePositioner|X07MA-FE-DSAPER|||
beam_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||
aperture=ch.psi.pshell.epics.DiscretePositioner|X07MA-FE-DSAPER|||true
beam_status=ch.psi.pshell.epics.DiscretePositioner|ACOAU-ACCU:OP-MODE|Read||true
sample=ch.psi.pshell.imaging.MjpegSource|http://x07ma-cam-5/axis-cgi/mjpg/video.cgi||-100|
+1
View File
@@ -0,0 +1 @@
#PGM_Check=10
+8
View File
@@ -0,0 +1,8 @@
#Wed Feb 08 10:43:58 CET 2017
maxValue=380.0
minValue=1.0
offset=0.0
precision=3
resolution=0.5
scale=1.0
unit=
+12 -4
View File
@@ -13,6 +13,13 @@ FILE = 'Fe_plus'
ALPHA=0
"""
count.initialize()
data.initialize()
fdata.initialize()
idata.initialize()
edata.initialize()
p=None
def start_plot():
global p
@@ -62,18 +69,19 @@ def getNewestFile():
newest = getNewestFile()
#Pre-actions
wait_beam()
if MODE is not None:
pol_mode.write(MODE) #caput('X07MA-ID:MODE', MODE) #TODO: CAPUT
time.sleep(0.5) #TODO: Needed?
# time.sleep(0.5) #TODO: Needed?
if MODE == 'LINEAR':
if ALPHA is not None:
pol_angle.write(ALPHA) #TODO: CAPUT
time.sleep(0.5)
# time.sleep(0.5)
#wait_device(pol_done, "DONE") #TODO: NEEDED?
if OFFSET is not None:
pol_offset.write(OFFSET) #TODO: CAPUT
time.sleep(0.5)
# time.sleep(0.5)
#wait_device(pol_done, "DONE")
caput('E1', E1)
@@ -116,7 +124,7 @@ try:
join(ret)
#File convertion
newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt";
newName = folder + time.strftime("%Y%m%d_%H%M%S_", start) + FILE + "_0000.txt";
name = getNewestFile()
if name == newest:#TODO: WHY WRITING AGAIN???
+15 -6
View File
@@ -14,6 +14,7 @@ OFFSET = -1.0
iPS = False
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
@@ -26,9 +27,11 @@ if MODE is not None:
if OFFSET is not None:
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
caputq('X07MA-PC:CSCALER.INPB', '1')
if RAMP_RATE is not None:
ramp_rate.write(RAMP_RATE)
ramp_rate.waitInPosition(RAMP_RATE,10000)
#if RAMP_RATE is not None:
# ramp_rate.write(RAMP_RATE)
# ramp_rate.waitInPosition(RAMP_RATE,10000)
@@ -49,9 +52,10 @@ write_logs()
print "Waiting for start field"
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
ramp_rate.write(2.0)
field.write(START_FIELD)
if field_done is None:
ramp_rate.write(2.0)
#ramp_rate.write(2.0)
ramp_rate.waitInPosition(2.0,10000)
time.sleep(1.0)
caput("X07MA-ES1-IPS:ACTION", 1)
@@ -66,7 +70,7 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
#open(2.0)
#open_valve(2.0)
print "Set energy"
setpoint2 = ENERGIES[0]
@@ -76,6 +80,11 @@ sleep( ENERGY_CHANGE_SLEEP ) # Settling time
wait_device(energy_done, 1 )
wait_device(pol_done, "DONE")
if RAMP_RATE is not None:
ramp_rate.write(RAMP_RATE)
ramp_rate.waitInPosition(RAMP_RATE,10000)
print "Set end field"
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
@@ -110,7 +119,7 @@ while(True):
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature_readback.read() #temperature.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+9 -9
View File
@@ -10,6 +10,7 @@ OFFSET = -1.0
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else field_x
field_done = field_z_done if FIELD == "Hz" else field_x_done
ramp_rate = ramp_rate_z if FIELD == "Hz" else ramp_rate_x
@@ -34,22 +35,21 @@ set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm','trans_norm'], [0.0, ENERGIES[0]], [0.0, ENERGIES[-1]], [0, len(ENERGIES)-1])
scan.start()
print "SKIPPED Waiting for start field"
write_logs()
for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
ramp_rate.write(RAMP_RATE)
if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
print "Setting start field: ", START_FIELD
field.write(START_FIELD)
time.sleep(3.0)
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(pol_done, "DONE")
open(2.0)
#open_valve(2.0)
print "Set end field"
print "Set end field: ", END_FIELD
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
index = 0
@@ -72,7 +72,7 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature.read() #temperature.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
@@ -88,7 +88,7 @@ for (START_FIELD, END_FIELD, RAMP_RATE) in RANGES:
scan.append ([field_readback, setpoint2], [field_readback, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
if field_done.read() == 1: #If not ramping #ramp_done.get() == 1:
print "Not ramping, breaking execution"
print "Reached end field. Readback=", field_readback
break
index = index+1
+4 -2
View File
@@ -11,10 +11,11 @@ OFFSET = -1.0
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else field_x
#Pre-actions
#wait_beam()
wait_beam()
if MODE is not None:
pol_mode.write(MODE)
if OFFSET is not None:
@@ -31,8 +32,9 @@ set_preference(Preference.ENABLED_PLOTS, ['field', 'tey_norm', 'trans_norm'])
set_preference(Preference.PLOT_TYPES, {'tey_norm':1, 'trans_norm':1})
scan = ManualScan(['field', 'Energy'], ['TEY', 'I0', 'trans', 'polarization', 'polAngle', 'temperature', 'RingCurrent', 'fieldAnalogX', 'tey_norm', 'trans_norm'] , [min(setpoints), min(ENERGIES)], [max(setpoints), max(ENERGIES)], [len(setpoints)-1, len(ENERGIES)-1])
scan.start()print
scan.start()
write_logs()
#Dimension 1
#RegionPositioner field
+10
View File
@@ -0,0 +1,10 @@
if get_context().getRunningScriptName()=="EnergyScan":
try:
c = Channel("MSG")
c.close()
except:
show_message("PGM Server unavailable", title = "Error", blocking = True)
get_context().abort()
time.sleep(30.0)
+75
View File
@@ -0,0 +1,75 @@
#!/usr/bin/env python
import os,time,subprocess
def check_Tcontrol_on():
prog = os.popen("caget -noname -num -nostat X07MA-ES1-TEMP:CONTROL")
sp=prog.read()
if sp =='':
Tcontrol_on = False
else:
sp = float(sp)
if sp != 1:
Tcontrol_on = False
else:
Tcontrol_on = True
# print "Tctrl on =",Tcontrol_on
return Tcontrol_on
Tctrl = check_Tcontrol_on()
if Tctrl == False :
print 'T auto control not running.'
prog2 = os.popen("caget -plain X07MA-PC-TC:DMD:LOOP1:SETPOINT")
sp=prog2.read()
#print "sp= "+str(sp)
sp=float(sp)
# path contains the path of the refill log file
path1=time.strftime("%Y_%m", time.localtime())
path2=time.strftime("%Y%m%d", time.localtime())
path="/sls/X07MA/data/x07maop/Data1/"+path1+"/"+path2 +"/"+"refill.log"
if (sp<2.0):
prog = os.popen("caget -plain X07MA-PC-TC:STS:T1")
t=prog.read()
print "t= "+str(t)
t=float(t)
prog2 = os.popen("caget -plain X07MA-PC-HE:LEVELB")
hl=prog2.read()
print "hl= "+str(hl)
hl=float(hl)
if (t > 3.7):
#prc = subprocess.Popen("/sls/X07MA/data/x07maop/python/refill_1kpot.py",shell=True)
#prc.wait()
run("refill_1kpot")
else:
print 'T auto control is running.'
while True:
prog = os.popen("caget -noname -num -nostat X07MA-ES1-TEMP:STATUS")
sp = prog.read()
if sp !='':
sp = float(sp)
else:
break
# if temperature is stable
if sp == 1:
print "T is now stable."
break
time.sleep(1.0)
Tctrl = check_Tcontrol_on()
if Tctrl == False:
print "Tcontrol was switched off. Exiting."
break
time.sleep(1.0)
+36
View File
@@ -0,0 +1,36 @@
def Notfplus():
global off_plus
wait_temp()
otf(start=385, end=440, time=2, delay=5, mode = "CIRC +", offset = off_plus, alpha = None, name = 'NE_plus')
def Notfminus():
global off_minus
wait_temp()
otf(start=385, end=440, time=2, delay=5, mode = "CIRC -", offset = off_minus, alpha = None, name = 'NE_minus')
def N_xmcd_pmmp():
for i in range(4):
Notfplus()
Notfminus()
Notfminus()
Notfplus()
off_plus = -1.0
off_minus = 0.0
set_pol_cplus(offset = off_plus)
set_slit(30.0)
open_valve()
set_hx(-2.0)
N_xmcd_pmmp()
set_hx(2.0)
N_xmcd_pmmp()
set_hx(-2.0)
N_xmcd_pmmp()
close_valve()
+1 -1
View File
@@ -9,7 +9,7 @@ B2 = -B1
nr_loops = 1 # number of loops to acquire
#while temperature_readback.read() > 1.9:
#while temperature.readback.read() > 1.9:
# time.sleep(1)
+79 -17
View File
@@ -3,6 +3,7 @@
###################################################################################################
import ch.psi.fda.ProcessorFDA as ProcessorFDA
import ntpath
def run_fda(file_name, arguments={}):
"""
@@ -14,9 +15,12 @@ import traceback
energy.setBlockingWrite(True)
#If True, then wait_beam will not check machine status
maintenance_mode = False
#now using ch.psi.fda.LayoutFDA
"""
#The persistence strategy is overriden to adjust file names
import ch.psi.pshell.data.LayoutTable
@@ -136,7 +140,12 @@ def convert_file(input_file_name, output_file_name, pol = None):
with open(input_file_name) as inp:
lines = inp.readlines()
with open(output_file_name, "wb") as out:
out.write("Ecrbk" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
#Original header:
#out.write("Ecrbk" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
#Compatible header:
(db, st) = ("java.lang.Double", "java.lang.String")
out.write("#Ecrbk" + sep + "CADC1" + sep + "CADC2" + sep + "CADC3" + sep + "CADC4" + sep + "CADC5" + sep + "MCurr" + sep + "Time" + sep + "FieldX" + sep + "FieldZ" + sep + "Pol" + sep + "Temperature" + sep + "NORMtey" + sep + "NORMdiode" + line_sep)
out.write("#"+ db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + db + sep + st + sep + db + sep + db + sep + db + line_sep)
s = sep
for line in lines[1:]:
line = line.strip()
@@ -147,7 +156,8 @@ def convert_file(input_file_name, output_file_name, pol = None):
normdiode=repr(float(CADC3)/float(CADC2))
out.write(Ecrbk + s + CADC1 + s + CADC2 + s + CADC3 + s + CADC4 + s + CADC5 + s + MCurr + s + time + s + MAGX + s + MAGZ + s + str(pol) + s + EXPT + s + normtey + s + normdiode + line_sep)
except:
traceback.print_exc()
traceback.print_exc()
os.rename(input_file_name, get_context().setup.expandPath("{data}/OTF/" + ntpath.basename(input_file_name)))
def plot_file(file_name, title = None):
"""
@@ -156,6 +166,49 @@ def plot_file(file_name, title = None):
plots = plot(table, title = title)
def elog(title, message, attachments = [], author = None, category = "Info", domain = "", logbook = "XTREME", encoding=1):
"""
Add entry to ELOG.
"""
if author is None:
author = "pshell" #get_context().user.name
typ = "pshell"
entry = ""
cmd = 'G_CS_ELOG_add -l "' + logbook + '" '
cmd = cmd + '-a "Author=' + author + '" '
cmd = cmd + '-a "Type=' + typ + '" '
cmd = cmd + '-a "Entry=' + entry + '" '
cmd = cmd + '-a "Title=' + title + '" '
cmd = cmd + '-a "Category=' + category + '" '
cmd = cmd + '-a "Domain=' + domain + '" '
for attachment in attachments:
cmd = cmd + '-f "' + attachment + '" '
cmd = cmd + '-n ' + str(encoding)
cmd = cmd + ' "' + message + '"'
#print cmd
#os.system (cmd)
#print os.popen(cmd).read()
import subprocess
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
if (err is not None) and err!="":
raise Exception(err)
print out
def get_plot_snapshots(title = None, file_type = "png", temp_path = get_context().setup.getContextPath()):
"""
Returns list with file names of plots snapshots from a plotting context.
"""
sleep(0.1) #Give some time to plot to be finished - it is not sync with acquisition
ret = []
for p in get_plots(title):
file_name = os.path.abspath(temp_path + "/" + p.getTitle() + "." + file_type)
p.saveSnapshot(file_name , file_type)
ret.append(file_name)
return ret
###################################################################################################
# Controller state listener
@@ -225,11 +278,16 @@ def set_pol_lin(angle, offset = None, timeout = -1):
pol_offset.write(float(offset))
pol_done.waitValue("DONE",timeout)
def set_temp(value, delay = 30.0):
def set_temp(value, in_position_band = None):
"""
"""
temperature.write(float(value))
time.sleep(float(delay))
if in_position_band is None:
in_position_band = temperature.getResolution()
#TODO: Replace when this flag works for all temperatures
#cawait("X07MA-ES1-TEMP:STATUS", "Stable")
#return
temperature.readback.waitValueInRange(float(value), in_position_band, -1)
def open_valve(delay = 5.0):
"""
@@ -317,9 +375,11 @@ def refill_1k():
run("refill_1kpot")
def wait_temp():
"""
"""
#print "blabla"
# if (temperature.read() < 2.0):
# t=ct=temperature_readback.read()
# t=ct=temperature.readback.read()
#hl=caget("X07MA-PC-HE:LEVELB", 'd') # TODO: not used
# if (t > 3.7):
# print "Refilling 1K pot..."
@@ -347,8 +407,11 @@ def has_beam():
def wait_beam():
"""
"""
print "Waiting for beam..."
print "Waiting for beam..."
while not has_beam():
if maintenance_mode:
print "Maintenence mode: disregarding beam state"
return
sleep(0.1)
print "Beam OK"
@@ -363,7 +426,8 @@ def wait_inj (value, delay=0.5):
def set_file(file_name):
"""
"""
set_exec_pars(name = file_name)
set_exec_pars(name = file_name) #Increment index for each scan, and keep timestamp
#set_exec_pars(name = file_name, reset=True) #Different timestamp for each scan, index set to 0
class pol_mod(Readable):
def read(self):
@@ -406,13 +470,11 @@ def hyst_step_mult(forward, ranges, ramp_speed, energies, energy_change_sleep =
def scan_e(start, end, step, settling_time = 0, accumulation_time = None, name = None):
"""
"""
#if name is not None:
#set_exec_pars(name = name)
if name is None:
name = get_exec_pars().name
#wait_beam()
if name is not None:
set_file(name = name)
wait_beam()
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
detectors = acc.getSensors() + [polmod, pol_angle, temperature, current]
detectors = acc.getSensors() + [polmod, pol_angle, temperature.readback, current]
set_preference(Preference.ENABLED_PLOTS, acc.getSensors())
lscan(energy, detectors, float(start), float(end), float(step), latency = settling_time)
@@ -420,10 +482,10 @@ def scan_e_mult(ranges, settling_time = 0, accumulation_time = None, name = None
"""
"""
if name is not None:
set_exec_pars(name = name)
# name = get_exec_pars().name
set_file(name = name)
wait_beam()
acc = Accumulator([signal_tey, signal_i0, signal_trans, tey_norm, trans_norm], accumulation_time)
detectors = acc.getSensors() + [polmod, pol_angle, temperature, current]
detectors = acc.getSensors() + [polmod, pol_angle, temperature.readback, current]
set_preference(Preference.ENABLED_PLOTS, acc.getSensors())
rscan(energy, detectors, ranges, latency = settling_time)
@@ -463,7 +525,7 @@ def write_logs():
log("Cff: " + str(cff.read()))
log("Harm: " + str(harmonic.read()))
log("FE: " + str(aperture.read() ))
log("Sample temperature: " + str(temperature_readback.read() ) )
log("Sample temperature: " + str(temperature.readback.read() ) )
log("Sample coord. HOR; VERT; ROT: " + str(sample_hor.read()) + "; " + str(sample_vert.read()) + "; " + str(sample_rot.read()) )
log("Gain sample: " + str(caget(keithleys["k1"][2])))
log("Gain i0: " + str(caget(keithleys["k2"][2])))
+2 -2
View File
@@ -14,7 +14,7 @@ if (sp<2.0):
print "Wait until T< 4K"
while True:
time.sleep(2)
t=temperature_readback.read()
t=temperature.readback.read()
if t < 4:
break
print "Wait 5 min ..."
@@ -25,7 +25,7 @@ if (sp<2.0):
t_old=0.
while True:
t=temperature_readback.read()
t=temperature.readback.read()
t_diff=abs(t-t_old)
drift_mKelvin_per_min=t_diff*2*1000 # it was t_diff*6*1000, don't know why 6. It takes tooooo long to exit script.CP 23.11.14
print "T drift in mK per minute: ",drift_mKelvin_per_min
+6 -6
View File
@@ -20,11 +20,11 @@ polarization = Channel('X07MA-ID:MODE', type = 'd')
#ScalarDetector polangle
polangle = Channel('X07MA-ID:ALPHA', type = 'd')
#ScalarDetector temperature
temperature = Channel('X07MA-PC-TC:STS:T1', type = 'd')
temp = Channel('X07MA-PC-TC:STS:T1', type = 'd')
#ScalarDetector ringCurrent
ringCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector energy
energy = Channel('X07MA-PHS-E:GO.A', type = 'd')
energ = Channel('X07MA-PHS-E:GO.A', type = 'd')
#ScalarDetector ADC3
ADC3 = Channel('X07MA-ES1-AI:SIGNAL2', type = 'd')
@@ -54,11 +54,11 @@ for setpoint1 in (778, 770):
#Detector polangle
detector4 = polangle.get()
#Detector temperature
detector5 = temperature.get()
detector5 = temp.get()
#Detector ringCurrent
detector6 = ringCurrent.get()
#Detector energy
detector7 = energy.get()
detector7 = energ.get()
#Detector ADC3
detector8 = ADC3.get()
#Manipulation ADC1_norm
@@ -75,9 +75,9 @@ ADC1.close()
ADC2.close()
polarization.close()
polangle.close()
temperature.close()
temp.close()
ringCurrent.close()
energy.close()
energ.close()
ADC3.close()
p2.close()
p2Readback.close()
+6 -6
View File
@@ -43,7 +43,7 @@ for setpoint1 in frange(0.0, 55.0, 1.0, True):
#ScalarDetector polAngle
polAngle = Channel('X07MA-ID:ALPHA', type = 'd')
#ScalarDetector temperature
temperature = Channel('X07MA-PC-TC:STS:T1', type = 'd')
temp = Channel('X07MA-PC-TC:STS:T1', type = 'd')
#ScalarDetector RingCurrent
RingCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector fieldAnalogX
@@ -68,7 +68,7 @@ for setpoint1 in frange(0.0, 55.0, 1.0, True):
#Detector polAngle
detector5 = polAngle.get()
#Detector temperature
detector6 = temperature.get()
detector6 = temp.get()
#Detector RingCurrent
detector7 = RingCurrent.get()
#Detector fieldAnalogX
@@ -79,7 +79,7 @@ for setpoint1 in frange(0.0, 55.0, 1.0, True):
d = detector2
import math
tey_norm = c/d
teynorm = c/d
#Manipulation trans_norm
#Variable Mappings
@@ -87,9 +87,9 @@ for setpoint1 in frange(0.0, 55.0, 1.0, True):
d = detector2
import math
trans_norm = c/d
transnorm = c/d
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, teynorm, transnorm])
Energy.close()
EnergyReadback.close()
TEY.close()
@@ -97,7 +97,7 @@ for setpoint1 in frange(0.0, 55.0, 1.0, True):
trans.close()
polarization.close()
polAngle.close()
temperature.close()
temp.close()
RingCurrent.close()
fieldAnalogX.close()
field.close()
+3 -2
View File
@@ -12,6 +12,7 @@ OFFSET = -1.0
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else field_x
field_done = field_z_done if FIELD == "Hz" else field_x_done
ramp_rate = ramp_rate_z if FIELD == "Hz" else ramp_rate_x
@@ -52,7 +53,7 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(pol_done, "DONE")
#open(2.0)
#open_valve(2.0)
print "Set end field"
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
@@ -87,7 +88,7 @@ while(True):
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature_readback.read() #temperature.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+3 -2
View File
@@ -13,6 +13,7 @@ OFFSET = -1.0
iPS = True
FIELD_PRECISION = 0.01
if FIELD == field_z: FIELD = "Hz"
field = field_z if FIELD == "Hz" else (field_x_ips if iPS else field_x )
field_done = field_z_done if FIELD == "Hz" else (None if iPS else field_x_done)
ramp_rate = ramp_rate_z if FIELD == "Hz" else (ramp_rate_x_ips if iPS else ramp_rate_x)
@@ -63,7 +64,7 @@ if abs(field.readback.read() - START_FIELD) > FIELD_PRECISION:
wait_device(field_done, 1) #ramp_done.wait_for_value(1.0)
wait_device(pol_done, "DONE")
#open(2.0)
#open_valve(2.0)
print "Set end field"
field.write(END_FIELD) #caputq('X07MA-PC-PS2:M:GO.A', END_FIELD)
@@ -98,7 +99,7 @@ while(True):
detector3 = signal_trans.read() #trans.get()
detector4 = float(pol_mode.getPositions().index(pol_mode.readback.read())) #polarization.get()
detector5 = pol_angle.read() #polAngle.get()
detector6 = temperature_readback.read() #temperature.get()
detector6 = temperature.readback.read() #temperature.get()
detector7 = current.read()
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
+3 -3
View File
@@ -56,7 +56,7 @@ polarization = Channel('X07MA-ID:MODE', type = 'd')
#ScalarDetector polAngle
polAngle = Channel('X07MA-ID:ALPHA', type = 'd')
#ScalarDetector temperature
temperature = Channel('X07MA-PC-TC:STS:T1', type = 'd')
temp = Channel('X07MA-PC-TC:STS:T1', type = 'd')
#ScalarDetector RingCurrent
RingCurrent = Channel('ARIDI-PCT:CURRENT', type = 'd')
#ScalarDetector fieldAnalogX
@@ -115,7 +115,7 @@ while(True):
#Detector polAngle
detector5 = polAngle.get()
#Detector temperature
detector6 = temperature.get()
detector6 = temp.get()
#Detector RingCurrent
detector7 = RingCurrent.get()
#Detector fieldAnalogX
@@ -161,7 +161,7 @@ I0.close()
trans.close()
polarization.close()
polAngle.close()
temperature.close()
temp.close()
RingCurrent.close()
fieldAnalogX.close()
#field.close()
+8
View File
@@ -0,0 +1,8 @@
write_logs()
for i in range(5):
set_file("Test")
run("test/Unit", {"samples":10, "interval":0.2})
#run("test/Unit", [10, 0.2])
+2
View File
@@ -0,0 +1,2 @@
tscan(signal_tey, samples, interval)
#tscan(signal_tey, sys.argv[0], sys.argv[1])