Bluesky plans, plan stubs and utilities for Small Angle Scattering beamline at DLS
This repo is currently designed to work with i22, b21 and will be expanded to work with other beamslines that also use a PandA for hardware triggering.
| Source | https://github.com/DiamondLightSource/saxs-bluesky |
|---|---|
| Releases | https://github.com/DiamondLightSource/saxs-bluesky/releases |
To install saxs-bluesky clone this repo, navigate into the directory containing this repo and install it via:
git clone https://github.com/DiamondLightSource/saxs-bluesky.git
cd saxs-bluesky
pip install -e .
This module can then be imported and use within your python environment such as:
from saxs_bluesky import __version__
print(f"Hello saxs_bluesky {__version__}")This package can be used within GDA or seperately from GDA. To use it seperately from GDA, (in python3) can be done in the following way:
from saxs_bluesky.utils.profile_groups import Group, Profile
my_profile = Profile(repeats=1,groups=[]) #currently has no 'groups' - ie line in seq table
#now we create a group
group = Group(
frames=1,
trigger="IMMEDIATE",
wait_time=10,
wait_units="MS",
run_time=100,
run_units="MS",
wait_pulses=[0, 0, 0, 0],
run_pulses=[1, 1, 1, 1],
)
my_profile.append_group(group)
#now we have a profile with a single group. We can add more, delete them and have a look etc
print(f"Duration of profile: {my_profile.duration} seconds")
print(f"Number of frames: {my_profile.total_frames}")
#you may also plot the PandA triggering sequencer
from saxs_bluesky.utils.plotter import ProfilePlotter
plotter = ProfilePlotter(my_profile)
plotter.plot_pulses()
plotter.show()To use this in an experiment we can do this through the BlueAPIPythonClient, along with the bluesky plans that are loaded in BlueAPI. The BEAMLINE variable should already be set on the beamline, but if not it should be set first.
from saxs_bluesky.beamline_configs.i22_config import CLIENT
from saxs_bluesky.plans.ncd_panda import configure_panda_triggering, run_panda_triggering
CLIENT.change_session("cm12345-1") # defaults to commissioning. Change the instrument session to your experiment
CLIENT.run(
configure_panda_triggering,
profile=my_profile,
detectors=["saxs", "waxs"], #whatever StandardDetectors that are created for the beamline
) #to load all the data onto the panda and the detctors
CLIENT.run(run_panda_triggering) #to actually tun the experiment
To see more extensive examples see the examples/ixx/example.py files
Certain features can be interacted though the commandline tool, some example commands here. A lot of the configuration can be done through the PandA GUI:
python -m saxs-bluesky --version
python -m saxs-bluesky login
python -m saxs-bluesky gui
python -m saxs-bluesky scripts
Assuming this has been set up properly on the beamline you can run
module load saxs-bluesky
saxs-bluesky gui
saxs-bluesky scripts
To open up the gui and open up the scripting interface
If you are operating this repo via the jython terminal and blueAPI then speak to your DAQ person to set it up