Skip to content

Create ophyd device for halbach. #2272

Closed

Description

@Relm-Arrowny

Goals

Acceptance criteria : What journeys should the user be able to complete to consider your feature done
Be as specific as you can, check them off once they work. Add more if you find more requirements during development. Issue should only be considered done after all of them are checked

  • A user can instantiate the 4-magnet Halbach array controller as an Device and connect to all four underlying motors.
  • Field Control (set): A Bluesky plan (e.g., bps.mv or bp.scan) can command a target signed magnetic field strength (H within [-180, +180] mT) and target field angle relative to the $z$-axis (Field_Angle within [-90°, +90°]), and the controller moves all four motors simultaneously to the interpolated positions.
  • Smooth Trajectory: A user can scan smoothly across $0\text{ mT}$ (from $-180\text{ mT}$ to $+180\text{ mT}$) at any fixed angle in [-90°, +90°], or sweep angles at fixed field amplitude, without motor wrap-around jumps.

Tasks

base on the goals, deduce the tasks required. check them off once they're done

  • Define Lookup Table for halbach array mmg_toolbox#81
  • Implement fast 2D bilinear interpolation over the (Field_Angle_Z) grid using the m1_unwrapped_deg–m4_unwrapped_deg columns to guaranteecontinuous motor paths across 0/360 boundaries.
  • Implement Controller with the lookup table:
    • Create a composite Device (e.g., HalbachMagnetArray(StandardReadable)) containing the 4 underlying motor Movable / StandardReadable sub-devices (m1, m2, m3, m4).
    • Expose field_strength (H_mT) and field_angle (Field_Angle_Z_deg) as StandardReadable & Movable methods.
    • Implement synchronized multi-axis motion (asyncio.gather) when a new (H, angle) setpoint is commanded, including shortest-path / unwrapped target calculation relative to current motor positions.
  • Implement Trajectory / Continuous Scan Support(optional):
    • Support multi-step waypoint interpolation for large field excursions (e.g., sweeping from $-180\text{ mT}$ to $+180\text{ mT}$ in fine increments) so the motors follow the calibrated non-linear $\sin(\alpha)$ curve rather than cutting across chords in motor space.

Related Resources

Activity

  1. self-assigned this
    on Nov 17, 2026
  2. Relm-Arrowny commented on Nov 17, 2026

    @Relm-Arrowny
    ContributorAuthor

    The data in t rows 8–11 and 23 of fine_optimize_results_inSP.csv appears to jump. alos the data is incomplete it shown the -34 to 34 but we required -180 to 180.

    Current solution is to drop those data and create a interoperated lut.

  3. Relm-Arrowny commented on Nov 17, 2026

    @Relm-Arrowny
    ContributorAuthor

    The game plan:

    The field at the centre is roughlyt:

    image

    And each rotating magnet is a simple dipole and can be express in:

    image

    Taking the perturbation to the 3rd order and taking advantage of each magnet is roughly symmetric we can remove the 2nd order so the field is roughly:

    image

    All we needed to do than is to fit the model with the data to extract the a,b,c, We could also add some correction to match the model closely with the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions