Beispiel #1
0
def fresh_xrun(bt, db):
    # loop
    loop = asyncio.new_event_loop()
    loop.set_debug(True)
    # create xrun
    xrun = CustomizedRunEngine(None, loop=loop)
    xrun.md["beamline_id"] = glbl_dict["beamline_id"]
    xrun.md["group"] = glbl_dict["group"]
    xrun.md["facility"] = glbl_dict["facility"]
    xrun.ignore_callback_exceptions = False
    xrun.beamtime = bt
    # link mds
    xrun.subscribe(db.insert, "all")
    # set simulation objects
    # alias
    pe1c = simple_pe1c
    configure_device(
        db=db,
        shutter=shctl1,
        area_det=pe1c,
        temp_controller=cs700,
        ring_current=ring_current,
        filter_bank=fb,
    )
    yield xrun
    # clean
    print("Clean xrun loop")
    if xrun.state != "idle":
        xrun.halt()
    ev = asyncio.Event(loop=loop)
    ev.set()
    loop.run_until_complete(ev.wait())
Beispiel #2
0
def set_xpd_configuration():
    configure_device(
        db=db,
        shutter=shctl1,
        area_det=simple_pe1c,
        temp_controller=cs700,
        ring_current=ring_current,
        filter_bank=fb,
    )
Beispiel #3
0
 def setUp(self):
     self._glbl = GlblYamlDict("glbl",
                               **glbl_dict)  # glbl going to be tested
     for el in self._glbl["allfolders"]:
         os.makedirs(el, exist_ok=True)
     # set simulation objects
     configure_device(
         area_det=pe1c,
         temp_controller=cs700,
         shutter=shctl1,
         db=db,
         filter_bank=fb,
     )
Beispiel #4
0
 def setUp(self):
     self.base_dir = Path(glbl["base"])
     self.home_dir = Path(glbl["home_dir"])
     self.config_dir = Path(glbl["xpdconfig"])
     self.PI_name = "Billinge "
     # must be 30000 for proper load of config yaml => don't change
     self.saf_num = 300000
     self.wavelength = 0.1812
     self.experimenters = [
         ("van der Banerjee", "S0ham", 1),
         ("Terban ", " Max", 2),
     ]
     # make xpdUser dir. That is required for simulation
     if self.home_dir.is_dir():
         shutil.rmtree(self.home_dir)
     self.home_dir.mkdir()
     # set simulation objects
     db = databroker.v1.temp()
     configure_device(
         area_det=pe1c,
         temp_controller=cs700,
         shutter=shctl1,
         db=db,
         filter_bank=fb,
     )
     if self.config_dir.is_dir():
         shutil.rmtree(self.config_dir)
     self.config_dir.mkdir()
     pytest_dir = Path(rs_fn("xpdacq", "tests/"))
     config = "XPD_beamline_config.yml"
     configsrc = pytest_dir.joinpath(config)
     shutil.copyfile(configsrc, glbl["blconfig_path"])
     self.bt = _start_beamtime(
         self.PI_name,
         self.saf_num,
         self.experimenters,
         wavelength=self.wavelength,
         test=True,
     )
     xlf = "300000_sample.xlsx"
     src = os.path.join(os.path.dirname(__file__), xlf)
     shutil.copyfile(src, os.path.join(glbl["import_dir"], xlf))
     import_sample_info(self.saf_num, self.bt)
     self.xrun = CustomizedRunEngine({})
     self.xrun.beamtime = self.bt
     # link mds
     self.xrun.subscribe(db.v1.insert, "all")
     # grad init_exp_hash_uid
     self.init_exp_hash_uid = glbl["exp_hash_uid"]
Beispiel #5
0
 def setUp(self):
     self.base_dir = glbl["base"]
     self.home_dir = os.path.join(self.base_dir, "xpdUser")
     self.config_dir = os.path.join(self.base_dir, "xpdConfig")
     self.PI_name = "Billinge "
     # must be 30079 for proper load of config yaml => don't change
     self.saf_num = 30079
     self.wavelength = 0.1812
     self.experimenters = [
         ("van der Banerjee", "S0ham", 1),
         ("Terban ", " Max", 2),
     ]
     # make xpdUser dir. That is required for simulation
     os.makedirs(self.home_dir, exist_ok=True)
     os.makedirs(self.config_dir, exist_ok=True)
     # set simulation objects
     configure_device(
         db=db,
         shutter=shctl1,
         area_det=pe1c,
         temp_controller=cs700,
         filter_bank=fb,
     )
     pytest_dir = rs_fn("xpdacq", "tests/")
     config = "XPD_beamline_config.yml"
     configsrc = os.path.join(pytest_dir, config)
     shutil.copyfile(configsrc, os.path.join(glbl["xpdconfig"], config))
     assert os.path.isfile(os.path.join(glbl["xpdconfig"], config))
     self.bt = _start_beamtime(
         self.PI_name,
         self.saf_num,
         self.experimenters,
         wavelength=self.wavelength,
         test=True,
     )
     xlf = "300000_sample.xlsx"
     src = os.path.join(pytest_dir, xlf)
     shutil.copyfile(src, os.path.join(glbl["import_dir"], xlf))
#
##############################################################################
import os
from xpdacq.xpdacq_conf import (glbl_dict, configure_device,
                                _reload_glbl, _set_glbl,
                                _load_beamline_config)

# configure experiment device being used in current version
if glbl_dict['is_simulation']:
    from xpdacq.simulation import (xpd_pe1c, db, cs700, shctl1,
                                   ring_current, fb)
    pe1c = xpd_pe1c # alias

configure_device(area_det=dexela, shutter=shctl1,
                 temp_controller=cs700, db=db,
                 filter_bank=fb,
                 ring_current=ring_current,
                 robot=robot
                 )

# cache previous glbl state
reload_glbl_dict = _reload_glbl()
from xpdacq.glbl import glbl

# reload beamtime
from xpdacq.beamtimeSetup import (start_xpdacq, _start_beamtime,
                                  _end_beamtime)

bt = start_xpdacq()
if bt is not None:
    print("INFO: Reload beamtime objects:\n{}\n".format(bt))
if reload_glbl_dict is not None:
Beispiel #7
0
#
##############################################################################
import os
from xpdacq.xpdacq_conf import (glbl_dict, configure_device, _reload_glbl,
                                _set_glbl, _load_beamline_config)

# configure experiment device being used in current version
if glbl_dict['is_simulation']:
    from xpdacq.simulation import (xpd_pe1c, db, cs700, shctl1, ring_current,
                                   fb)
    pe1c = xpd_pe1c  # alias

configure_device(
    area_det=pe1c,
    shutter=fs,
    temp_controller=eurotherm,  #changed from None to eurotherm on 3/22/19 - DPO
    db=db,
    filter_bank=fb,
    ring_current=ring_current)

# cache previous glbl state
reload_glbl_dict = _reload_glbl()
from xpdacq.glbl import glbl

# reload beamtime
from xpdacq.beamtimeSetup import (start_xpdacq, _start_beamtime, _end_beamtime)

bt = start_xpdacq()
if bt is not None:
    print("INFO: Reload beamtime objects:\n{}\n".format(bt))
if reload_glbl_dict is not None:
Beispiel #8
0
    configure_device,
    _reload_glbl,
    _set_glbl,
    _load_beamline_config,
)

# configure experiment device being used in current version
if glbl_dict["is_simulation"]:
    from xpdacq.simulation import xpd_pe1c, db, cs700, shctl1, ring_current, fb

    pe1c = xpd_pe1c  # alias

configure_device(
    area_det=pe1c,
    shutter=shctl1,
    temp_controller=cs700,
    db=db,
    filter_bank=fb,
    ring_current=ring_current,
)

# cache previous glbl state
reload_glbl_dict = _reload_glbl()
from xpdacq.glbl import glbl

# reload beamtime
from xpdacq.beamtimeSetup import start_xpdacq, _start_beamtime, _end_beamtime

bt = start_xpdacq()
if bt is not None:
    print("INFO: Reload beamtime objects:\n{}\n".format(bt))
if reload_glbl_dict is not None: