Files
x11ma/script/Users/Juraj/B_scan.py
2021-03-12 12:19:10 +01:00

37 lines
986 B
Python
Executable File

#Parameters
"""
B1 = 20 # starting mag. field in Amps
B2 = -20 # final mag. field in Amps
BSTEP = -0.5 # step size mag. field in Amps
FIELD_PRECISION = 0.05 # in Amps
FIELD_CHANGE_SLEEP = 0.0 # put the Field settling time if needed
"""
# List of scans. Each scan is defined as: (start,stop, step)
# to make a whole loop two scans are needed: [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
# to make half of a loop one scan is needed: [(B1, B2, BSTEP),] <- don't forget to put comma before ]
RANGES = [(B1, B2, BSTEP),(B2,B1,-BSTEP)]
setpoints = []
for r in RANGES:
setpoints = setpoints + frange(r[0], r[1], r[2], True)
# Main loop
for B in setpoints:
print "Setting field = ", B
caput("X11MA-XMCD:I-SETraw",B)
time.sleep(FIELD_CHANGE_SLEEP ) # Settling time
readback1 = caget("X11MA-XMCD:Ireadout")
while abs(readback1-B) > FIELD_PRECISION:
readback1 = caget("X11MA-XMCD:Ireadout")
time.sleep(0.5)
run("E_scan.py")