Skip to content

Repository files navigation

💥 pmoke

Pulsed-field MOKE, from instrument trigger to Kerr angle.

ACQUIRE  ·  DEMODULATE  ·  ROTATE  ·  ANALYZE

CI status Documentation Rust 2024 Apache 2.0 license

📖 Documentation · ⚡ Quick start · ⌨️ Commands · 🇯🇵 日本語


pmoke is a Rust command-line and terminal application for pulsed magneto-optical Kerr effect measurements. It connects acquisition hardware, tracks reproducible run artifacts, and executes the numerical analysis chain used to recover a Kerr signal from large oscilloscope captures.

pmoke analysis data flow

✨ Why pmoke

Capability What it provides
📥 Binary acquisition Rigol DHO5000-series 16-bit WORD captures without a CSV bottleneck
〰️ Numerical lock-in Boxcar legacy, phase rotation, and Kerr-angle analysis
🔌 Instrument transports Direct TCP/IP, Linux GPIB, Windows USBTMC/VISA, and Prologix TCP/serial
🖥️ Live terminal UI One command surface for configuration, analysis, logs, selection, and monitoring
🧾 Reproducible runs Versioned TOML configuration, immutable snapshots, checksums, and isolated run directories
🌐 Browser tools Rust/Wasm configuration validation and interactive waveform analysis in the documentation site

⚡ Quick start

🧰 Nix-managed development

The repository provides a pinned Nix development shell for the supported local systems. On a Nix-managed workstation, use the shell for project tools and validation:

nix develop
cargo build --locked --workspace --all-targets --no-default-features

For WSL, bootstrap Nix inside WSL using the official Nix installation instructions and the official WSL guidance, then run nix develop from this repository. Do not install Nix or project dependencies through Scoop, winget, global npm/pnpm, rustup, or pip. WSL builds are Linux-native; native Windows MSVC/VISA validation is a separate lane.

The shell pins Python 3.12 and provides the Nix-packaged NumPy, SciPy, lmfit, matplotlib, and the pinned PyPI gsplot package required by the Rust/PyO3 and analysis tests. It sets PYO3_PYTHON to that interpreter and exposes its site-packages to embedded Python. It applies a narrow override for one known SciPy precision-test failure with the pinned NumPy/SciPy pair while retaining the rest of SciPy's checks. Linux shells also provide Chromium, pkg-config, and the Nix-packaged linux-gpib userspace library for the GPIB build lane. On macOS, use an existing Nix-managed Chrome/Chromium executable; if none is available, report browser validation as an environment limitation. Do not install Python or native dependencies with pip or another host package manager.

The host's WSL profile is managed outside this repository. GUI, systemd, and GPIB USB/IP integration are optional capabilities and are not enabled by ordinary build or test commands. Hardware preflight must remain read-only; builds and tests use dummy transports unless live hardware access is explicitly authorized.

📦 Install outside Nix

Clone the repository, then use the platform build that matches the host:

The commands below describe installation for users who are not using the repository's Nix shell. Contributors and agents working on a Nix-managed workstation should use the nix develop shell above rather than installing repository tools into the host environment.

git clone https://github.com/Kerr-group/pmoke.git
cd pmoke

# Linux / Windows: all transports
cargo install --path . --locked

# macOS: direct TCP/IP and Prologix TCP/serial, without direct GPIB
cargo install --path . --locked --no-default-features \
  --features hw-core,hw-prologix-tcp,hw-prologix-serial

# Analysis-only: no hardware transports
cargo install --path . --locked --no-default-features

# Plotting and Python-backed analysis
python -m pip install -r requirements.txt

The default Linux/Windows build enables the complete transport surface. Custom builds can still select a smaller transport set:

  • 💥 Complete Linux / Windows build · default features
  • 🍎 macOS hardware build · all transport features except hw-gpib
  • 💻 Analysis-only build · --no-default-features
  • 🧩 Custom transport build · --no-default-features --features <features>

See the feature matrix for platform notes and combined builds.

▶️ Run

# Generate, validate, and diagnose a configuration
pmoke config init --output config.toml
pmoke --config config.toml config validate
pmoke --config config.toml doctor

# Analyze existing waveforms into an isolated run directory
pmoke --config config.toml --run-dir shot-001 analyze

# Open the terminal workspace; running `pmoke` alone does the same
pmoke --config config.toml monitor

Hardware-enabled builds add single, trigger, autoshot, fetch, screenshot, automeasure, process, and auto. The complete automated measurement and analysis path is:

pmoke --config config.toml --run-dir shot-001 auto

⌨️ Command surface

  • 🖥️ Terminal workspace · pmoke, pmoke monitor
  • ⚙️ Configuration · pmoke config init|validate|explain|migrate
  • 🩺 Diagnostics · pmoke doctor, pmoke show, pmoke raw verify
  • 🚀 Full analysis · pmoke analyze
  • 🧪 Analysis stages · pmoke reference|sensor|li|phase|kerr
  • 🔌 Instrument registry and queries · pmoke instruments list|explain|query
  • ⏱️ Transport benchmarks · pmoke bench scpi-query|transport
  • 📤 Data interchange · pmoke export csv|npy

The generated CLI reference is the source of truth for flags and feature-gated commands.

🧱 Workspace

pmoke/
├── src/                         CLI, TUI, workflows, and Python bridge
├── crates/
│   ├── instruments/             instrument registry and drivers
│   ├── gpib-rs/                 direct GPIB transport
│   ├── prologix-rs/             Prologix TCP and serial transport
│   ├── pmoke-config-core/       shared configuration model and validation
│   ├── pmoke-analysis-core/     shared numerical analysis
│   └── pmoke-web-wasm/          browser bindings for shared Rust cores
├── website/                     bilingual Fumadocs site and browser tools
├── scripts/                     benchmark plotting and comparison utilities
└── xtask/                       generated CLI and configuration references

📚 Documentation

Guide English 日本語
Quick start Open 開く
CLI reference Open 開く
Configuration Open 開く
Waveform analyzer Open 開く
Citation & references Open 開く

🧭 Project governance

Stable product, compatibility, and security boundaries are documented in the project requirements. Public work follows one GitHub Issue per durable goal, a linked normal PR opened when implementation starts, and explicit validation before merge. See the security policy for private vulnerability reporting; do not disclose security details in public Issues or PRs.

🔬 Publications

If pmoke materially contributes to published work, consider citing the software version and the measurement method relevant to the experiment. See the citation guide for a version-pinned software citation and selection guidance.

  • A. Ikeda, S. Nakamura, S. Yamane, K. Noda, A. Ikeda, and S. Yonezawa, “Magneto-optical Kerr-effect measurements under pulsed magnetic fields over 40 T using a compact sample fixture,” Physical Review Research 8, 013169 (2026). doi:10.1103/vy7j-ylb4
  • S. Yamane, S. Nakamura, A. Ikeda, K. Noda, A. Ikeda, and S. Yonezawa, “Magneto-optical Kerr effect measurements under bipolar pulsed magnetic fields,” JJAP Conference Proceedings 12, 011011 (2026). doi:10.56646/jjapcp.12.0_011011

📄 License

Licensed under the Apache License 2.0.

Releases

Packages

Used by

Contributors

Languages