Пример #1
0
class TestWavelength(object):
    def setup_method(self):
        self.en = DummyPD('en')
        self.wl = Wavelength('wl', self.en)

    def testIt(self):
        self.en.asynchronousMoveTo(12.39842)
        assert self.wl.getPosition() == 1

        self.wl.asynchronousMoveTo(1.)
        assert self.wl.getPosition() == 1.
        assert self.en.getPosition() == 12.39842
Пример #2
0
class TestWavelength(object):

    def setup_method(self):
        self.en = DummyPD('en')
        self.wl = Wavelength('wl', self.en)

    def testIt(self):
        self.en.asynchronousMoveTo(12.39842)
        assert self.wl.getPosition() == 1

        self.wl.asynchronousMoveTo(1.)
        assert self.wl.getPosition() == 1.
        assert self.en.getPosition() == 12.39842
class TestWavelength(unittest.TestCase):

    def setUp(self):
        self.en = DummyPD('en')
        self.wl = Wavelength('wl', self.en)

    def testIt(self):
        self.en.asynchronousMoveTo(12.39842)
        self.assertEqual(self.wl.getPosition(), 1)

        self.wl.asynchronousMoveTo(1.)
        self.assertEqual(self.wl.getPosition(), 1.)
        self.assertEqual(self.en.getPosition(), 12.39842)
Пример #4
0
def usesim():
    # sample chamber
    print '- setting hkl ---> hkl_sim'
    print '-          en ---> simenergy'
    global settings
    settings.hardware = _hw_sim
    settings.energy_scannable = simenergy
    settings.axes_scannable_group = _sim_fourc

    # Create diffractometer scannable
    import __main__
    _diff_scn_name = settings.geometry.name
    from diffcalc.dc import dcyou as _dc
    _diff_scn = DiffractometerScannableGroup(_diff_scn_name, _dc, _sim_fourc)
    hkl_sim = Hkl('hkl_sim', _sim_fourc,
                  DiffractometerYouCalculator(_hw_sim, settings.geometry))

    __main__.hkl = hkl_sim
    __main__.h = hkl_sim.h
    __main__.k = hkl_sim.k
    __main__.l = hkl_sim.l
    setLimitsAndCuts(simtth, simth, simchi, simalpha)
    __main__.fourc = _diff_scn
    from diffcalc.gdasupport.you import _virtual_angles
    __main__.hklverbose = Hkl('hklverbose', __main__.fourc, _dc,
                              _virtual_angles)
    if GDA:
        __main__.en = simenergy
        __main__.wl = Wavelength('wl', __main__.en,
                                 ESMTGKeV)  # @UndefinedVariable
        __main__.ct = SimulatedCrystalCounter(
            'ct', __main__.fourc, settings.geometry,
            __main__.wl)  # @UndefinedVariable
Пример #5
0
def usepoint():
    print '- setting hkl ---> hkl_point'
    global settings
    settings.hardware = _hw
    settings.energy_scannable = pgm_energy
    settings.axes_scannable_group = _fourc

    # Create diffractometer scannable
    from diffcalc.dc import dcyou as _dc
    _diff_scn = DiffractometerScannableGroup(settings.geometry.name, _dc,
                                             _fourc)

    setLimitsAndCuts(tth, th, chi, phi)
    import __main__
    __main__.hkl = hkl_point
    __main__.h = hkl_point.h
    __main__.k = hkl_point.k
    __main__.l = hkl_point.l
    __main__.fourc = _diff_scn
    from diffcalc.gdasupport.you import _virtual_angles
    __main__.hklverbose = Hkl('hklverbose', __main__.fourc, _dc,
                              _virtual_angles)
    if GDA:
        __main__.en = pgm_energy
        __main__.wl = Wavelength('wl', __main__.en,
                                 ESMTGKeV)  # @UndefinedVariable
        __main__.ct = SimulatedCrystalCounter(
            'ct', __main__.fourc, settings.geometry,
            __main__.wl)  # @UndefinedVariable
Пример #6
0
    def swithMotors(delta, mu, eta, chi, phi):
        import __main__
        from diffcalc.dc import dcyou as _dc

        ### update Wrap i21 names to get diffcalc names
        _fourc = ScannableGroup('_fourc', (delta, mu, eta, chi, phi))
        #update diffcalc objects
        __main__.settings.hardware = ScannableHardwareAdapter(
            _fourc, __main__.en, ESMTGKeV)  # @UndefinedVariable
        __main__.settings.geometry = diffcalc.hkl.you.geometry.FourCircle(
        )  # @UndefinedVariable
        __main__.settings.energy_scannable = __main__.en  # @UndefinedVariable
        __main__.settings.axes_scannable_group = _fourc
        __main__.settings.energy_scannable_multiplier_to_get_KeV = ESMTGKeV

        __main__.fourc = DiffractometerScannableGroup('fourc', _dc, _fourc)
        __main__.hkl = Hkl('hkl', _fourc, _dc)
        __main__.h, __main__.k, __main__.l = hkl.h, hkl.k, hkl.l

        from diffcalc.gdasupport.you import _virtual_angles
        from diffcalc.gdasupport.scannable.simulation import SimulatedCrystalCounter
        from diffcalc.gdasupport.scannable.wavelength import Wavelength
        __main__.hklverbose = Hkl('hklverbose', _fourc, _dc, _virtual_angles)
        __main__.wl = Wavelength('wl', __main__.en,
                                 ESMTGKeV)  # @UndefinedVariable
        __main__.ct = SimulatedCrystalCounter(
            'ct', _fourc, __main__.settings.geometry,
            __main__.wl)  # @UndefinedVariable
Пример #7
0
    def swithMotors(sax, say, saz, sath, sachi, saphi, diodedelta, specm5tth):
        import __main__
        __main__.xyz_eta = ScannableGroup('xyz_eta', [sax, say, saz])  # @UndefinedVariable
        #update support for i21 non-concentric rotation motions
        __main__.sa = I21SampleStage('sa', sath, sachi, saphi,__main__.xyz_eta)  # @UndefinedVariable
        
        __main__.tp_phi = sa.tp_phi_scannable
        
        __main__.tp_lab = I21TPLab('tp_lab', __main__.sa)  # @UndefinedVariable
        __main__.tp_labx = __main__.tp_lab.tp_labx  # @UndefinedVariable
        __main__.tp_laby = __main__.tp_lab.tp_laby  # @UndefinedVariable
        __main__.tp_labz = __main__.tp_lab.tp_labz  # @UndefinedVariable
        
        ### update Wrap i21 names to get diffcalc names
        _fourc = I21DiffractometerStage('_fourc', diodedelta, __main__.sa)  # @UndefinedVariable
        __main__.delta = _fourc.delta
        __main__.eta = _fourc.eta
        __main__.chi = _fourc.chi
        __main__.phi = _fourc.phi
            #update diffcalc objects
        __main__.settings.hardware = ScannableHardwareAdapter(_fourc, __main__.en, ESMTGKeV)  # @UndefinedVariable
        __main__.settings.geometry = FourCircleI21(beamline_axes_transform=beamline_axes_transform)  # @UndefinedVariable
        __main__.settings.energy_scannable = __main__.en  # @UndefinedVariable
        __main__.settings.axes_scannable_group= _fourc
        __main__.settings.energy_scannable_multiplier_to_get_KeV = ESMTGKeV
        
        __main__.fourc=DiffractometerScannableGroup('fourc', _dc, _fourc)
        __main__.hkl = Hkl('hkl', _fourc, _dc)
        __main__.h, __main__.k, __main__.l = hkl.h, hkl.k, hkl.l

        from diffcalc.gdasupport.you import _virtual_angles
        from diffcalc.gdasupport.scannable.simulation import SimulatedCrystalCounter
        from diffcalc.gdasupport.scannable.wavelength import Wavelength
        __main__.hklverbose = Hkl('hklverbose', _fourc, _dc, _virtual_angles)
        __main__.wl = Wavelength('wl',__main__.en,ESMTGKeV)  # @UndefinedVariable
        __main__.ct = SimulatedCrystalCounter('ct', _fourc, __main__.settings.geometry,__main__.wl)  # @UndefinedVariable
        #update scannales: fourc_vessel & hkl_vessel'
        _fourc_vessel = ScannableGroup('_fourc', (delta, th, chi, phi)) #I21DiffractometerStage('_fourc_vessel', m5tth, sa)
        __main__.fourc_vessel = DiffractometerScannableGroup('fourc_vessel', _dc, _fourc_vessel)
        __main__.hkl_vessel = Hkl('hkl_vessel', _fourc_vessel, _dc)
        __main__.h_vessel, __main__.k_vessel, __main__.l_vessel = hkl_vessel.h, hkl_vessel.k, hkl_vessel.l
        
        #Update scannables: fourc_lowq & hkl_lowq'
        _fourc_lowq = ScannableGroup('_fourc', (delta, th, chi, phi)) #I21DiffractometerStage('_fourc_lowq', m5tth, sa,delta_offset=LOWQ_OFFSET_ADDED_TO_DELTA_WHEN_READING)
        __main__.fourc_lowq = DiffractometerScannableGroup('fourc_lowq', _dc, _fourc_lowq)
        __main__.hkl_lowq = Hkl('hkl_lowq', _fourc_lowq, _dc)
        __main__.h_lowq, __main__.k_lowq, __main__.l_lowq = hkl_lowq.h, hkl_lowq.k, hkl_lowq.l
        
        #Update scannables: fourc_highq & hkl_highq'
        _fourc_highq = ScannableGroup('_fourc', (delta, th, chi, phi)) #I21DiffractometerStage('_fourc_highq', m5tth, sa,delta_offset=highq_OFFSET_ADDED_TO_DELTA_WHEN_READING)
        __main__.fourc_highq = DiffractometerScannableGroup('fourc_highq', _dc, _fourc_highq)
        __main__.hkl_highq = Hkl('hkl_highq', _fourc_highq, _dc)
        __main__.h_highq, __main__.k_highq, __main__.l_highq = hkl_highq.h, hkl_highq.k, hkl_highq.l
        
        #Update scannables: fourc_diode & hkl_diode'
        _fourc_diode = ScannableGroup('_fourc', (delta, th, chi, phi)) #I21DiffractometerStage('_fourc_diode', delta, sa)
        __main__.fourc_diode = DiffractometerScannableGroup('fourc_diode', _dc, _fourc_diode)
        __main__.hkl_diode = Hkl('hkl_diode', _fourc_diode, _dc)
        __main__.h_diode, __main__.k_diode, __main__.l_diode = hkl_diode.h, hkl_diode.k, hkl_diode.l
Пример #8
0
qtrans = Qtrans('qtrans', _scn_group, _dc)

Hkl.dynamic_docstring = format_command_help(
    hkl_commands_for_help)  # must be on the class
ub.__doc__ = format_command_help(ub_commands_for_help)

if settings.include_reference:
    _virtual_angles = ('theta', 'ttheta', 'qaz', 'alpha', 'naz', 'tau', 'psi',
                       'beta', 'betain', 'betaout')
else:
    _virtual_angles = ('theta', 'ttheta', 'qaz', 'betain', 'betaout')
hklverbose = Hkl('hklverbose', _scn_group, _dc, _virtual_angles)

# Create wavelength scannable
wl = Wavelength('wl', _energy_scannable,
                settings.energy_scannable_multiplier_to_get_KeV)
if not GDA:
    wl.asynchronousMoveTo(1)  # Angstrom
_energy_scannable.level = 3
wl.level = 3

# Create simulated counter timer
ct = SimulatedCrystalCounter('ct', _scn_group, settings.geometry, wl)
ct.level = 10


# Create constraint scannables
def _create_constraint_scannable(con_name, scn_name=None):
    if not scn_name:
        scn_name = con_name
    return DiffractionCalculatorParameter(scn_name, con_name,
Пример #9
0
 def setup_method(self):
     self.en = DummyPD('en')
     self.wl = Wavelength('wl', self.en)
Пример #10
0
 def setup_method(self):
     self.en = DummyPD('en')
     self.wl = Wavelength('wl', self.en)
Пример #11
0
 def setUp(self):
     self.en = DummyPD('en')
     self.wl = Wavelength('wl', self.en)
Пример #12
0
# Create hkl scannables
hkl = Hkl('hkl', _scn_group, _dc)
h = hkl.h
k = hkl.k
l = hkl.l

Hkl.dynamic_docstring = format_command_help(hkl_commands_for_help)  # must be on the class
ub.__doc__ = format_command_help(ub_commands_for_help)

_virtual_angles = ('theta', 'qaz', 'alpha', 'naz', 'tau', 'psi', 'beta')
hklverbose = Hkl('hklverbose', _scn_group, _dc, _virtual_angles)


# Create wavelength scannable
wl = Wavelength(
    'wl', _energy_scannable, settings.energy_scannable_multiplier_to_get_KeV)
if not GDA:
    wl.asynchronousMoveTo(1)  # Angstrom
_energy_scannable.level = 3
wl.level = 3


# Create simulated counter timer
ct = SimulatedCrystalCounter('ct', _scn_group, settings.geometry, wl)
ct.level = 10


# Create constraint scannables
def _create_constraint_scannable(con_name, scn_name=None):
    if not scn_name:
        scn_name = con_name