85 lines
3.0 KiB
Python
85 lines
3.0 KiB
Python
#Parameters
|
|
"""
|
|
FIELD = "Hx"
|
|
RANGES = [(-0.1, 0.1, 0.1),]
|
|
ENERGIES = (707.90, 703.90)
|
|
ENERGY_CHANGE_SLEEP = 0.5
|
|
FIELD_CHANGE_SLEEP = 22.0
|
|
MODE = 'CIRC +'
|
|
OFFSET = -1.0
|
|
"""
|
|
|
|
|
|
FIELD_PRECISION = 0.01
|
|
field = field_z if FIELD == "Hz" else field_x
|
|
|
|
#Pre-actions
|
|
#wait_beam()
|
|
if MODE is not None:
|
|
pol_mode.write(MODE)
|
|
if OFFSET is not None:
|
|
pol_offset.write(OFFSET) #caput('X07MA-ID:ENERGY-OFFS', OFFSET)
|
|
|
|
pol_done.waitValue("DONE", -1)
|
|
|
|
setpoints = []
|
|
for r in RANGES:
|
|
setpoints = setpoints + frange(r[0], r[1], r[2], True)
|
|
|
|
|
|
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
|
|
|
|
|
|
#Dimension 1
|
|
#RegionPositioner field
|
|
|
|
for setpoint1 in setpoints:
|
|
print "Setting field = ", setpoint1
|
|
#PRObably not needed for newer HW
|
|
"""
|
|
if setpoint1 == 0.002:
|
|
caputq('X07MA-PC-PS2:SET:RAMP:TARGEFIELD_CHANGE_SLEEPT', 'Zero')
|
|
sleep(6.0)
|
|
caputq('X07MA-PC-PS2:SET:RAMP:DIR', 'Forward')
|
|
sleep(6.0)
|
|
caputq('X07MA-PC-PS2:SET:RAMP:TARGET', 'Lower')
|
|
sleep(6.0)
|
|
caputq('X07MA-PC-PS2:SET:DMD:POINT:LFIELD_CHANGE_SLEEPOWER', '0.002')
|
|
sleep(15.0)
|
|
"""
|
|
field_x.write(setpoint1)
|
|
field_x.readback.waitValueInRange(setpoint1,FIELD_PRECISION,300000)
|
|
|
|
readback1 = field.getPosition()
|
|
#print readback1
|
|
#if abs(readback1 - setpoint1) > FIELD_PRECISION : # TODO: Check accuracy
|
|
# raise Exception('Field could not be set to ' + str(setpoint1))
|
|
time.sleep( FIELD_CHANGE_SLEEP ) # TODO: Settling time
|
|
#Dimension 2
|
|
#ArrayPositioner Energy
|
|
for setpoint2 in ENERGIES:
|
|
print "Setting energy = ", setpoint2
|
|
energy.write(setpoint2)
|
|
readback2 = energy_readback.read()
|
|
if abs(readback2 - setpoint2) > 0.1 : # TODO: Check accuracy
|
|
raise Exception('Actor Energy could not be set to the value ' + str(setpoint2))
|
|
sleep( ENERGY_CHANGE_SLEEP ) # Settling time
|
|
|
|
detector1 = signal_tey.read() #TEY.get()
|
|
detector2 = signal_i0.read() #I0.get()
|
|
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()
|
|
detector7 = current.read()
|
|
detector8 = signal_field_analog_x.read() # fieldAnalogX.get()
|
|
tey_norm = detector1/detector2
|
|
trans_norm = detector3/detector2
|
|
scan.append ([setpoint1, setpoint2], [readback1, readback2], [detector1, detector2, detector3, detector4, detector5, detector6, detector7, detector8, tey_norm, trans_norm])
|
|
|
|
scan.end()
|