Visual tool to explore, align and process measurement data
With AliGn, measurement data can be visualized, aligned and cropped. The main purpose of this tool is to prepare measurement data for further post-processing. This usually requires well-aligned data in which the signal to be examined (or the starting point of the signal) must lie exactly on top of each other over several traces. The input for AliGn is data that consists of several measurement series and is to be aligned with each other. Various filters are available for this purpose which enable the detection of distinctive points for the alignment of the signal. The aligned and trimmed data can be exported in the original data format.
Download the newest release here, run pip install <align-x.y.z-py3-none-any.whl>. Start by running align (script installed by pip — you may need to add the pip scripts directory to your PATH).
Requires Python 3.11 or newer.
Due to the many dependencies, it is recommended to install AliGn into a virtual environment:
python -m venv align_venv
source align_venv/bin/activate # Linux/macOS
align_venv\Scripts\activate.bat # Windows
pip install <align-x.y.z-py3-none-any.whl>
align
If you already use uv, the quickest way to install
the released wheel is as an isolated tool — this also puts the align command on
your PATH, with no virtual environment to activate manually:
uv tool install ./align-x.y.z-py3-none-any.whl
align
Three data formats are currently supported.
- NumPy arrays in
.npyformat. Each file should consist of a 1- or 2-dimensional array, with each row containing the measurement data of a trace. - A proprietary format, the D15 Trace Data Metafile, which is used for our
own measurements. The measurement data is available here as raw data in
individual files, which are referenced in a
.metafile that also contains information on the data type, number of traces, scope settings, comments and other meta information on the measurement. - HDF5 files (
.h5). A single file can hold several datasets; when you open it, a picker lists every suitable 2-D dataset (structured-array fields are split out automatically) and you choose which one to expose as which trace type. No separate file per data field is required.
For our use cases, we often record several pieces of data in parallel during
measurements. The “D15 format” therefore contains placeholders for EM, power,
plain, cipher and auxiliary data, and the metafile combines this data. An HDF5
file likewise bundles all datasets together, so the dataset picker is enough to
connect them. With plain NumPy arrays there is no such container that links the
data; therefore, when importing NumPy arrays, a separate .npy file must be
specified for each of the above-mentioned data fields.
Use this Quick Tutorial to generate a test data set and get an idea on how to use AliGn.
The left panel stacks two parts: a read-only dataset info card on top and the Traces list below.
Dataset info stays hidden until you load data. Once a dataset is open it
shows a type badge, the file name and path, the trace count and sample rate, and
(if present) a comment from the file. For NumPy datasets the card can also be
expanded to list the individual .npy file chosen for each trace type. Data
is not opened from this card — use the File menu: Open meta file
(Ctrl+O), Open *.npy files, Open *.h5 file, or Open Recent.
Only D15 metafiles carry a sample frequency in their metadata — for NumPy and
HDF5 datasets (or to override a D15 file's own value) click the edit button
next to the sample rate and type it in SI notation (250 MHz, 1.5G,
1000000). The manual value is marked (manual), takes precedence wherever a
sample frequency is used (time axis, Frequency Analyzer, Spectrogram,
measurement cursors),
and is remembered in the project/session; clearing the field removes the
override.
Traces is a scrollable list of collapsible trace cards; press + Trace in its header to add one. Each card represents one trace being plotted and processed. Besides the expand arrow and the Trace N title, the card header carries a row of per-trace controls:
- Colour dot — click to recolour the trace in the plot.
- Batch template (stacked-layers icon) — marks this card's chains as the template for batch export; it turns green, and only one card can be the template at a time (see Batch processing).
- Hide/show (eye) — toggles whether the trace is drawn.
- Normalize (↕ icon) — rescales the plotted trace to −1…1 so traces of different amplitude can be compared; click again to remove the normalization.
- Duplicate — copies the card with its full filter/trigger configuration.
- Remove (✕).
Drag the grip handle on the left of a card to reorder traces.
The reference trace — which trace number and type feeds the overview plot — is chosen in the header of that overview panel at the bottom of the main view, not in the left panel.
How the traces are arranged and drawn is controlled from the View menu; the same actions also sit in the View toolbar.
Overlay (the default) draws every trace into one shared plot. This is the view you align in: traces lie on top of each other, so you can see directly whether their features line up. Which trace is drawn in front follows the order of the trace cards — the topmost card is frontmost, so dragging a card up brings its trace to the front.
Stacked plots (Ctrl+T) gives each trace card its own plot, one above the
other and all the same height. The x axes are linked, so panning or zooming any
one plot moves all of them together, and each plot keeps its own crosshair.
Use this when traces have very different amplitudes, or when overlapping curves
hide each other — in the overlay view a trace drawn later can bury the one
underneath.
Alignment preview (Ctrl+Shift+A) shifts every trace sideways in the plot
so its trigger mark lines up with the selected trace's — a quick visual check
of whether a trigger chain will actually align the traces before committing to
a batch run. The selected card is the anchor and never moves; every other
trace slides onto its trigger position. Traces without a usable trigger mark
stay at their true position and are drawn dimmed, so you can see at a glance
which ones the chain doesn't catch yet. Changing the selection re-anchors the
preview instantly. It is purely visual — no data is modified, nothing is
recomputed — and the status bar reports how many of the traces it managed to
align. Toggle it off to see traces at their real, unshifted positions again.
Trace opacity sets how transparent the curves are drawn, from 10 % to fully opaque (the default). Reducing it makes overlapping traces show through one another, so you can tell how well they line up: where many traces agree the curve looks solid, where they scatter it stays faint — much like the persistence display of an oscilloscope. Trigger markers and the cut region stay fully opaque so they remain readable. The setting is global and is remembered between sessions.
Trace view fullsize (Tab) hides the left panel so the plot gets the full
window width. Press it again to bring the panel back.
Time axis (s) switches the x axis of the trace plots and the overview from sample points to seconds (with SI prefixes). It only relabels the axis — all internal positions stay in samples, so trigger marks and regions are unaffected. The entry stays disabled until a sample frequency is known.
Below the trace plots sits the overview panel, which always shows the whole reference trace. The range currently visible in the main plot stays bright while the rest is dimmed; drag that bright region to scroll the main plot.
Filters and triggers are configured directly inside each trace card — click the card header (▸) to expand it. The card body contains the trace settings (trace number, type) and two chain sections:
- Filter (top) — applied in order to the raw signal before trigger search.
- Trigger (bottom) — each trigger searches onward from the previous trigger's detection point (from the end of a matched range, so a step behind a range trigger continues past it rather than inside it). A trigger that fires on a level crossing marks the first sample beyond the level, whichever trigger type it is.
Both sections work the same way:
- Add a step with the Add Filter / Add Trigger button (a drop-down of the available types; a type already in the chain can be added again — duplicates are numbered automatically, e.g. a second "Hold Off").
- Each step appears as a card. Click ▸ to expand it and edit its parameters;
numeric fields accept scientific notation (e.g.
4e3) and step adaptively with the value. - Reorder steps by dragging the grip handle (⣿) on the left.
- Remove a step with the ✕ button.
- The checkbox on a filter step toggles whether that step is active.
Filters are only applied temporarily to find distinctive points — they are not baked into the exported data unless explicitly marked modify data.
When a trigger is parameterized correctly its detection point appears in the
plot as a marker in the trace's own colour. A cut region around that point is
then used during batch export. Some triggers (e.g. Peak Trigger, which
finds every matching peak and lets its n_th parameter pick which one is the
actual trigger point, or Pulse Width, which flags every subsequent
qualifying pulse after the first) also report further candidate points; those
are display-only and appear as fixed blue markers alongside the real trigger.
A trigger that matches a range rather than a single point marks both ends and the cut region spans the whole match: Pulse Width marks the start of the triggered pulse in the trace's colour and its end in blue, so the cut covers the entire pulse plus the configured before/after margin — its other qualifying pulses stay display-only and never stretch the region.
The trigger chain is what decides where traces align, so once one card's chain is tuned, the button left of its Add Trigger (tooltip Copy this trigger chain to all other traces; only on the trigger section) copies it onto every other trace card in one step — asks for confirmation first, since it overwrites each target's existing trigger chain.
Edits recompute live; rapid changes are coalesced by a short debounce so you
can keep typing. If a step takes a while the plot dims and, after a moment, a
Cancel computation button appears (Esc also works) — it kills the
running computation outright, so even a filter stuck in a long calculation
stops immediately; the plot keeps showing the last completed result until you
change something again.
To export with a card's chains, mark that card as the batch template (the stacked-layers button in its header — see Left panel), then press Start Batch. See Batch processing for what happens during the run.
Sometimes the distinctive point you want to trigger on is not a single peak or edge but a whole shape (a burst, a glitch, a sequence of operations). The built-in Cross-Correlation filter finds such a shape inside a trace: you give it a pattern and it returns a correlation curve that peaks where the pattern matches best. Because the result is an ordinary filter output, you can put a peak or threshold trigger after it to lock onto those matches.
It uses an FFT-based correlation, so it stays fast even on traces with millions of samples. The normalize toggle (on by default) produces a normalized correlation coefficient (≈ −1…1) that is independent of the local signal amplitude, which makes a trigger threshold comparable across traces. Switch it off for the raw correlation (faster, but peak heights scale with amplitude).
The most convenient way to create a pattern is to mark it directly in a plotted trace:
- Select the trace card whose (filtered) curve you want to cut from.
- Enable Tools → Patterns → Select pattern region (also on the Pattern toolbar). A blue selection band appears in the plot.
- Drag/resize the band over the shape you want to capture.
- Click Tools → Patterns → Save selection as pattern…, give it a name, and confirm. The slice of the active trace under the band is stored, and the selection region is hidden again automatically.
You can also use Tools → Patterns → Import pattern from .npy… to turn an existing 1-D NumPy array into a pattern.
Add the Cross-Correlation filter to a trace card like any other filter. Its pattern field is a drop-down listing all saved patterns; it refreshes every time you open it, so patterns you just saved appear immediately. Pick one and the correlation curve is computed live.
The Dynamic Time Warping filter uses the same pattern store for a different job: instead of finding a shape, it straightens one whose timing varies from trace to trace (e.g. an operation that runs slightly faster or slower). It warps the trace region between Start offset and Stop offset onto the selected pattern's time axis and splices the result back in, so the trace keeps its length and every position outside the region stays unchanged. Selecting a pattern prefills both offsets with the range the pattern was originally cut from. Sakoe-Chiba Window limits how far the warping path may stray from the diagonal (smaller is faster and stiffer); Use First Derivative matches on the slope instead of the raw amplitude, which is more robust against baseline offsets. The filter starts disabled; enable it on its card once a pattern is selected.
Open Tools → Patterns → Pattern Manager… for a gallery of all saved patterns. Each card shows a small preview of the waveform, its sample count, and lets you:
- Rename — edit the name and press Enter. Any filter currently referencing the old name is updated automatically.
- Delete — with a confirmation that warns when the pattern is still in use; references in open filters are then cleared.
- Import a
.npyfile straight into the store.
Patterns are stored as individual .npy files in the AliGn user data directory
(next to the user filters):
- macOS:
~/Library/Application Support/AliGn/patterns - Linux:
~/.local/share/AliGn/patterns - Windows:
%AppData%\AliGn\patterns
Further tools live in the Tools menu, independent of any trace card's chain — the measurement tool works directly in the trace plot, the others open their own window.
Measurement Tool (Ctrl+Alt+M) — while active, clicking in a trace plot
places a draggable vertical cursor; a dockable panel (place it left, right or
bottom) lists, for every pair of cursors, the distance in samples, in time and
as a repetition frequency (once a sample frequency is known), the curve value
at each cursor, and the amplitude difference, with total and mean summaries
across all pairs. Snap to peak pulls a placed or dragged cursor to the
nearest prominent peak, ignoring quiet regions. Cursors survive switching
between overlay and stacked view.
Frequency Analyzer (Ctrl+Alt+F) — plots the spectrum of the current
reference trace: magnitude in % or dB, frequency axis in Hz
once a sample frequency is known (otherwise normalized), with a configurable
window function applied before the FFT. A Strongest frequencies list
reports the top peaks, spaced apart by a configurable minimum distance so one
broad lobe doesn't fill the list with a tight cluster.
Spectrogram (Ctrl+Alt+S) — shows the time–frequency spectrogram of the
selected trace card (or the reference trace if no card is selected), with
adjustable slice length, overlap, window function and an optional dB scale. The
frequency axis is in MHz once a sample frequency is known, otherwise
normalized.
Overall Mean — averages the whole loaded trace set (EM and power, one curve each). A well-aligned set gives a sharp mean, a poorly aligned one washes out towards a flat line, so this is a quick check of the alignment quality — e.g. on a batch export's output.
TVLA / t-Test Analyzer (Ctrl+Alt+T) — compares two independently loaded
trace sets with a per-sample Welch t-test, the standard TVLA leakage metric.
The |t| curve is plotted against the conventional ±4.5 threshold; a side
panel reports the peak |t|, how many samples exceed it, and a pass/fail
verdict (a switch shows signed t instead). Both sets are streamed from disk
in chunks off the GUI thread, so large sets neither exhaust memory nor block
the window. D15, HDF5 and single .npy files (treated as a one-channel trace
set) are all supported.
Save the current configuration with File → Save Project (Ctrl+S) or
Save Project As… (Ctrl+Shift+S), and reload it later with File → Open
Project.
Projects are saved as JSON (.json). AliGn writes format v2, which stores
metafile path, reference trace settings, and the per-trace filter/trigger
configuration in a flat, human-readable structure. Project files from earlier
versions (v1, produced by AliGn < 0.6) can still be opened; the obsolete
color and shift fields are silently ignored.
Batch processing exports all traces of a dataset in aligned and trimmed form. It runs in two sequential phases, both of which execute their per-trace work in parallel across all available CPU cores.
Open it with Tools → Export / Batch… (Ctrl+Alt+X), or by marking a card
as batch template and pressing Start Batch in the trace list (see
Filter & trigger chains). Its Export window
fields set how many samples before/after the trigger to keep — the width
updates live; dragging the cut-region overlay directly in the trace plot does
the same thing and stays in sync with these fields. Traces sets how many
traces (starting at trace 0) to process; the panel also echoes which filters
and triggers the template card will run. An Output directory picker
writes straight into a chosen folder instead of a new timestamped one next to
the source data (writing into the source directory itself is refused, since
the writer reuses the source file names). Start Batch begins the run
described below; Stop cancels it — see Stopping mid-run.
For every trace, a worker applies the configured filter chain (non-modifying filters only) and the full trigger chain to find the alignment marks: an anchor (the point the trigger settled on) plus any additional, display-only marks. No data is written to disk in this phase.
For each trace the worker also checks whether the intended cut window fits entirely within the trace:
- cut_start =
anchor + region_start - cut_end =
range_end + region_end(oranchor + region_endfor a trigger that found no matching range — e.g. a single-point trigger)
range_end only comes into play for a trigger that reports a genuine matched range (e.g. the threshold/range trigger); other extra marks a trigger may report (e.g. the other peaks of a peak trigger) never widen the window.
If the window would extend beyond the trace boundaries the trace is discarded — a partial window cannot be used in downstream analysis.
Once all preflight jobs have reported back, the manager derives a single uniform output length that is used for all traces in Phase 2:
output_length = max(range_end − anchor) ← maximum spread across all valid range-trigger traces
+ (region_end − region_start) ← configured region window
For a trigger that never reports a range the spread is zero, so output_length equals the region width alone.
For each valid trace a worker extracts a segment of exactly output_length samples, anchored at anchor + region_start. The anchor position varies per trace (that is the point of alignment), but the extracted segment length is always identical, so all output traces fit into a uniform 2-D array.
- EM / power traces are cut and then passed through any modifying filters (e.g. data-transforming filters that permanently change the signal).
- Plain / cipher traces are written at their original length without cutting — they remain positionally coupled to the corresponding aligned waveform for use in downstream correlation analysis.
For D15 and NumPy datasets this split follows the canonical trace names (em/power vs. plain/cipher). For HDF5 datasets the dataset names are arbitrary, so the split is driven purely by trace length: datasets that share the analysis trace's length are cut, all others are passed through unchanged.
Workers finish in arbitrary order. The manager buffers results in a pending dict and flushes them to disk in strict ascending trace-number order, so the positional correspondence between all trace types (em, power, plain, cipher) is preserved in the output.
The output is always written in the same format as the input (.npy for NumPy datasets, .dat + .meta for D15 datasets, a new .h5 file for HDF5 datasets) — by default to a new timestamped subdirectory (YYYY-MM-DD-HH.MM) inside the source data directory, or to the output directory chosen in the Export dialog.
For NumPy output the file is pre-allocated on disk as a memory-mapped array (np.lib.format.open_memmap) with shape (n_valid, output_length). Workers write directly into this mapping — no trace data accumulates in RAM. This keeps memory usage proportional to thread_count × trace_size regardless of how many traces or how large each trace is.
Pressing Stop sets a cancellation flag. Workers that have not yet started their per-trace computation exit immediately. Already-running workers finish their current trace. Once all submitted jobs have reported back, the output is finalised with however many traces were written up to that point — the resulting dataset is complete and self-consistent for that subset.
AliGn writes a log to AliGn.log in its user data directory — attach it when
reporting a problem:
- macOS:
~/Library/Application Support/AliGn/AliGn.log - Linux:
~/.local/share/AliGn/AliGn.log - Windows:
%AppData%\AliGn\AliGn.log
The log is rotated at 1 MB, keeping the three previous files (AliGn.log.1
… AliGn.log.3). The same messages also go to the console.
Beyond the built-in filters you can add your own from inside the running application — no restart and no editing of the AliGn source code required.
Open Tools → Filter Editor (Ctrl+Alt+E). The editor starts with a
template you can adapt. A filter is a plain Python function decorated with
@align_filter:
from numpy import ndarray
from align.filter.filter import align_filter
@align_filter(title="My Filter")
def my_filter(data: ndarray, factor: float = 1.0) -> ndarray:
return data * factorThe function receives the trace as its first argument (data) and returns the
processed trace. Everything the GUI needs is derived from the function:
- Name — the function name (here
my_filter) is the identifier used in the filter drop-down and in saved project files. Passname="..."to the decorator to override it. - Title — the label shown on the filter card, set with
title="...". - Parameters — every additional argument becomes an editable field. It must
have a type hint (
int,float,boolorstr) and a default value, e.g.factor: float = 1.0. The default is what the field starts with.
To refine how a parameter is shown, pass params=, keyed by parameter name:
@align_filter(
title="Moving Average",
params={"window_len": dict(title="window length", limits=(1, 10000))},
)
def moving_average(data: ndarray, window_len: int = 8) -> ndarray:
...limits=(min, max) constrains a numeric field; title relabels it.
str parameters are shown read-only by default, with one exception: the
pattern store. Pass patternSelect=True to render a str parameter as a
drop-down of all saved patterns, exactly
like the built-in Cross-Correlation filter's pattern field:
from align.patterns import PatternStore
@align_filter(
title="Find Pattern",
params={"pattern": dict(patternSelect=True)},
)
def find_pattern(data: ndarray, pattern: str = "") -> ndarray:
tmpl = PatternStore().load(pattern) # ndarray, or None if missing
...Keep the parameter named pattern — the Pattern Manager's rename/delete
updates open filters by looking for a pattern parameter carrying this flag.
An enable toggle is added automatically; use enabled=False to have the
filter start switched off. To expose the batch modify data toggle (see
Batch processing), pass modify_data=False (or True).
Saving. Click Save & Load. The filter is validated, written to the AliGn user filter directory and loaded immediately, so it appears in the Add Filter drop-down of every trace card right away. Each file holds exactly one filter. The user filter directory is:
- macOS:
~/Library/Application Support/AliGn/filters - Linux:
~/.local/share/AliGn/filters - Windows:
%AppData%\AliGn\filters
If you edit filter files outside AliGn (in your own editor, or by copying files into the directory), press Reload from disk in the Filter Editor to pick up the changes without restarting.
Validation and errors. Syntax errors, an invalid file name, a missing filter definition or a name that clashes with a built-in are reported inline in the editor and the file is not loaded. Runtime errors raised while a filter processes a trace are caught and shown in the status bar; they will not crash the application.
Using extra libraries. Filters may import any installed package. If a
dependency is missing, the editor shows the exact pip install … command to
run in the environment AliGn is using.
Security. A user filter is ordinary Python code that AliGn executes with
your user's permissions — on Save & Load and on every start, for every .py
file in the user filter directory (and on Reload from disk). Only put filters there whose source you have
read or that come from a source you trust. Project files, by contrast, contain
no code: they only reference filters and patterns by name.
Notes.
- A user filter cannot share the name of a built-in filter — built-ins always take precedence.
- User filter files cannot import one another; keep each filter self-contained.
- Custom triggers are not yet editable from the GUI; for now add them as a
Python module in
align/trigger/(same decorator style,@align_trigger).
AliGn uses an internal abstraction layer for display and filter processing, which gives all supported formats a standardized interface. This makes it possible to add other, previously unsupported data formats relatively quickly: implement the methods of the abstract class AlignTraceData (in align_trace_data.py) for the new format, add a value to the TraceDataFileType enum, and wire it into AlignTraceDataFactory.
We use uv for dependency management and the package build process. Install uv as described in the documentation.
Install all dependencies and the project in editable mode:
uv sync
Run the application directly:
uv run align
Build a distributable wheel:
uv build
The python wheel (.whl file) can be found in the ./dist folder.
For users who don't have Python installed, AliGn can be packaged as a
self-contained executable with PyInstaller, using
the spec file in packaging/align.spec. It bundles a full Python runtime and
all dependencies (PySide6, scipy, h5py, ...), so no separate Python
installation is required to run it — unpacked size is roughly 500 MB.
Install the packaging tools and build:
uv sync --group packaging
uv run pyinstaller packaging/align.spec --noconfirm
This produces a dist/AliGn folder (onedir build) containing the AliGn /
AliGn.exe executable. On macOS it additionally produces dist/AliGn.app.
PyInstaller does not cross-compile: build on the OS you're targeting.
- Linux: built for every release and attached to it as
AliGn-<tag>-linux-x86_64.tar.gz, containing theAliGnfolder pluspackaging/install.sh. - Windows and macOS: no CI runners for these are set up (yet), so build locally on that OS with the same two commands above.
AliGn registers itself in the desktop menu (.desktop file + icon under
~/.local/share/) the first time it runs, regardless of where the AliGn
folder lives — that part needs no separate installer. There are two ways to
get it onto a Linux machine:
- With
install.sh(what the release tarball is meant for): extract the archive anywhere and run./install.shonce. It copies AliGn to a stable location (~/.local/share/AliGn) and links thealigncommand into~/.local/bin, so it survives cleaning up the download and works from a terminal — no root/sudo needed. - Without it: extract the
AliGnfolder directly to wherever you want it to live permanently (not a temp/Downloads folder that gets cleaned up) and run./AliGn/AliGn. The menu entry is created the same way, but there's noalignterminal command, and moving or deleting the folder afterwards breaks the menu entry until the app is run again from its new location.
Notes:
- The resulting binaries are unsigned. Windows SmartScreen and macOS Gatekeeper will warn on first launch; users need to explicitly allow the app (or you set up code signing/notarization separately).
- If dependency updates cause PyInstaller to miss something at runtime (a
ModuleNotFoundErrorin the packaged app but not inuv run align), add the missing module tohiddenimportsinpackaging/align.spec.
Tests use pytest with pytest-qt for the GUI parts:
uv run pytest
On a machine without a display (e.g. CI), run the GUI tests on Qt's offscreen platform:
QT_QPA_PLATFORM=offscreen uv run pytest tests/ -v --tb=short
See CHANGELOG.md for a detailed history of releases.
AliGn is licensed under the European Union Public Licence v1.2 (EUPL-1.2).
