def setup(self):
     axis_names = ('mu', 'delta', 'gam', 'eta', 'chi', 'phi')
     virtual_angles = ('theta', 'qaz', 'alpha', 'naz', 'tau', 'psi', 'beta')
     self.objects = create_objects(
         engine_name='you',
         geometry='sixc',
         dummy_axis_names=axis_names,
         dummy_energy_name='en',
         hklverbose_virtual_angles_to_report=virtual_angles,
         simulated_crystal_counter_name='ct'
         )
     for name, obj in self.objects.iteritems():
         if inspect.ismethod(obj):
             globals()[name] = wrap_command_to_print_calls(
                                   obj, PRINT_WITH_USER_SYNTAX)
         else:
             globals()[name] = obj
Exemplo n.º 2
0
    def testCreateDiffcalcObjects(self):
        virtual_names = '2theta', 'Bin', 'Bout', 'azimuth'
        objects = Factory.create_objects(
            dummy_axis_names=self.motorNames,
            dummy_energy_name='en',
            geometry='sixc',  # Class or name (avoids needing to set path
                                    # before script is run)
            hklverbose_virtual_angles_to_report=virtual_names)
        print objects.keys()

        def assertHas(a, b):
            for aa in a:
                if aa not in b:
                    raise Exception("%s not in %s." % (aa, b))

        expected = ('en', 'wl', 'sixc', 'hkl', 'h', 'k', 'l', 'hklverbose',
                    'sixc', 'dc')
        assertHas(self.motorNames + expected, objects.keys())
Exemplo n.º 3
0
#rpenergy = DummyPD('rpenergy')
#rpenergy.moveTo(12398.42)
#exec('del tth, th, chi, phi')
CREATE_DUMMY_AXES = False
if CREATE_DUMMY_AXES:
	print "Creating Dummy Axes: tth, th, chi, phi and rpenergy"
	tth = DummyPD('tth'); tth.setLowerGdaLimits(-80); tth.setUpperGdaLimits(260)
	th  = DummyPD('th');th.setLowerGdaLimits(-100); th.setUpperGdaLimits(190)
	chi = DummyPD('chi'); chi.setLowerGdaLimits(86); chi.setUpperGdaLimits(94)
	phi = DummyPD('phi')
	rpenergy = DummyPD('rpenergy')
	rpenergy.moveTo(12398.42)
	print "Moved rpenergy to 12398.42 eV (1 Angstrom)"
	chi.moveTo(90)
	print "Moved chi to 90"
	print "="*80

diffcalcObjects = create_objects(
	axis_scannable_list = (tth, th, chi, phi),
	energy_scannable = denergy,
	energy_scannable_multiplier_to_get_KeV = .001,
	geometry = 'fourc',
	hklverbose_virtual_angles_to_report=('2theta','Bin','Bout','azimuth'),
	demo_commands = demoCommands
)
diffcalcObjects['alpha_par'] = diffcalcObjects['alpha']
del diffcalcObjects['alpha']
diffcalcObjects['diffcalcdemo'].commands = demoCommands
add_objects_to_namespace(diffcalcObjects, globals())
Exemplo n.º 4
0
CREATE_DUMMY_AXES = False
if CREATE_DUMMY_AXES:
    print "!!! Starting dummy diffcalc with tth, th, chi, phi and en."
    tth = DummyPD('tth')
    th = DummyPD('th')
    en = DummyPD('en')
    en(1500)
    diffcalc_energy = en
else:
    print "!!! Starting LIVE diffcalc with th(dd2th), th(ddth), chi(dummy), phi(dummy) and denergy."
    tth = dd2th
    th = ddth
    diffcalc_energy = denergy

chi = DummyPD('chi')
phi = DummyPD('phi')

diffcalcObjects = create_objects(
    axis_scannable_list=[tth, th, chi, phi],
    energy_scannable=diffcalc_energy,
    energy_scannable_multiplier_to_get_KeV=.001,
    geometry='fourc',
    hklverbose_virtual_angles_to_report=('2theta', 'Bin', 'Bout', 'azimuth'))

#demoCommands = []
#diffcalcObjects['diffcalcdemo'].commands = demoCommands
add_objects_to_namespace(diffcalcObjects, globals())

hkl.level = 6
Exemplo n.º 5
0
mu = SingleFieldDummyScannable('mu')
delta = SingleFieldDummyScannable('delta')
gam = SingleFieldDummyScannable('gam')
eta = SingleFieldDummyScannable('eta')
chi = SingleFieldDummyScannable('chi')
phi = SingleFieldDummyScannable('phi')

en = SingleFieldDummyScannable('en')
en.level = 3

virtual_angles = ('theta', 'qaz', 'alpha', 'naz', 'tau', 'psi', 'beta')
_objects = create_objects(
    engine_name='you',
    geometry='sixc',
    axis_scannable_list=(mu, delta, gam, eta, chi, phi),
    energy_scannable=en,
    hklverbose_virtual_angles_to_report=virtual_angles,
    simulated_crystal_counter_name='ct',
#    demo_commands=_demo
    )

#_objects['diffcalcdemo'].commands = demoCommands
add_objects_to_namespace(_objects, globals())

from diffcalc.gdasupport.minigda import command
pos = command.Pos(globals())
scan = command.Scan(command.ScanDataPrinter())
print '=' * 80

#def help_hkl():
#    print hkl.__doc__
Exemplo n.º 6
0
    import diffcalc
#####

from diffcalc.gdasupport.factory import create_objects, add_objects_to_namespace

demoCommands = []
demoCommands.append("newub 'cubic'")
demoCommands.append("setlat 'cubic' 1 1 1 90 90 90")
demoCommands.append("pos wl 1")
demoCommands.append("pos fivec [0 60 30 1 0]")
demoCommands.append("addref 1 0 0")
demoCommands.append("pos chi 91")
demoCommands.append("addref 0 0 1")
demoCommands.append("checkub")
demoCommands.append("ub")
demoCommands.append("hklmode")

diffcalcObjects = create_objects(
    # axisScannableList = (alpha, delta, omega, chi, phi), #@UndefinedVariable
    axes_group_scannable=dif,  # @UndefinedVariable
    energy_scannable=energy,  # @UndefinedVariable
    energy_scannable_multiplier_to_get_KeV=0.001,
    geometry="fivec",
    hklverbose_virtual_angles_to_report=("2theta", "Bin", "Bout", "azimuth"),
    demo_commands=demoCommands,
    simulated_crystal_counter_name="ct",
)

diffcalcObjects["diffcalcdemo"].commands = demoCommands
add_objects_to_namespace(diffcalcObjects, globals())
demoCommands.append("ub")
demoCommands.append("hklmode")


sixcgrp = VrmlModelDriver("sixcgrp", ["alpha", "delta", "gamma", "omega", "chi", "phi"], speed=30, host="localhost")
alpha = sixcgrp.alpha
delta = sixcgrp.delta
gamma = sixcgrp.gamma
omega = sixcgrp.omega
chi = sixcgrp.chi
phi = sixcgrp.phi

print "=" * 80
print "Run from diffcalc/models (in Bash):"
print "python vrml_animator.py sixc.wrl 4567 alpha delta gamma omega chi phi"
print "=" * 80
diffcalcObjects = create_objects(
    axes_group_scannable=sixcgrp,
    dummy_energy_name="en",
    geometry_plugin="sixc",
    hklverbose_virtual_angles_to_report=("2theta", "Bin", "Bout", "azimuth"),
    simulated_crystal_counter_name="ct",
    demo_commands=demoCommands,
)

diffcalcObjects["diffcalcdemo"].commands = demoCommands
add_objects_to_namespace(diffcalcObjects, globals())

ct.setChiMissmount(1)  # @UndefinedVariable
ct.setPhiMissmount(1)  # @UndefinedVariable
"""

import diffcalc
#####

del alpha
from diffcalc.gdasupport.factory import create_objects, add_objects_to_namespace

demoCommands = []

diffcalcObjects = create_objects(
	#axisScannableList = (alpha, delta, omega, chi, phi), #@UndefinedVariable
	axes_group_scannable = _fourc, #@UndefinedVariable
	energy_scannable = energy, #@UndefinedVariable
	energy_scannable_multiplier_to_get_KeV = 0.001,
	geometry = diffcalc.hkl.you.geometry.FourCircle(),
	hklverbose_virtual_angles_to_report=('theta','alpha','beta','psi'),
	demo_commands = demoCommands,
	engine_name = 'you',
	simulated_crystal_counter_name = 'ct'
)

#diffcalcObjects['diffcalcdemo'].commands = demoCommands
add_objects_to_namespace(diffcalcObjects, globals())

# does not work yet:
diffcalc.gdasupport.factory.override_gda_help_command(globals())
alias('help')

#demoCommands.append( "newub 'cubic'" )
#demoCommands.append( "setlat 'cubic' 1 1 1 90 90 90" )