Exemplo n.º 1
0
def createScannables(posA=0, posB=0, posC=0, posMie=[1, 2.1]):
    a, b, c = DummyPD('a'), DummyPD('b'), DummyPD('c')
    a.__repr__ = a.getName
    b.__repr__ = b.getName
    c.__repr__ = c.getName
    a.asynchronousMoveTo(posA)
    b.asynchronousMoveTo(posB)
    c.asynchronousMoveTo(posC)
    mie = MultiInputExtraFieldsDummyPD('mie', ['i1', 'i2'], ['e1', 'e2'])
    mie.asynchronousMoveTo(posMie)
    mie.__repr__ = mie.getName
    return (a, b, c, mie)
    def createDiffcalcAndScannables(self):
        self.en = DummyPD('en')
        dummy = createDummyAxes(['delta', 'omega', 'chi', 'phi'])
        scannableGroup = ScannableGroup('fourcgrp', dummy)
        self.fourc = DiffractometerScannableGroup('fourc', None,
                                                  scannableGroup)

        settings.hardware = ScannableHardwareAdapter(self.fourc, self.en)
        settings.geometry = Fourc()
        settings.ubcalc_persister = UbCalculationNonPersister()

        from diffcalc.dc import dcvlieg as dc
        reload(dc)
        self.dc = dc

        self.fourc.diffcalc = self.dc
        self.hkl = Hkl('hkl', self.fourc, self.dc)
    def setup_method(self):
        self.en = DummyPD('en')
        dummy = createDummyAxes(['alpha', 'delta', 'omega', 'chi', 'phi'])
        group = ScannableGroup('fivecgrp', dummy)
        self.fivec = DiffractometerScannableGroup('fivec', None, group)

        settings.hardware = ScannableHardwareAdapter(self.fivec, self.en)
        settings.geometry = Fivec()
        settings.ubcalc_persister = UbCalculationNonPersister()
        from diffcalc.dc import dcvlieg as dc
        reload(dc)
        self.dc = dc

        self.fivec.diffcalc = self.dc
        self.hkl = Hkl('hkl', self.fivec, self.dc)
        self.hklverbose = Hkl('hkl', self.fivec, self.dc,
                              ('theta', '2theta', 'Bin', 'Bout', 'azimuth'))
        self.orient()
    def createDiffcalcAndScannables(self, geometryClass):
        self.en = DummyPD('en')
        dummy = createDummyAxes(
            ['alpha', 'delta', 'gamma', 'omega', 'chi', 'phi'])
        group = ScannableGroup('sixcgrp', dummy)
        self.sixc = DiffractometerScannableGroup('sixc', None, group)

        self.hardware = DummyHardwareAdapter(
            ('alpha', 'delta', 'gamma', 'omega', 'chi', 'phi'))
        settings.hardware = ScannableHardwareAdapter(self.sixc, self.en)
        settings.geometry = geometryClass()
        settings.ubcalc_persister = UbCalculationNonPersister()
        from diffcalc.dc import dcvlieg as dc
        reload(dc)
        self.dc = dc

        self.sixc.diffcalc = self.dc
        self.hkl = Hkl('hkl', self.sixc, self.dc)
Exemplo n.º 5
0
 def testSetWithScannable(self):
     alpha = DummyPD('alpha')
     self.hkl.setpar(alpha, 1.1)
     pm = self.hkl.hklcalc.parameter_manager
     assert pm.get_constraint('alpha') == 1.1
Exemplo n.º 6
0

# Dotted access to scannables
import ScannableMotionBase74
reload(ScannableMotionBase74)

iie = ScannableMotionBase74.MultiInputDummyPD74('iie',['i1','i2'],['e1'])
pos iie (1,2)
print iie
print iie.i1
print iie.i2
print iie.e1

pos iie.i1 3
pos iie.i2 4

print iie
print iie['e1']


print "Testing groups"

# Test Group Scannable with one element inputs
from gdascripts.pd.dummy_pds import DummyPD
ab__a=DummyPD('ab__a')
ab__b=DummyPD('ab__b')

import ScannableMotionGroup
reload(ScannableMotionGroup)
ab = ScannableMotionGroup.ScannableMotionGroup('ab',[ab__a,ab__b], ['a','b'],[])
def createDummyAxes(names):
    result = []
    for name in names:
        result.append(DummyPD(name))
    return result
 def setup_method(self):
     ZAxisGammaOnBaseTest.setup_method(self)
     self.nu = DummyPD('nu')
     self.sixc.slaveScannableDriver = NuDriverForSixCirclePlugin(self.nu)
Exemplo n.º 9
0
except ImportError:
    from gda.configuration.properties import LocalProperties
    import sys
    diffcalc_path = LocalProperties.get(
        "gda.install.git.loc") + '/diffcalc.git'
    sys.path = [diffcalc_path] + sys.path
    print diffcalc_path + ' added to GDA Jython path.'
    import diffcalc

from gdascripts.pd.dummy_pds import DummyPD
from diffcalc.gdasupport.factory import create_objects, add_objects_to_namespace

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],
Exemplo n.º 10
0
 def setup_method(self):
     self.en = DummyPD('en')
     self.wl = Wavelength('wl', self.en)
Exemplo n.º 11
0
                                      TraceObjectsMethodCallsProxy):
    """Prints and/or logs a scannables method calls using the TraceFunctionCall module"""
    def getObjectTag(self):
        return self.obj.getName()


def createTracedScannable(scannable, traceFunctionCall=None):
    """A conveniance method to trace only calls to a scannable to do with moving it"""
    from gdadevscripts.developertools.TraceFunctionCall import TraceFunctionCall
    #	from gdadevscripts.developertools.TraceObjectsMethodCallsProxy import TraceScannablesMethodCallsProxy
    if traceFunctionCall == None:
        inandout = ["In", "Out"]
        inonly = [
            "In",
        ]
        hide = [()]
        options = [(r'.*Names', hide), (r'getName', hide), (r'.*Format', hide),
                   (r'at.*', inonly), (r'.*', inandout)]
        traceFunctionCall = TraceFunctionCall(options, toGdaLog=True)

    return TraceScannablesMethodCallsProxy(traceFunctionCall, scannable)


if __name__ == '__main__':
    from gdascripts.pd.dummy_pds import DummyPD
    from gdadevscripts.developertools import TraceObjectsMethodCallsProxy
    xval = DummyPD("xval")

    #create the scannable wrapper
    xval_log = TraceObjectsMethodCallsProxy.createTracedScannable(xval)
Exemplo n.º 12
0
from gdascripts.pd.dummy_pds import DummyPD
from gdascripts.pd.dummy_pds import MultiInputExtraFieldsDummyPD
from gdascripts.pd.dummy_pds import ZeroInputExtraFieldsDummyPD

from gdascripts.pd.time_pds import showtimeClass
from gdascripts.pd.time_pds import showincrementaltimeClass
from gdascripts.pd.time_pds import waittimeClass

print "Creating dummy devices x,y and z"
x=DummyPD("x")
y=DummyPD("y")
z=DummyPD("z")

print "Creating timer devices t, dt, and w"
t = showtimeClass("t") # cannot also be driven.
dt= showincrementaltimeClass("dt")
w = waittimeClass("w")


print "Creating multi input/extra field device, mi, me and mie"
mi=MultiInputExtraFieldsDummyPD('mi',['i1','i2'],[])
me=MultiInputExtraFieldsDummyPD('me',[],['e1','e2'])
mie=MultiInputExtraFieldsDummyPD('mie',['i1'],['e2','e3'])

print "Createing zero input/extra field device, zie"
zie=ZeroInputExtraFieldsDummyPD('zie')
Exemplo n.º 13
0
demoCommands.append("setlat 'cubic' 1 1 1 90 90 90")
demoCommands.append("pos wl 1")
demoCommands.append("pos fourc [60 30 90 0]")
demoCommands.append("addref 0 0 1")
demoCommands.append("addref 1 0 0 [60 30 0 0] 12.39842")
demoCommands.append("checkub")
demoCommands.append("ub")
demoCommands.append("hklmode")

#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