From eb69c46159a47e4220a52b5259245f5415caed7c Mon Sep 17 00:00:00 2001 From: gac-x11ma Date: Tue, 4 Sep 2018 19:31:28 +0200 Subject: [PATCH] Script execution --- script/B_scan.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 script/B_scan.py diff --git a/script/B_scan.py b/script/B_scan.py new file mode 100644 index 0000000..9cc4790 --- /dev/null +++ b/script/B_scan.py @@ -0,0 +1,36 @@ +#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("EnergyMagScan.py") + + + +