def setup_method(self):
     hardware = Mock()
     hardware.get_axes_names.return_value = ('d', 'g', 'oh', 'p')
     settings.geometry = WillmottHorizontalGeometry()
     settings.hardware = hardware
     self.ubcalc = UBCalculation(UbCalculationNonPersister(),
                                 WillmottHorizontalUbCalcStrategy())
Exemplo n.º 2
0
    def setup_method(self):

        hardware = Mock()
        hardware.get_axes_names.return_value = ('m', 'd', 'n', 'e', 'c', 'p')
        self.ubcalc = UBCalculation(hardware, SixCircle(),
                                    UbCalculationNonPersister(),
                                    YouUbCalcStrategy())
Exemplo n.º 3
0
 def setup_method(self):
     self.geometry = SixCircleGammaOnArmGeometry()
     mock_hardware = Mock()
     mock_hardware.get_axes_names.return_value = ('a', 'd', 'g', 'o', 'c', 'p')
     self.ubcalc = UBCalculation(
         mock_hardware, self.geometry, UbCalculationNonPersister(),
         VliegUbCalcStrategy())
     self.time = datetime.now()
Exemplo n.º 4
0
 def setup_method(self):
     geometry = SixCircle()  # pass through
     hardware = Mock()
     names = 'm', 'd', 'n', 'e', 'c', 'p'
     hardware.get_axes_names.return_value = names
     self.ubcalc = UBCalculation(hardware,
                                 geometry,
                                 UbCalculationNonPersister(),
                                 YouUbCalcStrategy())
Exemplo n.º 5
0
 def setup_method(self):
     settings.ubcalc_persister = UbCalculationNonPersister()
     settings.geometry = SixCircle()
     settings.ubcalc_strategy = YouUbCalcStrategy()
     settings.angles_to_hkl_function = youAnglesToHkl
     settings.Pos = YouPositionScenario
     self.t_matrix = matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
     self.t_hand = 1
     _UBCommandsBase.setup_method(self)
Exemplo n.º 6
0
 def setup_method(self):
     settings.ubcalc_persister = UbCalculationNonPersister()
     settings.geometry = SixCircleGammaOnArmGeometry()
     settings.ubcalc_strategy = VliegUbCalcStrategy()
     settings.angles_to_hkl_function = vliegAnglesToHkl
     settings.Pos = VliegPosition
     self.t_matrix = matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
     self.t_hand = 1
     _UBCommandsBase.setup_method(self)
    def setup_method(self):

        hardware = Mock()
        names = 'm', 'd', 'n', 'e', 'c', 'p'
        hardware.get_axes_names.return_value = names
        settings.hardware = hardware
        settings.geometry = SixCircle()
        self.ubcalc = UBCalculation(UbCalculationNonPersister(),
                                    YouUbCalcStrategy())
Exemplo n.º 8
0
 def setup_method(self):
     settings.ubcalc_persister = UbCalculationNonPersister()
     inv = matrix([[0, 0, -1], [0, 1, 0], [1, 0, 0]])
     self.zrot = xyz_rotation([0, 0 ,1], 30. * TORAD)
     self.t_matrix = inv * self.zrot
     self.t_hand = 1
     settings.geometry = SixCircle(beamline_axes_transform=self.t_matrix)
     settings.ubcalc_strategy = YouUbCalcStrategy()
     settings.angles_to_hkl_function = youAnglesToHkl
     settings.Pos = YouPositionScenario
     _UBCommandsBase.setup_method(self)
Exemplo n.º 9
0
 def setup_method(self):
     self.geometry = SixCircleGammaOnArmGeometry()
     mock_hardware = Mock()
     mock_hardware.energyScannableMultiplierToGetKeV = 1
     mock_hardware.get_axes_names.return_value = ('a', 'd', 'g', 'o', 'c',
                                                  'p')
     settings.hardware = mock_hardware
     settings.geometry = self.geometry
     self.ubcalc = UBCalculation(UbCalculationNonPersister(),
                                 VliegUbCalcStrategy())
     self.time = datetime.now()
Exemplo n.º 10
0
def setup_module():
    global you
    settings.hardware = ScannableHardwareAdapter(sixc_group, en)
    settings.geometry = SixCircle()
    settings.ubcalc_persister = UbCalculationNonPersister()
    settings.axes_scannable_group = sixc_group
    settings.energy_scannable = en
    settings.ubcalc_strategy = diffcalc.hkl.you.calc.YouUbCalcStrategy()
    settings.angles_to_hkl_function = diffcalc.hkl.you.calc.youAnglesToHkl

    from diffcalc.gdasupport import you
    reload(you)
Exemplo n.º 11
0
 def setup_method(self):
     self.geometry = SixCircleGammaOnArmGeometry()
     self.hardware = DummyHardwareAdapter(
         ('alpha', 'delta', 'gamma', 'omega', 'chi', 'phi'))
     settings.hardware = self.hardware
     settings.geometry = self.geometry
     settings.ubcalc_persister = UbCalculationNonPersister()
     from diffcalc.dc import dcvlieg as dc
     reload(dc)
     self.dc = dc
     self.setSessionAndCalculation()
     prepareRawInput([])
Exemplo n.º 12
0
 def setup_method(self):
     print "TestUBCalcWithCubic.setup_method"
     hardware = Mock()
     hardware.get_axes_names.return_value = \
         ('a', 'd', 'g', 'o', 'c', 'p')
     self.ubcalc = UBCalculation(hardware,
                                 SixCircleGammaOnArmGeometry(),
                                 UbCalculationNonPersister(),
                                 VliegUbCalcStrategy())
     self.ubcalc.start_new('xtalubcalc')
     self.ubcalc.set_lattice("xtal", *CUBIC)
     self.energy = CUBIC_EN
Exemplo n.º 13
0
def setup_module():
    global dc
    axes = 'delta', 'eta', 'chi', 'phi'
    settings.hardware = DummyHardwareAdapter(axes)
    settings.geometry = FourCircle()
    settings.ubcalc_persister = UbCalculationNonPersister()
    
    from diffcalc.dc import dcyou as dc
    reload(dc)
    dc.newub('test')
    dc.setlat('cubic', 1, 1, 1, 90, 90, 90)
    dc.addref([1, 0, 0], [60, 30, 0, 0], en, 'ref1')
    dc.addref([0, 1, 0], [60, 30, 0, 90], en, 'ref2')
Exemplo n.º 14
0
 def setup_method(self):
     print "TestUBCalcWithCubic.setup_method"
     mock_hardware = Mock()
     mock_hardware.energyScannableMultiplierToGetKeV = 1
     mock_hardware.get_axes_names.return_value = \
         ('a', 'd', 'g', 'o', 'c', 'p')
     settings.hardware = mock_hardware
     settings.geometry = SixCircleGammaOnArmGeometry()
     self.ubcalc = UBCalculation(UbCalculationNonPersister(),
                                 VliegUbCalcStrategy())
     self.ubcalc.start_new('xtalubcalc')
     self.ubcalc.set_lattice("xtal", *CUBIC)
     self.energy = CUBIC_EN
Exemplo n.º 15
0
 def setup_method(self):
     from diffcalc import settings
     settings.geometry = SixCircleGammaOnArmGeometry()
     dummy = 'alpha', 'delta', 'gamma', 'omega', 'chi', 'phi'
     settings.hardware = DummyHardwareAdapter(dummy)
     self.mock_ubcalc = Mock(spec=UBCalculation)
     self.hklcalc = VliegHklCalculator(self.mock_ubcalc, True)
     settings.ubcalc_persister = UbCalculationNonPersister()
     
     from diffcalc.hkl.vlieg import hkl
     reload(hkl)
     hkl.hklcalc = self.hklcalc
     self.hkl = hkl
     prepareRawInput([])
Exemplo n.º 16
0
    def setup_method(self):
        names = 'alpha', 'delta', 'gamma', 'omega', 'chi', 'phi'
        self.hardware = DummyHardwareAdapter(names)
        settings.hardware = self.hardware
        settings.ubcalc_persister = UbCalculationNonPersister()
        settings.Pos = None
        self.t_matrix = matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
        self.t_hand = 1

        from diffcalc.ub import ub
        reload(ub)
        self.ub = ub
        #self.ub.ubcalc = ub.ubcalc
        prepareRawInput([])
        diffcalc.util.RAISE_EXCEPTIONS_FOR_ALL_ERRORS = True
Exemplo n.º 17
0
    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)
Exemplo n.º 18
0
    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()
Exemplo n.º 19
0
    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)
 def setup_method(self):
     self.persister = UbCalculationNonPersister()
Exemplo n.º 21
0
'''
Created on Aug 5, 2013

@author: walton
'''
from diffcalc.ub.persistence import UbCalculationNonPersister

try:
    from numpy import matrix
except ImportError:
    from numjy import matrix

# These should be by the user *before* importing other modules
geometry = None
hardware = None
ubcalc_persister = UbCalculationNonPersister()

axes_scannable_group = None
energy_scannable = None
energy_scannable_multiplier_to_get_KeV = 1

# These will be set by dcyou, dcvlieg or dcwillmot
ubcalc_strategy = None
angles_to_hkl_function = None  # Used by checkub to avoid coupling it to an hkl module
include_sigtau = False
include_reference = True

reference_vector = matrix('1; 0; 0')
surface_vector = matrix('0; 0; 1')

NUNAME = 'gam'
Exemplo n.º 22
0
en = Dummy('en')
en.level = 3


### Configure and import diffcalc objects ###
ESMTGKeV = 1
settings.hardware = ScannableHardwareAdapter(_sixc, en, ESMTGKeV)
settings.geometry = diffcalc.hkl.you.geometry.SixCircle()  # @UndefinedVariable
settings.energy_scannable = en
settings.axes_scannable_group= _sixc
settings.energy_scannable_multiplier_to_get_KeV = ESMTGKeV


# For manual!
from diffcalc.ub.persistence import UbCalculationNonPersister
settings.ubcalc_persister = UbCalculationNonPersister()

from diffcalc.gdasupport.you import *  # @UnusedWildImport


DIFFCALC_ROOT = os.sep.join(
    os.path.realpath(diffcalc.__file__).split(os.sep)[:-2])

MANUALS_TO_MAKE = [
    os.path.join(
        DIFFCALC_ROOT, 'doc', 'source', 'youmanual_template.rst'),
    os.path.join(
        DIFFCALC_ROOT, 'README_template.rst')]

print 'MANUALS_TO_MAKE: ', MANUALS_TO_MAKE
Exemplo n.º 23
0
 def _createPersister(self):
     return UbCalculationNonPersister()