Slit Fiducialization

In order to define an alignment trajectory, the target pixel on each imager must be defined. To avoid issues that arise with cameras either being adjusted or even those with unreliable focus and zoom, it was a goal of this project to automate the fiducialization process. pswalker provides to plans to accomplish the goal, the first is the simplest; close the slits, insert the imager and take a centroid measurement slit_scan_fiducialize(). However, there may be a case where we are trying to fiducialize our YAG with a misaligned beam. In this case, fiducialize() starts with a small aperature, attempts to fiducialize, and upon failure increases the aperature size and attempts again.

pswalker.plan_stubs.slit_scan_fiducialize(slits, yag, x_width=0.01, y_width=0.01, samples=10, filters=None, centroid='detector_stats2_centroid_y')

Assists beam alignment by setting the slits to a w,h and checking, returning the centroid position.

Parameters:
  • slits (pcdsdevices.slits.Slits) – Ophyd slits object from pcdsdevices.slits.Slits
  • yag (pcdsdevices.pim.PIM) – Detector to fidicuialize. This plan assumes the detector is stated and inserted
  • x_width (float) – x dimensions of the gap in the slits. EGU: mm
  • y_width (float) – y dimensions of the gap in the slits. EGU: mm
  • samples (int) – Returned measurements are averages over multiple samples. samples arg determines the number of samples to average over for returned data
  • filters (dict, optional) – Key, callable pairs of event keys and single input functions that evaluate to True or False. For more infromation see apply_filters()
  • centroid (str, optional) – Key to gather centroid information
Returns:

return centroid position in pixel space, single axis

Return type:

float

pswalker.plan_stubs.fiducialize(slits, yag, start=0.1, step_size=0.5, max_width=5.0, filters=None, centroid='detector_stats2_centroid_y', samples=10)

Fiducialize a detector using upstream slits

Close the slits to a value specified by start. Then measure the centroid of the shadow left on the YAG by the upstream slits. If the beam is misaligned to the point that closing the slits does not give us a measureable beam centroid, we increment the aperature of the slits by step_size. The scan will stop and return the calculated fidicuial when it receives a non-zero centroid, raising an BeamNotFoundError if the slits reach max_width without seeing the beam

Parameters:
  • slits (pcdsdevices.slits.Slits) – Upstream slits
  • yag (pcdsdevices.pim.PIM) – Detector to measure centroid
  • start (float, optional) – Initial value to set slit widths
  • step_size (float, optional) – Size of each step
  • max_width (float, optional) – Maximum allowed slit aperature before raising an Exception
  • samples (int, optional) – Number of shots to average over
  • filters (dict, optional) – Filters to eliminate shots
  • centroid (str, optional) – Field name of centroid measurement
Returns:

fiducial – Measured fiducial

Return type:

float

Raises:

BeamNotFoundError: – If the requested slit width exceeds max_width

Notes

This plan makes the following assumptions; the slits are aligned to the xrays in their current center positions, the YAG is inserted and the areaDetector plugins are configured in such a way to accurately return the centroid of the beam

The information given by these methods are entirely in pixels. Clearly, we can use the slits to set a known aperature size and count the pixels of the square we have created to convert back to known unit. This process is automated using:

pswalker.plan_stubs.slit_scan_area_comp(slits, yag, x_width=1.0, y_width=1.0, samples=1)

Find the ratio of real space/pixel in the PIM

  1. Send slits to specified position
  2. Measure pixel dimensions of passed light.
    The idea is that the width, height values will be pulled from the PIMPulnixDetector instance.
2b. Should diffraction issues (as observed with the test laser) persist
when using the x-ray laser, another method will be necessary instead of using the gap dimensions for calibration, we could move the gap in the slits a small distance and observe the position change of the passed light. If the light is highly collimated (it should be), the motion of the gap should be 1:1 with the motion of the passed light on the PIM detector. Only investigate if issues persisit in x-ray.
Parameters:
  • slits (pcdsdevices.slits.Slits) – Ophyd slits object from pcdsdevices.slits.Slits
  • yag (pcdsdevices.sim.pim.PIM (subject to change?)) – Ophyd object of some type, this will allow me to read the w, h (w,h don’t exist yet but they should shortly)
  • x_width (int) – Define the target x width of the gap in the slits. Units: mm
  • y_width (int) – Define the target y width of the gap in the slits. Units: mm
  • samples (int) – number of sampels to use and average over when measuring width, height
Returns:

returns a tuple of x and y scaling respectively. Units mm/pixels

Return type:

(float,float)