instrument.startupΒΆ

This same code can be used with IPython console & Jupyter notebook sessions and the bluesky queueserver. Use this inspiration to build your own custom startup procedures.

startup

Start Bluesky Data Acquisition sessions of all kinds.

 1"""
 2Start Bluesky Data Acquisition sessions of all kinds.
 3
 4Includes:
 5
 6* Python script
 7* IPython console
 8* Jupyter notebook
 9* Bluesky queueserver
10"""
11
12# logging setup first
13import logging
14
15from .utils._logging_setup import configure_logging
16
17configure_logging()
18
19logger = logging.getLogger(__name__)
20logger.info(__file__)
21
22# Bluesky data acquisition setup
23from .configs.loaders import iconfig
24from .core.best_effort_init import bec  # noqa: F401
25from .core.best_effort_init import peaks  # noqa: F401
26from .core.catalog_init import cat  # noqa: F401
27from .core.run_engine_init import RE  # noqa: F401
28from .core.run_engine_init import sd  # noqa: F401
29from .utils.helper_functions import running_in_queueserver
30
31# Configure the session with callbacks, devices, and plans.
32if iconfig.get("NEXUS_DATA_FILES") is not None:
33    from .callbacks.nexus_data_file_writer import nxwriter  # noqa: F401
34
35if iconfig.get("SPEC_DATA_FILES") is not None:
36    from .callbacks.spec_data_file_writer import newSpecFile  # noqa: F401
37    from .callbacks.spec_data_file_writer import spec_comment  # noqa: F401
38    from .callbacks.spec_data_file_writer import specwriter  # noqa: F401
39
40# These imports must come after the above setup.
41if running_in_queueserver():
42    ### To make the standard plans available in QS, import by '*'.
43    from apstools.plans import lineup2  # noqa: F401
44    from bluesky.plans import *  # noqa: F403
45
46else:
47    # Import bluesky plans and stubs with prefixes set by common conventions.
48    # The apstools plans and utils are imported by '*'.
49    from apstools.plans import *  # noqa: F403
50    from apstools.utils import *  # noqa: F403
51    from bluesky import plan_stubs as bps  # noqa: F401
52    from bluesky import plans as bp  # noqa: F401
53
54    from .utils.controls_setup import oregistry  # noqa: F401
55
56from .devices import *  # noqa: F403
57from .plans import *  # noqa: F403
58
59# Loads plans for development, remove for production.
60from .tests.sim_plans import *  # noqa: F403

Start Bluesky Data Acquisition sessions of all kinds.

Includes:

  • Python script

  • IPython console

  • Jupyter notebook

  • Bluesky queueserver