This commit is contained in:
@@ -4,7 +4,6 @@ delta.speed = 50.0
|
||||
delta.move(1.0)
|
||||
|
||||
run("diffcalc/diffutils")
|
||||
|
||||
###################################################################################################\
|
||||
#Setup
|
||||
###################################################################################################
|
||||
@@ -47,8 +46,6 @@ ub.checkub()
|
||||
###################################################################################################\
|
||||
#Constraints
|
||||
###################################################################################################
|
||||
|
||||
|
||||
help(hkl.con)
|
||||
hkl.con('qaz', 90)
|
||||
hkl.con('a_eq_b')
|
||||
@@ -59,36 +56,30 @@ hkl.con()
|
||||
#Motion
|
||||
###################################################################################################
|
||||
print angles_to_hkl((0., 60., 0., 30., 0., 0.))
|
||||
|
||||
print hkl_to_angles(1, 0, 0)
|
||||
|
||||
sixc.write([0, 60, 0, 30, 90, 0])
|
||||
print "sixc=" , sixc.position
|
||||
wl.write(1.0)
|
||||
print "wl = ", wl.read()
|
||||
|
||||
|
||||
ub.lastub()
|
||||
ub.setu ([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
|
||||
ub.showref()
|
||||
ub.swapref(1,2)
|
||||
|
||||
|
||||
#print you.hkl
|
||||
#pos(get_hkl())
|
||||
hkl_group.read()
|
||||
|
||||
#you.hkl.simulateMoveTo([0,1,1])
|
||||
#sim(get_hkl(), [0,1,1])
|
||||
hkl_group.sim([0.0,1.0,1.0])
|
||||
|
||||
#pos(get_hkl(), [0,1,1])
|
||||
hkl_group.write([0.0,1.0,1.0])
|
||||
|
||||
|
||||
###################################################################################################\
|
||||
#Scans
|
||||
###################################################################################################
|
||||
|
||||
|
||||
###################################################################################################
|
||||
lscan(l, [sin], 1.0, 1.5, 0.1)
|
||||
ascan([k,l], [sin], [1.0, 1.0], [1.2, 1.3], [0.1, 0.1], zigzag=True, parallel_positioning = False)
|
||||
vector = [[1.0,1.0,1.0], [1.0,1.0,1.1], [1.0,1.0,1.2], [1.0,1.0,1.4]]
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
###################################################################################################\
|
||||
# Diffcalc utilities
|
||||
###################################################################################################
|
||||
|
||||
###################################################################################################\
|
||||
# Installaling
|
||||
###################################################################################################
|
||||
|
||||
#1- Download from: https://github.com/DiamondLightSource/diffcalc/archive/master.zip
|
||||
#2- Extract the contents to {script}/Lib/diffcalc
|
||||
#3- Download http://central.maven.org/maven2/gov/nist/math/jama/1.0.3/jama-1.0.3.jar
|
||||
# to the extensions folder.
|
||||
|
||||
###################################################################################################\
|
||||
# Library loading and Hardware setup
|
||||
###################################################################################################
|
||||
|
||||
#1- Create a MontorGroup with the diffractometer motors
|
||||
# e.g named 'sixc', containing mu, delta, gam, eta, chi, phi motors
|
||||
#2- Create positioner to read/set the energy in kEv, e.g. named 'en'
|
||||
#3- Execute: run("diffutils")
|
||||
#4- Execute: setup_sixc(sixc, en)
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
import traceback
|
||||
|
||||
@@ -285,46 +309,67 @@ def hklscan(vector, readables,latency = 0.0, passes = 1, **pars):
|
||||
return scan.result
|
||||
|
||||
|
||||
"""
|
||||
en.move(20.0)
|
||||
delta.move(1.0)
|
||||
def test():
|
||||
en.move(20.0)
|
||||
delta.config.maxSpeed = 50.0
|
||||
delta.speed = 50.0
|
||||
delta.move(1.0)
|
||||
|
||||
setup_sixc(sixc, en)
|
||||
#Setup
|
||||
setup_sixc(sixc, en)
|
||||
setup_axis('gam', 0, 179)
|
||||
setup_axis('delta', 0, 179)
|
||||
setup_axis('delta', min=0)
|
||||
setup_axis('phi', cut=-180.0)
|
||||
print_axis_setup()
|
||||
|
||||
#Orientation
|
||||
help(ub.ub)
|
||||
ub.listub()
|
||||
# Create a new ub calculation and set lattice parameters
|
||||
ub.newub('test')
|
||||
ub.setlat('cubic', 1, 1, 1, 90, 90, 90)
|
||||
# Add 1st reflection (demonstrating the hardware adapter)
|
||||
settings.hardware.wavelength = 1
|
||||
ub.c2th([1, 0, 0]) # energy from hardware
|
||||
settings.hardware.position = 0, 60, 0, 30, 0, 0
|
||||
ub.addref([1, 0, 0])# energy and position from hardware
|
||||
# Add 2nd reflection (this time without the harware adapter)
|
||||
ub.c2th([0, 1, 0], 12.39842)
|
||||
ub.addref([0, 1, 0], [0, 60, 0, 30, 0, 90], 12.39842)
|
||||
# check the state
|
||||
ub.ub()
|
||||
ub.checkub()
|
||||
|
||||
hardware.setmin('gam', 0) #-179)
|
||||
hardware.setmax('gam', 179)
|
||||
#Constraints
|
||||
help(hkl.con)
|
||||
hkl.con('qaz', 90)
|
||||
hkl.con('a_eq_b')
|
||||
hkl.con('mu', 0)
|
||||
hkl.con()
|
||||
|
||||
hardware.setmin('delta', 0)
|
||||
hardware.setmax('delta', 179)
|
||||
|
||||
ub.listub()
|
||||
# Create a new ub calculation and set lattice parameters
|
||||
ub.newub('test')
|
||||
ub.setlat('cubic', 1, 1, 1, 90, 90, 90)
|
||||
# Add 1st reflection (demonstrating the hardware adapter)
|
||||
settings.hardware.wavelength = 1
|
||||
ub.c2th([1, 0, 0]) # energy from hardware
|
||||
settings.hardware.position = 0, 60, 0, 30, 0, 0
|
||||
ub.addref([1, 0, 0])# energy and position from hardware
|
||||
# Add 2nd reflection (this time without the harware adapter)
|
||||
ub.c2th([0, 1, 0], 12.39842)
|
||||
ub.addref([0, 1, 0], [0, 60, 0, 30, 0, 90], 12.39842)
|
||||
|
||||
# check the state
|
||||
ub.ub()
|
||||
ub.checkub()
|
||||
dc.angles_to_hkl((0., 60., 0., 30., 0., 0.))
|
||||
hkl.con('qaz', 90)
|
||||
hkl.con('a_eq_b')
|
||||
hkl.con('mu', 0)
|
||||
hardware.setmin('delta', 0)
|
||||
hardware.setcut('phi', -180.0)
|
||||
dc.hkl_to_angles(1, 0, 0)
|
||||
"""
|
||||
|
||||
|
||||
#lscan(l, [sin], 1.0, 1.5, 0.1)
|
||||
#ascan([k,l], [sin], [1.0, 1.0], [1.2, 1.3], [0.1, 0.1], zigzag=True, parallel_positioning = False)
|
||||
#vector = [[1.0,1.0,1.0], [1.0,1.0,1.1], [1.0,1.0,1.2], [1.0,1.0,1.4]]
|
||||
#hklscan(vector, [sin, arr], 0.9) #, = "Index" )#, line_plots = [sin])
|
||||
#Motion
|
||||
print angles_to_hkl((0., 60., 0., 30., 0., 0.))
|
||||
print hkl_to_angles(1, 0, 0)
|
||||
sixc.write([0, 60, 0, 30, 90, 0])
|
||||
print "sixc=" , sixc.position
|
||||
wl.write(1.0)
|
||||
print "wl = ", wl.read()
|
||||
ub.lastub()
|
||||
ub.setu ([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
|
||||
ub.showref()
|
||||
ub.swapref(1,2)
|
||||
#print you.hkl
|
||||
#pos(get_hkl())
|
||||
hkl_group.read()
|
||||
#you.hkl.simulateMoveTo([0,1,1])
|
||||
#sim(get_hkl(), [0,1,1])
|
||||
hkl_group.sim([0.0,1.0,1.0])
|
||||
#pos(get_hkl(), [0,1,1])
|
||||
hkl_group.write([0.0,1.0,1.0])
|
||||
|
||||
#Scans
|
||||
lscan(l, [sin], 1.0, 1.5, 0.1)
|
||||
ascan([k,l], [sin], [1.0, 1.0], [1.2, 1.3], [0.1, 0.1], zigzag=True, parallel_positioning = False)
|
||||
vector = [[1.0,1.0,1.0], [1.0,1.0,1.1], [1.0,1.0,1.2], [1.0,1.0,1.4]]
|
||||
hklscan(vector, [sin, arr], 0.9)
|
||||
|
||||
Reference in New Issue
Block a user