Skip to content

Add a simulated MOKE bench with balanced detection - #7

Merged
seb5g merged 3 commits into
5.3.xfrom
feature/moke-simulator
Nov 25, 2026
Merged

seb5g merged 3 commits into
5.3.xfrom
feature/moke-simulator

Conversation

@seb5g

@seb5g seb5g commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Simulated MOKE bench with balanced detection, to run scans and test extensions without hardware.

Stacked on #6 (alignment with the template): the base is that PR's branch so the diff only shows the simulator. After #6 is merged GitHub retargets this PR to 5.3.x.

Plugins

All five share one simulated bench through the controller (same controller ID, one master, the others slaves; a plugin alone is its own master).

Plugin Role
DAQ_Move_MokeMagnetSim field in mT, first order response, field direction (polar angle, azimuth)
DAQ_Move_MokeWavePlateSim half-wave plate angle (deg): sets the balance, 22.5 deg from its zero
DAQ_Move_MokeSampleRotationSim sample azimuth (deg)
DAQ_Move_MokeGoniometerSim angle of incidence (deg)
DAQ_0DViewer_MokeBalancedSim diode_A, diode_B, difference, sum in V (one Data0D)

Choices made with the maintainer: one plugin per instrument, B field in mT, raw signals only (the extension computes the Kerr rotation and adds the semantic annotations), imperfections all optional.

Model

  • Stoner-Wohlfarth vector magnetisation (uniaxial anisotropy, easy axis in the sample frame) or a scalar tanh loop.
  • Kerr rotation = polar term (mz) + longitudinal term (mx, scales as sin of the incidence); transverse term as an intensity change in p polarisation.
  • Balanced detection: A - B = P sin(2 theta_K) at balance, offset and loss of sensitivity away from it; the zero of the plate can be given a hidden offset.
  • Optional: shot noise, electronic noise, laser intensity noise (common mode), A/B gain imbalance, Faraday background, drift.

Checked

  • pytest: 34 passed, 4 skipped (12 tests of the physics, 11 of the plugins through pymodaq.utils.plugin_testing: moves, home, shared controller, loop, balance, settings reaching the bench).
  • check_plugin: the five new modules are [ok]. The remaining warnings are in the existing plugins.
  • Not run: a scan in the Dashboard GUI. The plugins were driven through the PyMoDAQ test harness only.
  • The physics is approximate and not reviewed by MOKE experts.

Generated by Claude Code

Five plugins on one simulated bench (shared as master/slave controller):
actuators MokeMagnetSim (field, mT), MokeWavePlateSim (balance),
MokeSampleRotationSim and MokeGoniometerSim (geometry), and the 0D detector
MokeBalancedSim (diode A, B, difference, sum in V).

Stoner-Wohlfarth vector magnetisation (or a scalar tanh loop), polar and
longitudinal Kerr terms depending on the geometry, optional shot, electronic
and laser noise, gain imbalance, Faraday background and drift. Raw signals
only: the Kerr rotation and the semantic annotations are left to the
extension. Tests of the physics and of the plugins with the PyMoDAQ harness.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83Dwt3z6raRcp2PsVh
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 18b6ad13-df79-443c-b956-b1d3e0360538

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Base automatically changed from chore/align-template-5.3.x to 5.3.x November 25, 2026 20:36
Side view (angle of incidence, field direction), top view (sample rotation,
easy axis, field azimuth) and the polarisation in front of the beam splitter
(half-wave plate angle, Kerr rotation, balance), each tied to the plugin or
setting that controls it. The script that draws it is in docs/.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83Dwt3z6raRcp2PsVh
@seb5g
seb5g marked this pull request as ready for review November 25, 2026 20:44
…hinx on GitHub Pages

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RKuN83Dwt3z6raRcp2PsVh
@seb5g
seb5g merged commit 889cc4e into 5.3.x Nov 25, 2026
10 checks passed
@seb5g
seb5g deleted the feature/moke-simulator branch November 25, 2026 20:51
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

Successfully merging this pull request may close these issues.

2 participants