diff --git a/script/ManipulatorYZScanAtAngle.py b/script/ManipulatorYZScanAtAngle.py new file mode 100644 index 00000000..4e53321a --- /dev/null +++ b/script/ManipulatorYZScanAtAngle.py @@ -0,0 +1,48 @@ +""" +manipulator grid scan at non-normal theta angle + +set manipulator scan parameters below. +set analyser parameters separately! +move manipulator to center position before start! + +""" + +import math + +# adjust the following parameters +DISTANCE_XY = 1.0 +DISTANCE_Z = 1.0 +ANGLE = -30.0 # move the sample perpendicularly across the beam +#ANGLE = +60.0 # move the sample along the beam +POINTS_XY = 3 +POINTS_Z = 3 + +SENSORS = (Counts, Scienta.spectrum, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) +#SENSORS = (Counts, Scienta.dataMatrix, SampleCurrent, RefCurrent, MachineCurrent, EnergyDistribution, AngleDistribution) +LATENCY = 1.0 +ENDSCAN = True + +# do not edit below +DISTANCE_X = DISTANCE_XY * math.cos(math.radians(ANGLE)) +DISTANCE_Y = DISTANCE_XY * math.sin(math.radians(ANGLE)) + +RELATIVE = True +TOTAL_POINTS = POINTS_XY * POINTS_Z +zv = [(int(i / POINTS_Z) - (POINTS_Z - 1) / 2.) * DISTANCE_Z / 2. for i in range(TOTAL_POINTS)] +xyv = [((i % POINTS_Z) - (POINTS_XY - 1) / 2.) * DISTANCE_XY / 2. for i in range(TOTAL_POINTS)] +xv = [xy * math.cos(math.radians(ANGLE)) for xy in xyv] +yv = [xy * math.sin(math.radians(ANGLE)) for xy in xyv] + +VECTOR = [[xv[i], yv[i], zv[i]] for i in range(TOTAL_POINTS)] + +MOTORS = (ManipulatorX, ManipulatorY, ManipulatorZ) + +adjust_sensors() +set_adc_averaging() + +try: + vscan(MOTORS, SENSORS, VECTOR, line=False, latency=LATENCY, relative=RELATIVE, before_read=before_readout, after_read=after_readout) +finally: + if ENDSCAN: + after_scan() + diff --git a/script/XASFly.py b/script/XASFly.py new file mode 100644 index 00000000..c2693def --- /dev/null +++ b/script/XASFly.py @@ -0,0 +1,54 @@ +""" +XAS on-the-fly scan + +SCRIPT NOT RUNNING! + +TO DO: probably need to wrap the mono in a ch.psi.pshell.device.Motor + or ch.psi.pshell.device.MotorGroupBase +""" + +# scan parameters + +START_ENERGY = 400.0 +END_ENERGY = 410.0 +# total scan time in seconds +SCAN_TIME = 60.0 +# dwell time (per step) in seconds +DWELL = 0.1 +# True = close shutter and turn off detectors at end, False = leave beam and detectors on +ENDSCAN = False + +# --- do not edit below --- + +mm = ch.psi.pshell.device.Motor("X03DA-PGM:MI") +gm = ch.psi.pshell.device.Motor("X03DA-PGM:GR") + +POSITIONERS = (MonoBetaMotor, MonoThetaMotor) +SENSORS = (MonoEnergy, MonoCff, MonoBeta, MonoTheta, SampleCurrent, RefCurrent, MachineCurrent) +STARTPOS = (beta1, theta1) +ENDPOS = (beta2, theta2) + +caput('X03DA-PGM:energy', END_ENERGY) +time.sleep(0.05) +beta1 = caget('X03DA-PGM:beta') +theta1 = caget('X03DA-PGM:theta') +print "end: energy = {en}, beta = {be}, theta = {th}".format(en=END_ENERGY, be=beta1, th=theta1) + +caput('X03DA-PGM:energy', START_ENERGY) +time.sleep(0.05) +beta2 = caget('X03DA-PGM:beta') +theta2 = caget('X03DA-PGM:theta') +print "start: energy = {en}, beta = {be}, theta = {th}".format(en=END_ENERGY, be=beta1, th=theta1) +Eph.write(START_ENERGY) + +LATENCY = 0. + +adjust_sensors() +set_adc_averaging() + +try: + prepare_keithleys(DWELL) + cscan(POSITIONERS, SENSORS, STARTPOS, ENDPOS, NSTEPS-1, time=scan_time, before_read=before_readout, after_read=after_readout) +finally: + if ENDSCAN: + after_scan() diff --git a/script/test/translator.py b/script/test/translator.py new file mode 100644 index 00000000..e69de29b