Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XPress3 fluorescence scan #7

Open
stan-dot opened this issue Jul 2, 2024 · 2 comments
Open

XPress3 fluorescence scan #7

stan-dot opened this issue Jul 2, 2024 · 2 comments

Comments

@stan-dot
Copy link
Collaborator

stan-dot commented Jul 2, 2024

8 elements

i0 for before the sample a

and IT (i t transmission) for after the sample

@stan-dot
Copy link
Collaborator Author

stan-dot commented Jul 3, 2024

where do the elements come from? what are the time durations?

@stan-dot
Copy link
Collaborator Author

stan-dot commented Aug 5, 2024

example implementation:

from typing import List

import bluesky.plan_stubs as bps
from bluesky import RunEngine
from bluesky.preprocessors import inject
from dls_bluesky_core.core import MsgGenerator
from dodal.devices.xspress3.xspress3 import Xspress3

# Instantiate the devices
element_changer = ElementChanger("element_changer_prefix", name="element_changer")
i0 = Xpress3Detector("i0_detector_prefix", name="i0")
IT = Xpress3Detector("IT_detector_prefix", name="IT")


def xspress3mini(
    wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> Xspress3:
    """Get the i03 Xspress3Mini device, instantiate it if it hasn't already been.
    If this is called when already instantiated in i03, it will return the existing object.
    """
    return device_instantiation(
        Xspress3,
        "xspress3mini",
        "-EA-XSP3-01:",
        wait_for_connection,
        fake_with_ophyd_sim,
    )


@inject
def fluorescence_scan(elements: List[str], count_time: float) -> MsgGenerator:
    for element in elements:
        yield from bps.mv(element_changer.current_element, element)
        yield from bps.mv(i0.count_time, count_time)
        yield from bps.mv(IT.count_time, count_time)

        yield from bps.trigger_and_read([i0, IT])
        i0_data = yield from bps.rd(i0.data)
        IT_data = yield from bps.rd(IT.data)

        print(f"Element: {element}, i0: {i0_data}, IT: {IT_data}")


# Instantiate the RunEngine
RE = RunEngine({})

# Define the list of elements for the scan
elements_list = ["Fe", "Cu", "Zn", "Mn", "Ni", "Co", "Cr", "V"]
scan_count_time = 1.0  # 1 second count time for each scan

# Run the fluorescence scan
RE(fluorescence_scan(elements_list, scan_count_time))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant