# Data and code: Pulsed-field travelling-wave magnetophoresis of magnetic microparticles I – the first-harmonic model A. Ehresmann, N. Weidt, Y. Shubbak, J. Bugase, R. Huhnstock, *J. Phys. D: Appl. Phys.* (manuscript JPhysD-143593, revised version). Repository DOI: https://doi.org/10.48662/daks-534 This repository contains the simulation and analysis code, the supplementary videos (1–8), the particle-tracking data and the numerical results behind the figures of the paper. ## Folder structure ``` code/ simulation/ TWMP_dPEL_korrigiert.py dPEL simulation (first-harmonic model, Eqs. 7, 9, 20–25): tracked minimum x_min(t), shift velocity v(t), well depth ΔU(t), max. force F_x,max(t), comparison with the closed-form expressions make_paper_figs.py Figs. 3(a)–(d), 4, 5, 6, 8, 9 make_videos.py Supplementary Videos 1–5 figures/ make_fig2_strayfield.py Fig. 2 (stray field vs. height, Eqs. 4, 5, 7) and the numbers of Sec. 2.3 (B(z0), third-harmonic weight, finite domain-wall width) check_volume_average.py numerical check of the mean-value property (Sec. 2.4, Eq. 8) make_fig7_vrange.py Fig. 7 (v_min/, v_max/ vs. amplitude ratio, simulation + experiment) make_fig10_tracking.py Fig. 10 (tracked particle velocities vs. first-harmonic model) tracking/ track_particles.py particle detection and tracking in Videos 6–8 analyze_tracks.py velocities, mean velocity, fit of the effective amplitude ratio videos/ simulation/ Supplementary Videos 1–5 (simulated dPEL, 12 Hz) experiment/ Supplementary Videos 6–8 (M-270 particles, 1 Hz) results/ simulation/ per amplitude combination: *_Bericht.txt (summary) and *_Zeitreihen.csv (time series); Fig7_vrange_simulation.csv tracking/ *_tracks.npz (particle positions), *_analysis.json (results), *_velocities.csv (ensemble velocity vs. t/T) figures/ figures as produced by the scripts docs/ review of the original (superseded) simulation script and the script itself, for documentation of the corrections ``` Code comments and console output of the simulation script are partly in German. ## Model parameters (simulations) Co70Fe30: M_s = 1800 kA/m, t_FM = 10 nm; domain period d = 10 µm (5 µm wide hh/tt stripes); SPP radius R = 1 µm at z0 = 1.6 µm (t_cap = 500 nm, gap 100 nm); effective susceptibility χ̄ = 0.383; B(z0) = (2η0/d)·exp(−k z0) = 2.635 kA/m with η0 = 2 M_s t_FM; U = −½ χ̄ V μ0 |H_eff|²; pulse frequency ν = 12 Hz, phase difference 90°. Velocities are determined with 2880 time steps per pulse period on a 10 nm spatial grid with parabolic sub-grid interpolation of the minimum positions, without smoothing. Since the dPEL depends on time only through ωt, all results scale to other frequencies (time ∝ 1/ν, velocities ∝ ν; mean shift velocity = d·ν). ## Supplementary videos | Video | Content | H_ext,x,0 (kA/m) | H_ext,z,0 (kA/m) | |---|---|---|---| | 1 | simulation, 12 Hz | 1.5 | 1.5 | | 2 | simulation, 12 Hz | 1.5 | 0.5 | | 3 | simulation, 12 Hz | 1.5 | 3.0 | | 4 | simulation, 12 Hz | 0.5 | 1.5 | | 5 | simulation, 12 Hz | 3.0 | 1.5 | | 6 | experiment, 1 Hz | 2.0 | 2.0 | | 7 | experiment, 1 Hz | 2.0 | 4.0 | | 8 | experiment, 1 Hz | 4.0 | 2.0 | Videos 1–5: 1600×1200 px, 72 frames per pulse period (5° per frame), six periods, played back at 30 fps; upper panel effective field components, lower panel dPEL, blue dot = tracked minimum. Videos 6–8: Dynabeads M-270 Carboxylic Acid (R = 1.4 µm) over 5 µm wide hh/tt parallel-stripe domains (IBMP-patterned Ir17Mn83(30 nm)/Co70Fe30(10 nm), PMMA capping ≈ 1.8 µm, z0 ≈ 3.3 µm), sinusoidal field pulses of 1 Hz with 90° phase difference. Recorded at 720 fps, every 30th frame stored (24 frames/s); the first frame of each file is stored twice and is removed by the tracking script. Calibration: 0.482 µm per pixel (from the MFL period d = 10 µm visible in the images). ## Particle tracking (Sec. 4.3, Figs. 7 and 10) `track_particles.py`: frames decoded with ffmpeg; vertical stripe pattern removed by subtracting the column-wise median over all rows, slow background by subtracting a 41 px moving average; particles = dark blobs more than 25 grey levels below background with an area of 40–160 px, intensity-weighted centroids; nearest-neighbour linking between consecutive frames (≤ 8 px, ambiguous assignments discarded); only particles tracked over all frames (≈ 6.5 pulse periods) are kept. `analyze_tracks.py`: frame-to-frame velocities normalised to d·ν = 10 µm/s; ensemble mean per frame interval; fit of the first-harmonic model, x_min = φ(t)/k with tan φ = r tan ωt, sampled over the same frame intervals as the experiment (fit parameters: q = min(r, 1/r), time offset, period; r and 1/r give identical curves shifted by T/4, so r is reported on the side of the nominal ratio). Results (`results/tracking/*_analysis.json`): | Video | nominal r | N | /(d·ν) ± SD (single particles) | fitted effective r | |---|---|---|---|---| | 6 | 1.0 | 540 | 1.00 ± 0.12 | 0.90 | | 7 | 0.5 | 542 | 1.02 ± 0.09 | 0.57 | | 8 | 2.0 | 526 | 1.00 ± 0.15 | 1.55 | ## How to reproduce Requirements: Python ≥ 3.10 with numpy, scipy, matplotlib (`pip install -r requirements.txt`); ffmpeg in the PATH (videos). Tested with Python 3.13, numpy 2.5, scipy 1.18, matplotlib 3.11, ffmpeg 6.1. ``` # simulation results for one amplitude combination (as in results/simulation) python code/simulation/TWMP_dPEL_korrigiert.py --Hx 1.5 --Hz 0.5 --fpp 2880 --out results_sim # all simulated figures (output folder paper_figs/) and Supplementary Videos 1-5 python code/simulation/make_paper_figs.py python code/simulation/make_videos.py # Fig. 2, numbers of Sec. 2.3 and check of Sec. 2.4 python code/figures/make_fig2_strayfield.py python code/figures/check_volume_average.py # particle tracking and analysis of Videos 6-8 python code/tracking/track_particles.py videos/experiment/Video6-*.avi --out trk python code/tracking/track_particles.py videos/experiment/Video7-*.avi --out trk python code/tracking/track_particles.py videos/experiment/Video8-*.avi --out trk python code/tracking/analyze_tracks.py trk/Video6-*_tracks.npz --nominal 1.0 --out trk python code/tracking/analyze_tracks.py trk/Video7-*_tracks.npz --nominal 0.5 --out trk python code/tracking/analyze_tracks.py trk/Video8-*_tracks.npz --nominal 2.0 --out trk # Figs. 7 and 10 python code/figures/make_fig7_vrange.py code/simulation trk python code/figures/make_fig10_tracking.py trk ``` (On Windows, replace the wildcards by the full file names.) The files in `results/` were produced with exactly these commands; the tracking and simulation outputs are reproduced bit-identically. Fig. 3 (e)–(h) are microscope frames of the experiment and were combined with the simulated panels (a)–(d) by hand. ## Note on the simulation code history The original simulation script (`docs/original_simulation_script_2026-02-20_superseded.py`, used for the first submission) lacked the factor ½ in the energy of the induced moment, used an approximate stray-field amplitude, and determined velocities with 72 time steps per period and a 20-step moving average. `TWMP_dPEL_korrigiert.py` corrects these points (details in `docs/Code_review_original_simulation_script_DE.md`); all figures and Videos 1–5 of the revised paper were produced with the corrected code.