Beispiel #1
0
    # detector motors
    detx = TangoMotor(device='motor/icepap_ctrl_1_expert/11', name='detx', userlevel=3, dial_limits=(0, 295))
    dety = TangoMotor(device='motor/icepap_ctrl_1_expert/12', name='dety', userlevel=3, dial_limits=(0, 31))

    # table motors
    table_front_x = TangoMotor(device='b303a-e02/dia/tab-01-x1', name='table_front_x', userlevel=5, dial_limits=(-10,10))
    table_back_x = TangoMotor(device='b303a-e02/dia/tab-01-x2', name='table_back_x', userlevel=5, dial_limits=(-10,10))
    table_front_y = TangoMotor(device='b303a-e02/dia/tab-01-y1', name='table_front_y', userlevel=5, dial_limits=(-10,10))
    table_back_y = TangoMotor(device='b303a-e02/dia/tab-01-y2', name='table_back_y', userlevel=5, dial_limits=(-10,10))

    # some sardana pseudo motors - these are reimplemented but just need to be configured
    energy_raw = TangoMotor(device='pseudomotor/nanomaxenergy_ctrl/1', name='energy_raw')
    energy = TangoMotor(device='pseudomotor/nanomaxenergy_corr_ctrl/1', name='energy')

    # some dummy motors
    dummy1 = DummyMotor(name='dummy1', userlevel=2)
    dummy2 = DummyMotor(name='dummy2', userlevel=2)

    # The delay generator as a software source for hardware triggers
    stanford = StanfordTriggerSource(name='stanford', device_name='B303A-A100380CAB03/CTL/DLY-01')

    # detectors
    pilatus = Pilatus(name='pilatus',
                     hostname='b-nanomax-mobile-ipc-01')
    merlin = Merlin(name='merlin', host='localhost')
    xspress3 = Xspress3(name='xspress3', device='staff/alebjo/xspress3')
    andor = Andor3(name='andor', device='staff/clewen/zyla')
    andor.proxy.rotation=1
    andor.proxy.flipud=True
    eiger = Eiger(name='eiger', host='b-nanomax-eiger-dc-1')
    alba0 = AlbaEM(name='alba0', host='b-nanomax-em2-0')
    import contrast
    from contrast.motors import DummyMotor, MotorMemorizer, ExamplePseudoMotor
    from contrast.scans import *
    from contrast.detectors import (DummyDetector, Dummy1dDetector,
                                    DummyWritingDetector,
                                    DummyWritingDetector2)
    from contrast.environment import env, register_shortcut
    from contrast.recorders import Hdf5Recorder, StreamRecorder
    import os

    # if you have ptypy installed, you can generate mock ptycho data
    # from sim_ptycho_scan import *

    env.userLevel = 1  # we're not experts!

    samx = DummyMotor(name='samx')
    samx.dial_limits = (0, 10)

    samy = DummyMotor(name='samy')
    samy.dial_limits = (-5, 5)

    samr = DummyMotor(name='samr')
    samr.dial_limits = (-180, 180)
    samr.velocity = 30

    basex = DummyMotor(name='basex')
    basex.dial_limits = (-8000, 8000)
    basex.velocity = 10000
    basey = DummyMotor(name='basey')
    basey.dial_limits = (-8000, 8000)
    basey.velocity = 10000
Beispiel #3
0
"""
An minimal contrast GUI which directly runs a beamline and does work
in a separate thread. Just a button which runs a scan.
"""

import sys
from PyQt5.QtCore import QThread
from PyQt5.QtWidgets import QWidget, QApplication, QPushButton
from contrast.scans import AScan
from contrast.motors import DummyMotor
from contrast.detectors import DummyDetector

mot1 = DummyMotor(name='mot1')
det1 = DummyDetector(name='det1')


class Example(QPushButton):
    def __init__(self):
        super().__init__('Push me to run a scan')
        self.clicked.connect(self.run_scan)

    def run_scan(self):
        self.runner = ScanRunner(AScan, *[mot1, 0, 1, 10, .1])
        self.runner.start()


class ScanRunner(QThread):
    def __init__(self, scan_class, *args, **kwargs):
        super().__init__()
        self.scan_obj = scan_class(*args, **kwargs)