Magneto-Optical Detective
Desktop app to plot, pick, fit and export magneto-optical FTIR measurements: field sweeps
recorded with Bruker OPUS, either as OPUS binary files (*.0, *.1, …) or as two-column
text files written by the OPUS export macro.
All screenshots show a synthetic Landau fan, drawn by
docs/make_screenshots.py.
The documentation and download site (docs/site) is published at
https://wyzula-jan.github.io/mag-opt-detective/.
Features
The window is a workbench: a rail of panels on the left (Sample, Reference, Processing, Library, Points), the plots in the middle (Map, Stacked, Reference), an inspector on the right (View, Colour, Traces, Models) and a log drawer at the bottom. Every side area slides open and closed.
Load. Drop a sweep folder or files on the Sample panel (and optionally a reference sweep on the Reference panel). The fields are read from the file names or set as a custom range; the panel lists the files by field and reports missing fields. One or two zero-field spectra (measured before and after the sweep) correct the drift. While a sweep is measured, Watch folder adds the new spectra of its folder as they appear and processes them.
Process (Ctrl+Return).
- Plots: R(B)/R(0), the data, R(B)/R(B-AVR) (the field average) and R(B)/R(B-ΔB) (neighbouring fields).
- 1st or 2nd derivative along energy (d/dE) or field (d/dB), per data point or per unit (cm⁻¹, meV, THz or T).
- Reference correction with a separate sweep or with the sample itself, smoothed with Savitzky–Golay; an energy window and baseline normalisation.
- The baseline region is a band to drag on the map or the stacked plot; with Live on it applies at once, without processing again. The status bar shows the baseline of the map on screen.
- A dot on Process (and on the Processing panel) shows settings changed since the last run.
View.
- Live energy unit: the cm⁻¹ | meV | THz switch in the toolbar converts maps, axes, ranges, picked points, model parameters and curves, and exports at once, without processing again.
- Field, energy and intensity ranges (Auto or Fixed), shared by the map and the stacked plot. Colour maps magma, inferno, viridis, plasma, turbo, grey and bipolar, with levels Auto (1–99 %), Fixed or Symmetric, remembered per plot kind, and a histogram.
- Colour scales as the classic histogram or a slim bar (a switch in the plot toolbar); each one collapses with its handle, or all at once. The histograms hold still while you set the levels, or follow them with the toolbar's auto-scale button.
- Stacked spectra: offset, every n-th field and colours by field.
- A legend in the map and the stacked plot (a button in the plot toolbar) lists the picked curves and the models drawn; drag it anywhere.
- Appearance: light, dark or following the system.
Pick points (P). A click on the map records the energy of the current curve at that field (e.g. a Landau-level transition), Alt-click removes the point. Picking also works on the stacked plot, by clicking a trace. Curves are chips in the Points panel, with a table of their points, import and export, and Ctrl+Z / Ctrl+Shift+Z to undo and redo every edit.
Auto-pick (W, or the Points panel). Track follows a clicked line field by field in both directions; Detect finds every line in a region drawn on the map: a box, a rotated box, an ellipse or a freehand polygon, which stays there to be moved and reshaped. Options: maxima, minima or rising / falling inflection points, the search window, Savitzky–Golay smoothing and the prominence. The lines found are a preview until Accept puts them into the current curve (one undo step).
Models and fitting (inspector › Models).
- Massive Dirac interband transitions (Fermi velocity, half-gap Δ).
- Zeeman / magnon branches E₀ + m g μB B, linear or hyperbolic, optionally coupled by a constant Δᵢⱼ per pair: the energies are the eigenvalues of diag(Eᵢ) + Δ, which gives avoided crossings.
- Custom expressions in B, one branch per line, with the constants
muB,hbar,kB,e,c,piand functions such assqrt,exp,log; every other name is a parameter shared between the lines. - Fit to points: assign each picked curve to a branch (or match the points by energy order or to the nearest branch), fit, and read every parameter as value ± σ with χ². The results can be copied or saved as a TSV table. Model curves are drawn live and go into figure exports.
Library. Keep processed maps, load exported tables, cut each to an energy and field range, then merge spectral ranges, merge field ranges or average repeated sweeps.
Export.
- Data table… (Ctrl+E): the map shown, tab-separated.
- Journal figure… (Ctrl+Shift+E): the figure window, with a live preview. Presets Nature, APS and Custom: width and height in mm, text and lines in pt, dpi; the map or the stacked plot, its colour range (as in the window, Auto or Fixed), the colour bar on the right or on top, ticks (in or out, on all four sides, minor ticks), model curves, points, a legend and a panel label. Your own presets keep these styles and can be renamed, deleted, exported and imported (JSON). Saves PDF, SVG and EPS with editable text, and PNG and TIFF.
- Quick image (PNG/SVG)…: the plot as on screen, with its colour scale.
Choices (units, ranges, levels, colours, layout) are remembered between sessions; View › Reset settings restores the defaults (and keeps your figure presets).
Installation
The standalone apps need no Python (see Without Python below). With Python ≥ 3.12, install it from PyPI as an app of its own, with uv or pipx. On a Mac this needs macOS 15 or newer, also on Intel Macs:
uv tool install mag-opt-detective # or: pipx install mag-opt-detective
mag-opt-detective
uv tool upgrade mag-opt-detective updates it. To run it from a source checkout instead:
uv sync
Running
From a source checkout:
uv run mag-opt-detective
or uv run python -m mag_opt_detective.
Once a day the app asks GitHub whether a newer version is out and says so in a bar above the plot; it never installs anything (Help › Check for updates…, and Help › Check for updates at startup to switch the daily check off).
Without Python
Standalone apps are attached to each release (and to every run of the App bundles workflow):
| Archive | Runs on |
|---|---|
mag-opt-detective-windows.zip |
Windows 10 or 11, 64-bit (x86-64) |
mag-opt-detective-macos.zip |
macOS 15 or newer on Apple silicon (no Intel build) |
mag-opt-detective-linux.tar.gz |
64-bit (x86-64) Linux with glibc 2.39 or newer (Ubuntu 24.04, Debian 13, Fedora 40 or newer) |
Unpack it and start mag-opt-detective (.exe on Windows, Magneto-Optical Detective.app
on macOS). The bundles are not code-signed: on macOS open the app once, then allow it under
System Settings › Privacy & Security › Open Anyway; on Windows choose More info › Run
anyway.
The first Journal figure… export after installing takes about 20 s while matplotlib
builds its font cache. The cache is kept for later sessions in
~/Library/Caches/mag-opt-detective (macOS), %LOCALAPPDATA%\mag-opt-detective (Windows)
or ~/.cache/mag-opt-detective (Linux).
Build one yourself (the dev tools stay out of the bundle):
uv sync --locked --no-default-groups --group bundle
uv run --no-sync pyinstaller packaging/mag-opt-detective.spec --noconfirm
mag-opt-detective --smoke-test processes a small synthetic measurement, saves a figure in
every format and exits with 0; the workflow runs it on every bundle.
Input files
| File | Content |
|---|---|
OPUS binary (*.0, *.1, …) |
the single-channel sample spectrum (ScSm) is read |
text (*.txt, …) |
two whitespace-separated columns: wavenumber (cm⁻¹), intensity |
The file type is detected automatically. With field values From file names the field
is taken from the name: ..._a01p250T.txt → 1.25 T. Files are sorted by field, and the
Sample panel reports missing fields. Otherwise choose Custom range and enter start /
step / end.
Zero field. Load one zero-field spectrum, or two: measured before and after the
sweep, e.g. ..._a00p000T_a00p000T.txt and ..._a00p000T_a16p000T.txt. With two
spectra the zero-field reference is interpolated linearly between the first and the
last field point to compensate drift during the sweep. Files dropped on the Sample or
Reference panel (or a whole sweep folder) are sorted: names whose first field is 0 T go
to the zero-field list.
Exported files
Data tables are tab-separated, in the energy unit shown; the library loads them back:
Energy (meV) 0.25T 0.50T ...
12.5 1.0012 0.9987 ...
Point tables hold field (rows) × curve name (columns), with empty cells for missing points; the first header cell names the energy unit:
Energy (meV) LL 1 LL 2
0.5 12.398
1.0 24.797
Tables without the unit in the first header cell are read in the unit shown.
Fit results (TSV) start with # lines (model, curve assignment, number of points, χ²),
then one row per parameter: parameter, value, sigma, unit.
Journal figures have the exact print size. PDF, SVG and EPS keep their text editable (TrueType fonts in PDF and EPS, text elements in SVG); PNG and TIFF store the dpi.
Library
The Library panel keeps processed maps: Add (in the Processed sweep box) adds the R(B)/R(0) map of the last Process (also File › Add processed map to library), Load table… adds exported tables. Tick maps to plot them: ticked maps of one kind are drawn together, the one ticked or clicked last on top, and where they overlap the upper ones are drawn with the Overlap opacity. The top map is the one you pick on, fit and export; the list highlights the maps on the plot (a map not drawn says why) and the plot head names them. Open a map's row to give it an energy (E min / E max, in the energy unit shown) and field (B min / B max) range; empty limits mean no cut.
Combine joins the ticked maps, each cut to its limits, into a product, with a preview of the result (or why it cannot be made) before you create it:
- By energy joins spectral ranges (e.g. FIR + MIR): an overlap is split at its middle, every measured energy is kept (no resampling; per-point derivatives count the typical step as one point) and a gap stays empty.
- By field joins field ranges (e.g. 0–8 T and 8–16 T sweeps); fields measured twice are averaged.
- Average averages repeated measurements with the same field values.
The Product box names the product (editable), lists the maps it was made of with their
limits, and plots it, saves it to the library or exports it as a data table as plotted
(with a <file>_provenance.txt note of how it was made) or a journal figure.
Keyboard shortcuts
Ctrl is ⌘ and Alt is ⌥ on macOS. Help › Shortcuts lists them in the app.
| Keys | Action |
|---|---|
| Ctrl+Return (or Ctrl+F) | Process |
| Ctrl+E | Export the shown data as a table |
| Ctrl+Shift+E | Export a journal figure (PDF, SVG, EPS, PNG, TIFF) |
| Ctrl+L / Ctrl+Shift+L | Open sample field / zero-field files |
| Ctrl+R / Ctrl+Shift+R | Load reference field / zero-field files |
| Ctrl+1 / 2 / 3 / 4 | Plot R(B)/R(0) / Data / R(B)/R(B-AVR) / R(B)/R(B-ΔB) |
| Alt+1 / 2 / 3 | No / 1st / 2nd derivative |
| V / Z / P | Pan and zoom / box zoom / pick points |
| W | Auto-pick: follow a clicked line, or find the lines in a drawn region |
| Ctrl+Z / Ctrl+Shift+Z | Undo / redo a point edit (Alt-click removes a point) |
| A | Fit the plot to the data |
| F1 (on macOS also ⌘?) | Open the documentation |
Feedback
Found a bug or missing a feature? Help › Report a bug… and Help › Request a feature… open the bug report and feature request forms in the browser; the bug form comes with the app version and the system filled in. Never attach measurement data you cannot share.
Development
See CONTRIBUTING.md. In short:
uv sync
uv run pre-commit install --hook-type pre-commit --hook-type commit-msg
uv run pytest
Tests that need real measurement data look for a Data_to_test/ folder in the
repository root and are skipped when it is missing. Measurement data is never
committed.
Citing
If you use Magneto-Optical Detective for an analysis in a publication, please cite it with
the version you used, which the About box shows (Help › About, on macOS in the app menu).
CITATION.cff has the details (GitHub shows them under Cite this
repository), for example:
J. Wyzula, Magneto-Optical Detective, version x.y.z, https://github.com/wyzula-jan/mag-opt-detective
Licence
Copyright © 2026 Jan Wyzula.
Magneto-Optical Detective is free software under the GNU General Public License, version 3 (GPL-3.0-only): you may use, study, change and share it. What you share, changed or not, must stay under the same licence and come with its source code. It comes without any warranty.
To build it into a product that is not released under the GPL, a commercial licence is available from the author: wyzula.jan@gmail.com.
Third-party software
The app is built on Qt and PySide6 (GNU LGPL
v3), numpy, scipy,
matplotlib, pyqtgraph and
Pillow. The icons are Lucide icons (ISC
licence, parts MIT), see
LICENSE-lucide.txt. The app bundles
contain every licence text in THIRD_PARTY_NOTICES.txt, which Help › About › Licences…
also shows.
Metadata
Release files for mag-opt-detective 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mag_opt_detective-1.0.0.tar.gz | 4.5 MB | With provenance | Details for mag_opt_detective-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mag_opt_detective-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mag_opt_detective-1.0.0-py3-none-any.whl |
Total release size: 5.0 MB
Release files / mag_opt_detective-1.0.0.tar.gz
| Download URL | mag_opt_detective-1.0.0.tar.gz |
|---|---|
| Size | 4.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a2011a24354b4a356dd3903acd42b69d8176cd3ded5801c3c3e94b5b52f12d9
|
|
BLAKE2b-256 checksum How to use checksums |
44f4a1d92a3b9e6cce0c35765cf604dc9140b9f539f8464fdefbb179e17743da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / mag_opt_detective-1.0.0-py3-none-any.whl
| Download URL | mag_opt_detective-1.0.0-py3-none-any.whl |
|---|---|
| Size | 547.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55e9e229793a819ad0274f717a19f84d814667c37991d662210ec9bd1c04f85b
|
|
BLAKE2b-256 checksum How to use checksums |
b69fc8ac9b80c166db5a9f7be204c4f906c06d0fdfc4292f2a8375f02253c37f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for mag-opt-detective 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mag_opt_detective-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.