Why there is a high pass at all
The fit works on line shapes, not on the continuum. The continuum carries the blaze, the flat-field response, the atmospheric extinction and the exposure's throughput, and none of that is the quantity of interest. Worse, it varies by tens of percent between exposures while the lines move by parts per thousand, so a PCA run on the raw spectra would spend all its components describing the lamp.
So each exposure is high-passed before it enters the cube: a Savitzky-Golay filter estimates the smooth part, and the smooth part is subtracted in log flux. The filter runs per order segment, never across the gaps between orders, since a polynomial fitted across a gap is a polynomial fitted to nothing.
with \(W\) the window, set in velocity units so that it means the same thing at every wavelength, and \(p\) the polynomial order.
The problem: a filter is dragged by the lines it crosses
A Savitzky-Golay filter is a local least-squares polynomial. It does not know what a line is. When the window straddles a deep absorption line, the fitted polynomial is pulled downward, and the “continuum” it returns is the continuum minus some fraction of the line.
On its own that bias is harmless: it is a fixed function of wavelength, the same in every exposure, so the PCA sees it as part of the mean and it never reaches the velocities. The trouble starts when the bias stops being fixed.
A residual that tracks the BERV is the single most dangerous systematic in this business: it is periodic at one year, it is coherent across all the lines of a star, and it looks exactly like a planet.
Between those two epochs the mask over the stellar core goes from essentially absent to essentially total. The filter cannot not notice.
The fix: filter the residual to a template
Instead of filtering the spectrum, filter what the spectrum has that the template does not, then add the template's own filtered version back:
\(\bar{S}\) is the median of the whole campaign taken in the star's rest frame and carried back into each exposure's own frame. The crucial property is that the template has no holes: a pixel blanked in one exposure is perfectly well measured in the fifty other exposures where the telluric line sat somewhere else, so the median is defined everywhere.
The deep line now lives almost entirely in \(\bar{S}\). What is left in \(s - \bar{S}\) is small and flat, so the filter applied to it is not dragged by anything, whatever the mask does. And \(\mathrm{SG}[\bar{S}]\) is computed once on a support that never changes, so its bias is a fixed function of wavelength again, back to the harmless case.
Why the two forms are not algebraically the same
There is a tempting argument that this changes nothing. Savitzky-Golay is linear, so
That identity is correct, and it only holds when both filters see the same support. They do not. The residual \(s - \bar{S}\) inherits the exposure's mask, with its holes where the tellurics saturate; the template \(\bar{S}\) has no holes at all. Linearity does not survive two different supports, and the difference between the two sides is precisely the BERV-dependent term we are trying to remove.
What it bought, measured honestly
The expectation was never a large drop in rms: the mechanism feeds a small, slow systematic, not a large scatter. What it should do is clean up the components, so the stellar block stops hooking onto something that follows the BERV.
| Star | High pass | rms (m/s) | MAD (m/s) | Component 2 vs BERV |
|---|---|---|---|---|
| HD 69830 | ordinary | 3.51 | 3.36 | 0.106 |
| against a template | 3.50 | 3.29 | 0.040 | |
| GJ 581 | ordinary | 9.03 | 10.88 | 0.325 |
| against a template | 9.06 | 10.76 | 0.507 |
The rms is unchanged to within the error bars, as expected. On HD 69830 the second component's correlation with the BERV drops from 0.106 to 0.040, which is the effect the change was made to produce. On GJ 581 it goes the other way, from 0.325 to 0.507, and that is reported here rather than left out: an M dwarf's spectrum is dense enough that the median template is itself harder to build, and the diagnosis is not finished.
The template high pass is nevertheless the nominal path since 2026-10-16, on the conceptual argument rather than on the rms: a filter whose bias depends on which pixels happen to be masked tonight is not something to keep because its scatter happens to come out the same.
hp_template.npy, so the
correct stage applies the identical second pass to the
delivered spectra. The first version of this change forgot that: the
corrected files were built from raw log flux (median +10.14 instead of
+0.017), their noise doubled, and the report's river plots stayed perfectly clean, because the report was reading the cube, which
was right, while the files were not.