Chapter 05

The twist: HSEs, not ripples

The previous chapter ended on a problem of timing. By the moment the local field potential shows you a clean sharp-wave ripple, several tens of milliseconds of replay have already elapsed. The burst you are reacting to is mostly already over. To interrupt a memory while it is still being rehearsed, the standard SWR signature is too late. The closed-loop system has to find a faster signal.

This chapter is about the trick that made the experiment possible. It is, in retrospect, obvious, like a lot of the better tricks in electrophysiology — but it took some convincing on the way in, and the gain it delivers is the difference between a closed-loop system that mostly misses and one that mostly catches.

Why the SWR detector is slow

A textbook SWR detector takes the broadband LFP, bandpass-filters it to the 150–250 Hz ripple band, computes the envelope (Hilbert transform or rectify-and-smooth), and waits for the envelope to cross a threshold. Each of those steps adds latency. The bandpass filter has a group delay set by its order — for a steep filter, ten or more milliseconds. The envelope smoother adds another five to ten. And the threshold itself can only be crossed once enough ripple cycles have piled up to lift the envelope above the noise floor — another twenty milliseconds at minimum. Add it up and you are reacting thirty to fifty milliseconds after the event began.

Inside that thirty to fifty milliseconds, a 150-millisecond replay is already a third or a half done. The laser, fired now, will catch the tail; it will not interrupt the sequence being rehearsed in the first half. For an experiment that wants to causally test content-specific consolidation, that is not good enough.

What the ripple is, underneath

A sharp-wave ripple is, mechanistically, the LFP signature of a brief synchronous depolarization of a few thousand CA1 pyramidal cells. The synchrony is what produces the sharp wave (a slow extracellular voltage deflection from the synchronized current sinks) and what produces the ripple (a fast oscillation set up by the local interneuron network responding to the surge). Both signals are downstream of the same upstream event: a sudden increase in pyramidal-cell firing rate. If you watch the firing rate directly, you see the synchrony at its source, before the LFP has had time to develop a recognizable signature.

That is the entire idea behind triggering on a high-synchrony event, or HSE. Sample the multi-unit firing rate across a tetrode (or a population of tetrodes), watch for a transient surge above baseline, and call that surge an HSE. The detector is reacting to the synchrony itself, not to the slow LFP echo of the synchrony, so it fires earlier — typically by thirty to forty milliseconds, sometimes more.

The race

The interactive shows one such event in slow motion. The same sharp-wave ripple drives all three traces. Watch the multi-unit firing rate cross its threshold first, the laser fire one millisecond later, and only then the ripple-band envelope drag itself across its own threshold. The latency budget for the closed-loop pipeline — spike acquisition, feature extraction, threshold check, decoder evaluation, laser trigger — is under two milliseconds end-to-end. The HSE, not the SWR, is what makes that budget possible.

Interactive · the latency race
One sharp-wave ripple, three traces 300 ms · slowed for viewing
SWR detection − HSE detection · 200 events illustrative

One synthesized sharp-wave ripple, played out across 300 ms. Top trace: the raw LFP. Middle: the ripple-band envelope a classical SWR detector watches. Bottom: the multi-unit firing rate. The HSE detector fires when MUA crosses its threshold; the SWR detector fires only once the envelope crosses its own. The laser is wired to the HSE detector and beats the SWR detector by tens of milliseconds.

The histogram below the trace generalizes the picture. Across many events, the HSE detector almost always wins. There is a long tail of larger leads when the ripple is slow to build, a sharp peak around thirty to forty milliseconds, and a small fraction of cases where the SWR detector happens to fire first — usually low-amplitude events whose synchrony is distributed across a longer interval.

Two more reasons to like HSEs

Speed is the headline gain. Two further advantages came along for the ride.

Coverage. A non-trivial fraction of replay events ride on weak ripples — clean sequences in the spiking, but ripple-band envelopes barely above noise. A threshold-tuned SWR detector either misses these or has to be pushed so low that it false-fires on artifacts. The HSE detector picks them up regardless of whether the LFP went clearly super-threshold, because the synchrony is there in the spikes whether or not the ripple crystallized.

Drift tolerance. A fixed multi-unit threshold drifts out of calibration within an hour. Sleep stage transitions, electrode drift, the small biological tides of a long recording all shift the baseline. The system Igor built uses a dynamic threshold — a rolling z-score against the last several seconds of MUA — so the detection rate stays pinned at roughly one hertz, matched to typical SWR rates during slow-wave sleep, regardless of when in the four-hour rest you are.

The cost

Nothing is free. The price for HSE detection is specificity. Not every multi-unit synchrony burst is a true replay event. Some are wakeful arousals, some are motion-coupled bursts, some are simply incidental synchrony with no organized sequence at all. A pure SWR detector, despite its latency, was at least confident that whatever it caught looked like an SWR. Trading the LFP signature for raw multi-unit synchrony broadens the catch — and brings in a fair number of events you do not want to interrupt.

The closed-loop system gets specificity back at a different stage of the pipeline. The laser only fires if (a) an HSE is detected, and (b) the spike pattern over the past couple of hundred milliseconds, decoded against the place maps from waking, looks more like Room A than like Room B or like nothing at all. The HSE buys speed; the decoder buys selectivity. The next chapter is about how the decoder makes that decision in roughly one millisecond, on unsorted spikes, in C++.

Real numbers, coming online

The latency distribution above is illustrative — mean and spread chosen to match the published behavior of HSE-vs-SWR detection. The actual cross-correlation from Igor’s lab (Figure S3B of the paper, plus the underlying processed data in RESULTS/_FIGURES/PHYSIOLOGY/) will replace the synthesized histogram once that data lands in astro/public/data/. The interactive’s structure does not need to change.

§