← All projects

Machine learning & biology · MAD · Particle detection

From a waveform
to an event.

Where does a particle passage begin and end?

Source code on GitHub

01 / The observation

Start with what
the sensor sees.

A particle passage can produce several oscillations. Counting every peak would turn one passage into several particles.

We need to find a bounded event in the full recording. Follow the same signal through each step below.

Explore a real recordingMultiple passages
Multiple passages: rawAmplitude · a.u.02468Time · ms1.50-1.5
Raw measurement · 16,384 samples · 2 MHz · 8.192 milliseconds. All plots below follow this recording.

Showing the original preset. Loading recording and threshold controls…

02 / Change the representation

From oscillations
to one energy curve.

Keep the 7–80 kHz band. Split it into short time windows, remove the ordinary power at each frequency, and add what remains.

Now all frequencies contribute before anything is counted. The next step puts that energy on a scale relative to this recording’s own background.

Multiple passages: energyExcess energy02468Time · ms1.0e-45.1e-50
Positive excess power summed across frequencies, then smoothed over three frames.

Normalise / the central idea

How far above ordinary?

The median estimates the ordinary level. The median absolute deviation (MAD) estimates its fluctuations without letting a few large peaks dominate.

z[m]=E[m]median(E)max(1.4826·MAD(E),1012)

MAD(E) = median(|E − median(E)|)

The energy units cancel. The result is a robust z score, not a physical signal-to-noise ratio. The small floor prevents division by zero.

Follow the exact transformation
  1. Isolate: fourth-order Butterworth band-pass, 7–80 kHz, applied forwards and backwards.
  2. Localise: Hann windows of 512 samples, advanced by 128 samples (64 µs).
  3. Reference: subtract each frequency’s 25th-percentile power; clip negative excess to zero.
  4. Aggregate: sum the positive excess across frequencies, then smooth over three frames.
  5. Normalise: subtract the median and divide by the guarded, scaled MAD. The factor 1.4826 is the Gaussian-consistent scale convention.

03 / Make a decision

Draw one line.
Find what crosses it.

A frame becomes active when its z score reaches the activation threshold. Nearby active frames are then grouped into candidate intervals.

Move the threshold and follow the decision back to the full signal below. These are precomputed runs of the original detector.

1.08.0

The dashed line selects frames. A separate quality floor of z max ≥ 12 helps decide which grouped events are retained.

Multiple passages: robust z score and activation threshold 3.5Robust z · symmetric log scale02468Time · ms20050123.50-2
Activation thresholdActive frameSymmetric log scale keeps both the background and large peaks visible.

2 retained · 2 rejected at z ≥ 3.5

04 / Return to the measurement

One interval.
One maximum z score.

Each underline marks a candidate’s exact sample interval. Its label reports the highest z score inside that interval.

Retained events are solid; rejected candidates remain visible as dashed underlines. A failed quality check leaves an inspectable result.

Multiple passages2 retained / 4 candidates
Multiple passages: full raw signal with candidate intervals and maximum z scoresAmplitude · a.u.02468Time · ms1.50-1.501 · z max 5.102 · z max 4.603 · z max 42904 · z max 19.6
Retained eventRejected candidateUnderlines preserve the time axis. Labels use separate rows when needed.
Inspect the detected intervals. Select a row number to highlight its position in the signal.
EventInterval · msz maxDecisionReason
0.768–1.1525.1RejectedBelow quality floor
2.176–2.4964.6RejectedBelow quality floor
5.312–6.528429RetainedPasses quality checks
7.232–7.68019.6RetainedPasses quality checks
What turns a candidate into a retained event?

The original preset bridges gaps of up to two inactive frames (0.128 ms). An interval starts at the first active frame’s left edge and ends after the last frame’s full 512-sample window. No extra boundary padding or expansion is added.

Qualification checks duration (0.06–2 ms), maximum z (at least 12), and spectral concentration. This preset returns at most five candidates, ranked by maximum z before restoring time order. The plots show the exact returned candidates, including rejections.

05 / What the evidence supports

A transparent method.
A bounded claim.

These real development recordings explain how the detector reaches its decision. They do not establish independent detection accuracy or biological identity.

  • The reviewed supports are detector proposals confirmed by a reviewer, not independently annotated boundaries.
  • The thresholds are development choices, not universal constants.
  • A retained interval is a proposed passage, not a biological classification.
  • The waveform display preserves bucket minima and maxima; detection uses every original sample.
Explore the original notebook What the detected events feed: learning without labels

The academic foundations

Where this work connects.

Programming & computational methodsSignal & image processingMathematics & statistics
Explore another projectSSL · Learning without labels ↗