Estimating Phenolics from Spectra
Introduction
Since 2013, we have passed every must and wine sample through a spectrometer — daily through each fermentation, at every cellar sampling, and, in recent vintages, on the berries and juice before harvest. A companion note, Spectra and Color Evolution (Spectra and Color Evolution — Chateau Hetsakais), showed what those spectra say about color. This note goes a step further, from color to chemistry: it reviews how the spectra can estimate the phenolic compounds that actually build the wine — the anthocyanin pigments, the tannins, and the iron-reactive phenolics.
The conventional approach to measuring phenolic components is using the time-consuming and thus expensive Adams-Harbertson assay in a wet laboratory. The modern alternative is to use a service provider that has correlated an extensive database of Adams-Harbertson results with the spectra of the respective samples. The service bureau then uses these correlations to shortcut the wet laboratory by estimating the phenolic components of new samples based on their spectra alone. By keeping the correlations proprietary, the service provider can replace the high cost of the wet laboratory with the low cost of measuring the sample spectrum and computation. We have used WineXRay (WineXRay for Phenolics in Wine — Chateau Hetsakais) to provide this fee-based service since 2014. Substituting the expensive wet-lab analysis with WineXRay, or any of its competitors (TheWineCloud, CloudSpec, ETS Laboratories, etc), has drawbacks:
The estimation error of the wet-laboratory is compounded by the estimation error of the proprietary correlations used.
Our own spectrometer may produce slightly different measurements than the spectrometer used by the service provider for the base samples underlying the correlation, thus adding to the estimation error.
The integration of external service providers with our own systems, exporting spectra and receiving results, is manual and cumbersome, and prone to additional errors.
So far, we have tried to adjust the most egregious outliers after visual inspection manually. The following graphic illustrates the “error problem”. It shows, on the left, the estimated Bound Anthocyanins during the fermentation of Cabernet Sauvignon in 2013, as reported by WineXRay (WXBAnt, the “raw” data), vs. a trajectory of the data; and, on the right, the same with the manually adjusted data (WXBAntU, the “used” data).
Figure 1. Bound anthocyanins over the 2013 Cabernet Sauvignon fermentation. Left: as reported by WineXRay (WXBAnt), with three spurious spikes (red). Right: after manual adjustment (WXBAntU), the spikes are pulled back onto the trajectory.
Clearly, there is significant noise here. Bound Anthocyanins are supposed to rise and fall smoothly – like the trajectory – but they don't, and the sources of the errors are not clearly identifiable. We decided to address the drawbacks by fully internalizing the estimation process with the following approach:
We use our own history of over 2,000 spectra, collected WineXRay estimates, and underlying chemical and colorimetric data to estimate our "correlation". Using our own history most probably increases the estimation errors
We adjust the initial results of our own "correlation" using trajectories estimated for each berry, fermentation, or cellar batch over its life. The use of trajectories should reduce the estimation errors.
By taking the process fully in-house, we eliminate possible errors from data transfer and differences in spectrometer measurements.
The idea of describing a phenolic's path over the life of a batch with a smooth curve is not itself new: a substantial literature models the extraction and evolution of color and phenolics through red-wine maceration and aging, and reviews of that work catalog the empirical and mechanistic curve families used to do so [8], [9]. What is novel here is the purpose we put those trajectories to. Rather than fitting a curve to describe the underlying chemistry, we use trajectories as a second layer on top of the spectral estimates — first to clean the data, by rejecting readings that stray from a batch's own smooth path, and then to validate and retroactively adjust the single-spectrum estimates against the trajectory drawn through them. Coupling an instantaneous, spectrum-by-spectrum estimate to the temporal path of the batch it belongs to is the heart of our approach.
Here is a preview of the results. The side-by-side graphic compares WineXRay's estimates for the same example shown above with our internal results.
Figure 2. The same fermentation. Left: WineXRay as reported (WXBAnt), with the three spikes (red). Right: our in-house model estimate (WXBAntClaudeERi, circles), which is free of the artifacts. Two reference curves are shown: a trajectory fit to the raw data (green) and the revised trajectory (blue, WXBAntClaudeERiTraj) fit through the model estimates; the two run close together. Estimates begin on day 7, when filtered spectra are available.
This note explains our new estimation process in detail.
Step 1 - Filtered Spectra & Color Parameters: We start by filtering out noise from all our spectral measurements and computing color parameters for each spectrum.
Step 2 - Recorded Phenolics and their Estimated Trajectories: We examine how recorded phenolics evolve over the life of a berry lot, a fermentation, and a cellar batch, and fit a smooth trajectory to each.
Step 3 – Adjusting for outliers: We fit each phenolic's trajectory to the raw WineXRay values, flag any reading more than 2 standard deviations off that first-pass curve, drop the flagged points, and refit — a two-pass robust fit.
Step 4 – Estimating Phenolics from a single Spectrum: We build models that estimate phenolics directly from a single spectrum using past observations, but we only include instances that are not flagged as outliers by the 2-standard-deviation trajectory rule.
Step 5 - Trajectory of Estimated Phenolics: We push those estimates back through the trajectory fitter, check that the estimated path matches the recorded one, and adjust the model retroactively to the respective berry, fermentation, or cellar batch.
Step 6 – Understanding Interventions: We ask whether and how interventions such as acid, carbonate, sulfur, fining, barrel changes — leave a mark on the phenolics.
Step 7: Spreadsheet Implementation: Finally, we fold the whole chain into a spreadsheet a cellar hand can use the moment a spectrum comes off the instrument
We close with a section on what we learned and where this may lead to next (8).
Step1: Filtered Spectra and Color Parameters
Another page on the website describes in detail how we filter out measurement noise from the spectrometer and compute industry-standard colorimetric parameters (Spectra and Color Evolution — Chateau Hetsakais). Every time we touch the must or wine, we measure and record an absorbance curve, sampled at 1 nanometer intervals from 200 to 900 nm. Raw absorbance carries symmetric measurement noise from re-zeroing the instrument against distilled water. So before anything else, we smooth each curve with an eleven-point, second-order Savitzky–Golay filter and compute the industry-standard CIE L*a*b* color parameters. While we provide the unfiltered spectra to WineXRay as input for their phenolic estimation, we use only filtered data in our analysis. The following graphic shows the minute impact of filtration.
Figure 3. A single spectrum (a 2025 Cabernet barrel sample), raw versus Savitzky–Golay filtered. Left: the full 200–900 nm curve. Right: a zoom on 500–620 nm, where the filter erases the calibration jitter without shifting the underlying absorbance.
Between 2014 and 2026, we recorded over 2,000 spectra linked to specific samples of berries, must, and wine.
Step 2 - Recorded Phenolics and their Estimated Trajectories
On another page of this website, we described how we use models to represent a fermentation (Modeling the Fermentation — Chateau Hetsakais ). In a nutshell, the models/trajectories are described as mathematical equations that explain how a chemical property in the must evolves during fermentation. The model for each chemical property is fitted to the observed values during the fermentation. We call the collection of these fitted curves the "fingerprint" of a fermentation. Here is an example
Figure 4. All ten trajectories for the 2023 Cabernet Sauvignon, shown together — its fingerprint. Dots are measurements; lines are the fitted model. Sugar falls, and alcohol rises in mirror-image S-curves; free and total anthocyanins rise to a peak and recede; tannins and phenolics climb to a plateau; acidity and pH drift.
For berry development, WineXRay reports total extractable anthocyanins. We analyze berries to time the harvest: the aim is to pick just after extractable anthocyanins reach their peak, while sugar is still around 22.5 Brix and pH is still below about 3.7—a window that is not always attainable. Of the three signals, the spectrum lets us follow the anthocyanin peak directly.
For fermentations, WineXray reports five phenolic quantities on each sample: bound anthocyanins (we label BAnt), free anthocyanins (FAnt), total anthocyanins (TAnt), tannins (Tan), and total iron-reactive phenolics (TIRP). Read in sequence over the life of a fermentation batch; for example, they trace phenolic variables: pigments and tannins are extracted during fermentation, then rearrange and settle during aging. No single curve type ("trajectory model") fits every phenolic, so we let the chemistry choose the type. During fermentation, the phenolics rise:
free and total anthocyanins follow a Bateman rise-then-fall (extraction, then a late decline as pigment binds), while
tannins are best described by a Weibull rise — a cold-soak lag followed by a steep active-ferment climb to a plateau.
In the cellar, the story splits into 5 segments, each with its own cellar-batch and its trajectory model:
Settlement (a week or two, when solids in the pressed juice settle out),
Maturation (approx. 3 years, when the wine matures in the barrel),
Topup (usually 1-3 years for wine kept in steel kegs reserved for topping up barrels),
Assembly (usually a week, for mixing the contents of different barrels) and
Bottle (up to decades).
We only build models for Maturation, Topup and Bottle batches; the other (Settlement & Assembly) are too transient to matter.
Compared to Fermentation batches, the cellar Maturation and Topup batches show a different story: the movement inverts and plays out over years:
free and total anthocyanins decline to an asymptote as pigment precipitates and polymerizes,
tannins are remarkably stable, and
bound anthocyanins actually rise then plateau as free pigment converts to polymeric form — the same rise-then-fall Bateman shape we used for fermentation:
Lastly, the Bottle batches show surprisingly little movement in phenolics. The measurements don't change much, so we fit them only a slow linear drift.
The following table summarizes the trajectory model choices that yielded the best fits across all batches within the same class. It also shows the least-squares errors (observation vs. trajectory) across all batches of the same class.
Table 1: R² is the median across all batches in the class. — = not applicable: at the berry stage, WineXRay reports only total extractable anthocyanins and no batch-class trajectory is fit. Time in fermentation is measured in thermal (temperature-adjusted) days
So, to recap, each phenolic parameter in each batch class is assigned a trajectory type, and the parameters of that trajectory type are calculated for each batch to minimize residuals across all batches in the class.
The following table shows the parameters and their meaning
Table 2: Parameters of trajectory families
To illustrate the results, the following graphic shows the trajectory and observed values for Bound Anthocyanins in the 23CS1 cellar Maturation batch.
Figure 5. Maturation batch 23CS1 — recorded bound anthocyanins (points) with the fitted Bateman trajectory.
This figure shows in miniature the same for each cellar Maturation batch.
Figure 6. Recorded bound-anthocyanin trajectories for the maturation-phase cellar batches, each fit to a Bateman rise-then-plateau starting on the day with the first observation. Points are laboratory readings; the curve is the fitted trajectory.
Step 3. Adjusting for outliers
To recap, for each phenolic variable we start from the raw WineXRay reading and fit its trajectory with a two-pass robust procedure:
Raw — the number WineXRay provided (WXBAnt, WXFAnt, WXTAnt, WXTan, WXTIRP).
RawTrajectory — the first-pass trajectory fit through all the raw values.
RawAdj — the adjusted series: the raw value at points we keep, and the trajectory value at any point rejected as an outlier.
Figure 1 above illustrates the raw noise. Outlier handling is purely algorithmic: any reading more than 2 standard deviations from the first-pass RawTrajectory is treated as an outlier and dropped, and the trajectory is refit through the remaining points. This two-pass robust fit — 2-SD outlier rejection — yields:
RawAdjTraj — the second-pass trajectory, refit through the kept points: our best estimate of the true path.
The two-pass fit replaces the manual adjustment of blatant outliers we used before implementing this automated approach. A sparse-batch guard covers the rare case where a batch has too few points to drop any: there the flagged point is kept but reset to the trajectory value, so the fit stays determined.
Figure 7 illustrates this two-pass outlier rejection.
Figure 7. Two-pass robust fit with 2-SD outlier rejection — 2013 Cabernet fermentation, total anthocyanins. Left: the pass-1 trajectory is fit through all readings and its ±2 SD band flags four points (red). Right: the trajectory is refit with those points dropped; each flagged reading (hollow) takes the trajectory value as its adjusted value (green diamonds).
Why fit the raw values rather than the hand-adjusted ones? Because the two-pass fit reproduces the manual correction without loss of accuracy — so nothing is lost by dropping the manual layer.
Figure 8. The automated fit reproduces the retired manual correction. For each of the 191 points a winemaker corrected by hand, the raw two-pass trajectory value (coloured, by phenolic) is plotted against the manual "Used" value; the raw WineXRay reading we rejected is shown for contrast (grey). The two-pass estimates hug the 1:1 line (median ~26 ppm off the manual value); the rejected raw readings scatter widely (median ~120 ppm). Log–log axes.
The trajectories describe how phenolics move over time; the estimation model seeks to replace WineXRay results for observations at a single point in time. We developed multiple estimation models – one for each phenolic variable in each stage of evolution: berry, fermentation, cellar maturation and bottle. The input is the filtered spectrum curve (the ~700 one-nanometre bands) together with the three CIE color numbers; the target is the corresponding raw WineXRay reading, excluding readings flagged as outliers by the 2-SD trajectory rule.
To choose the best model, we evaluated multiple estimation model types as summarized in the following table.
Table 3: CV R² on anthocyanin targets — juice/berry anthocyanins at the berry stage; the five WineXRay phenolics at fermentation and cellar (leave-one-batch-out). The full set was compared head-to-head at the berry stage; fermentation and cellar re-ran the finalists. Ridge and gradient boosting finish within ~0.01 R² almost everywhere.
In the end, the choice was between a linear ridge regression and gradient-boosted trees. The following table shows the R2s in the bake-off.
Table 4: Leave-one-batch-out cross-validated R². Random forests were also evaluated at the fermentation stage and trailed both models (not shown). Ridge is within ~0.01 of gradient boosting in almost every cell and was selected across all stages because it is linear — its per-wavelength weights drop straight into the spreadsheet. (Gradient boosting edges Ridge on cellar tannins and iron-reactive phenolics.)
Ultimately, the Ridge models won across all three stages (Berry, Fermentation & Cellar), primarily because they are linear and can be easily implemented in a spreadsheet. Its R2 performance is at par with, or very close to, that of Gradient Boosting. For Fermentation and Cellar batches, the lesson is that phenolics can be estimated using a linear function of the sample's spectral absorbance in the 200-900 nm range plus the CIE color parameters. Note that the sample's absorbance is, to first order, linearly proportional to the concentration, and the CIE color parameters are a nonlinear function of the spectra.
An important note on evaluation. We trained each model for each batch – each time holding out that batch for validation and then averaging the error measurements across all batches. So, no training run ever sees the outputs against which it is evaluated. The model that won on this basis (Ridge) is then reoptimized on the entire dataset for deployment on future data.
The following graphic shows the R2 for the different phenolic variables.
Figure 9. Estimation accuracy by stage and phenolic. Fermentation musts are the easiest to read (0.94–0.99); the pre-harvest berry anthocyanin model reaches 0.91; cellar wines run 0.87–0.91.
The results hold up. Pre-harvest, a ridge model estimates juice anthocyanins from pulp spectra, with R² = 0.91. In fermentation, where pigment dominates the color and the signal is strongest, the five phenolics are read at R² 0.94–0.99. In the cellar — where the wine is darker, older, and chemically more varied — the five phenolics are read at R² 0.87–0.91, with total anthocyanins, tannins, and iron-reactive phenolics all above 0.90 and no systematic bias across cellar phases. Notably, tannins are estimated well from the spectrum (0.91) even though their cellar trajectory is nearly flat and hard to fit — the instantaneous spectrum carries the tannin signal cleanly even when there is little movement over time to model.
The following scatter charts illustrate the measured vs. predicted phenolics in the cellar.
Figure 10. Cellar wine phenolics: predicted (leave-one-batch-out) versus measured, coloured by cellar phase. All five sit on the diagonal with no phase-dependent bias.
Remember, though, that the R²s measure accuracy vs. the WineXRay results, not the accuracy of the true phenolics, because the WineXRay measures are estimates themselves.
The same comparison at the berry stage has to be drawn three times, because the berry estimate is two models added together: one reads the anthocyanins in the pulp from the pulp spectrum, the other the increment held in the skins from the whole-berry spectrum, and the total extractable anthocyanins are their sum. The two carry very different weight — the skins are about nine tenths of the total — and, as the panels show, they behave differently as well.
Figure 11. Berry anthocyanins: estimated from the spectrum versus recorded, for the pulp model, the berry model and their sum. Ridge, 2015–2025, with the 2026 samples overlaid in orange; the dashed line is agreement and the solid line the fit through the historical points. Thirteen samples are held out as bad scans — on 24 September 2018 and 30 September 2020 the pulp estimate runs 2.3 to 3.5 times the recorded value across every block scanned that day, with nothing in the record to account for it.
Neither fit sits on the diagonal, and the departure is not a shift but a slope. The pulp model comes closest to the line at 0.93; the berry model, on a term ten times larger, runs at 0.87, which is what carries the sum to the same 0.87. That is the signature of a ridge estimate rather than a fault in it — the penalty that buys the accuracy pulls every prediction toward the middle of the calibration, so the estimate reads high where the fruit is pale and low where it is dark. At a recorded 1,000 mg/L the sum reads about 130 high; at 2,400 it reads about 100 low.
Whether to correct for that is a question this paper leaves open, because the answer depends on what the number is for. Dividing the slope out would put the levels right and inflate the noise by the same factor. For locating the anthocyanin peak — what the berry sampling is actually for — a compressed hill has its maximum in the same place, so the correction buys nothing and costs precision. For comparing one vintage’s level against another’s, it would matter, and the recorded series is the better basis for that comparison in any case.
The next question is: which part of the spectrum matters most? Grouped into wavelength regions, the answer is consistent across every phenolic: roughly half the weight sits in the visible band (380–780 nm), where anthocyanin color and browning absorb, about a quarter in the near-infrared, and the rest in the ultraviolet, where tannins and the aromatic ring absorb.
Figure 12. Ridge feature importance as a share of total weight, per cellar phenolic. The visible region accounts for ~50%, the near-infrared for ~25%, the ultraviolet for ~15%, and the three color parameters for 1–3%. Individual-band spikes are collinearity artifacts, not signal (see text).
What is not meaningful is any single wavelength's coefficient: neighboring bands are almost perfectly correlated, so the Ridge model spreads one real effect across a jitter of positive and negative weights that partly cancel. The following graphic illustrates this point.
Figure 13. Ridge feature importance as a share of total weight, per cellar phenolic. The visible region accounts for ~50%, the near-infrared for ~25%, the ultraviolet for ~15%, and the three color parameters for 1–3%. Individual-band spikes are collinearity artifacts, not signal (see text).
We confirmed this with a bootstrap — refitting on resampled batches, only about 1 in 7 individual bands even holds its sign, while the regional shares are stable to a few percent. The predictions are unaffected because the opposing weights cancel in the sum; only the fine-grained interpretation is unreliable, which is why the deployed model reproduces exactly despite the jagged coefficients.
We went one step further to illustrate the point. We compared a single Ridge optimization fit for WXBAnthosU against 60 independent bootstrap samples. Every bootstrap is valid on its own even though the weights for each wavelength are quite different. Yet the averages tell the story: each phenolic variable is reflected in multiple wavelengths across the spectrum – most probably because a specific phenolic is not a single molecule. For example, there are approximately 15 primary monomeric anthocyanins, which expand into hundreds to thousands of distinct complex anthocyanin derivatives as the wine ages.
Figure 14. Per-band Ridge coefficient for total anthocyanins: 60-bootstrap mean (black) vs the individual bootstrap refits (light). Adjacent band weights flip sign fit-to-fit — only the smooth mean / regional aggregate is stable.
A measurement the laboratory declines to make
WineXRay does not report a phenolic below a floor: 25 mg/L for tannins, 10 for bound anthocyanins, 50 for total. Below that the instrument returns nothing, and in our records the field is simply empty. Across the fermentation archive that covers 134 tannin and 32 bound-anthocyanin readings — the first days of every ferment, when extraction has barely started.
Until now, those records were dropped before training, which is the obvious thing to do with a blank. It is also the reason the model could return a negative concentration. Every tannin reading it ever saw came from day four or later, so at the pale end it was extrapolating past the edge of its own evidence: 10 % of the fermentation archive came back below zero, and a September 2026 Petit Verdot / Cabernet Franc must sampled hours after crush was read at −149 mg/L.
A blank of this kind is not a missing value. The reading is left-censored — we do not know the number, but we know it is under 25 — and that is information the fit can use. Each of the two affected phenolics is now fitted on the square root of the concentration by expectation-maximization for a censored normal: a reported reading contributes its value, a floor reading contributes its bound, and the estimate is squared back at the end. In the spreadsheet this costs one operator.
A negative estimate is now impossible, and the low end is read far better. Under the same leave-one-batch-out test used everywhere else in this note, tannins below 200 mg/L go from a mean error of 68 mg/L to 35, and of the samples WineXRay refused to report, the share the model places inside the 0–25 window rises from 23 % to 79 %. Bound anthocyanins improve throughout — R² 0.939 to 0.943, and below 50 mg/L the error falls from 5.2 to 3.5 mg/L.
For tannins, the overall R² does not move (0.9745 to 0.9738), and the mean error above 200 mg/L rises from 38 to 57 mg/L. The square-root scale weights relative rather than absolute error, so accuracy shifts from the concentrated end of the range to the dilute one. That is the trade we want — the early-ferment reading is the one we act on — but it is a trade, not a free gain.
One approach we tested and rejected: dropping the samples that produce a negative estimate and refitting. Scored inside the cross-validation folds it buys nothing and makes the low end worse — the mean estimate on a floor sample moves from +7 to −31 mg/L and the share of negatives rises from 8.9 % to 12.0 %. Selecting training rows by the model's own output truncates the residuals rather than shrinking them, and here the discarded rows are almost all at low concentration, so each pass removes more of the evidence the pale end depends on.
Figure 15. The WineXRay reporting floor for tannins. Left: the 102 fermentation musts read as “<25”, and where each treatment places them; the band is the 0–25 window they belong in. Right: leave-one-batch-out error against the laboratory value by concentration. Keeping the floor readings as censored observations moves accuracy from the concentrated end of the range to the dilute one, and makes a negative estimate impossible.
Step 5: Trajectories of the estimated phenolics
Figure 16. Cellar batch 20CS2 — total anthocyanins: recorded trajectory (grey) vs the spectral-estimate trajectory (red).
If the estimates are sound, feeding them into the same trajectory fitter should approximate the path traced by the WineXRay readings. It does. For every batch, we fit two trajectories with the identical class-aware family — one through the raw WineXRay points (two-pass robust) and one through the spectral estimates — and in the large majority of batches, the two lie almost on top of each other. The estimates reproduce not just isolated points but the whole shape: the fast early decline and long plateau of the anthocyanins, the near-flat tannins, the rise-then-settle of the bound pigment. Where the two paths part company, it is confined to a handful of sparse top-up lots with few early samples. This is the strongest single check that the estimation is doing real work: a model that merely fits noise would not trace a coherent trajectory through its own predictions.
The graph on the right illustrate this point for Total Anthocyanins, starting with a single Cellar Batch 20CS2. The following graph shows the same in miniature for all cellar batches.
Figure 17. Total anthocyanins per cellar batch: the trajectory through the laboratory readings (grey) versus the trajectory through the spectral estimates (red). The two nearly coincide across maturation, top-up, and bottle phases.
Figure 18. Fermentation batch 2021Me1 — total anthocyanins: recorded trajectory (grey) vs the spectral-estimate trajectory (red).
Next to the Fermentation Batches, starting with a single Fermentation Batch 2022Me1
And below are miniatures of all the fermentation batch trajectories
Figure 19. All fermentation batches — total anthocyanins: recorded trajectory (grey) vs spectral-estimate trajectory (red).
Figure 20. Berry block CabF, 2023 — Total Extractable Anthocyanins over days-to-harvest: the recorded WineXRay-adjusted trajectory (grey) versus the spectral-estimate trajectory (red).
Finally, a view of the Berry test trajectories, first for a single batch, CabF 2023:
And for all the berry test batches
Figure 21. Total Extractable Anthocyanins (pulp + berry) per vineyard block × vintage over days to harvest: the recorded WineXRay-adjusted trajectory (grey) versus the spectral-estimate trajectory (red, open) built by summing the pulp and berry Ridge models. Across the 246 sampled berries, the estimated TEA tracks the recorded value with R² = 0.85 (MAE ~70), and where both curves show a peak, the estimate locates it within a median of ~2.3 days of the recorded peak
Figure 22. For the block-vintages whose sampling bracketed the anthocyanin peak, the position of that fitted peak relative to harvest. Every one falls on the pre-harvest side, a median of ~12 days before the pick — the extractable-color maximum the picking decision aims for, seen from the spectrum
A review of the estimated peak total extractable anthocyanins shows that we harvested on average 12 days after the peak. This indicates we tend to harvest later than originally intended
Step 6. Do cellar interventions move the phenolics?
By now we have a firm grip on observed phenolics and valuable in-house models to estimate phenolics in the future. All of this assumed there were no interventions that would have altered the spectra and the resulting phenolic estimates. But there were interventions.
Figure 23. Cellar batch 19CS1 — total anthocyanins with intervention points (tartaric acid, SO₂, fining, barrel changes) marked on the trajectory.
A cellar, in particular, is not passive: we have added tartaric acid and, in one instance only, potassium carbonate to adjust acidity, and, up to recently, we added sulfur to protect the wine; we fined with egg white; we reduced volatile acidity with reverse osmosis; and we racked and moved the wine between barrels. Each of these "interventions" might have left a mark on the phenolics. To test it without assuming the answer, we measured — for every intervention — how far the phenolic jumped away from its own smooth trajectory at the next sample, beyond what the trajectory already predicted. We pooled that residual jump across all events of each type.
The dominant finding is that time, not intervention, drives the phenolics: every effect is at most a few percent, and none reaches statistical significance. Two are directionally coherent and sit at the edge of significance, exactly as the chemistry predicts. Egg-white fining pulls free anthocyanins and tannins down by about 5% — fining removes pigment and tannin, which is its purpose. Barrel changes show a smaller, consistent loss across the anthocyanins and tannins, in line with the racking and settling that accompany a vessel move. Acid, carbonate and sulfur additions are flat on the phenolics — consistent with their acting on pH, titratable acidity and free sulfur rather than on pigment. Our conclusion: interventions are second-order; the wine's own slow chemistry primarily defines the trajectory.
Figure 24. Intervention effects on cellar phenolics: mean departure from the smooth trajectory at the next sample, as a percent of the typical level, pooled by intervention type. Blue is a decrease, red an increase; none reaches significance, with egg-white fining and barrel changes the only coherent signals.
We expected the barrel switches to show a more pronounced effect, but they did not. The reason: barrels don't have jump effects; they impact a wine slowly over time.
Step 7: A spreadsheet for real-time estimation
The point of all this is to put a phenolic reading in our hands the moment a spectrum comes off the instrument, with no round-trip to a laboratory and minimal loss of accuracy. We built that into a single spreadsheet. Paste a raw spectrometer file into a tab and the workbook does the rest: it applies the Savitzky–Golay filter, derives the CIE L*a*b* color, and multiplies the filtered curve and color by the model's coefficients to return all five phenolic estimates. The heavier metadata is pulled from the file header — filename, date, and the sampling time when the filename records one — leaving the user with only a handful of choices: the vessel type, the varietal, and whether the sample is a fermentation must or a cellar wine.
That last choice is what makes one sheet serve both stages. The ridge models are linear, so each collapses to a plain list of per-wavelength weights and an intercept, and the estimate is a single sum-of-products the spreadsheet evaluates natively:
estimate = intercept + Σ weight(λ) · absorbance(λ) + Σ weight · colour
Tannins and bound anthocyanins carry the square root of that sum, floored at zero and squared — MAX(0, …)² — for the reason given in Step 4; the other three are the plain sum. A stage switch picks the fermentation (must) coefficients or the cellar (wine) coefficients accordingly, so the same pasted spectrum yields the right estimate for its stage. We verified the in-sheet result against the original Python model to a part in a trillion, and the workbook recalculates with zero formula errors — the spreadsheet is not an approximation of the model; it is the model.
A second spreadsheet implements the estimation of Total Extractable Anthocyanins in berry samples.
At the end of each day, we upload the spreadsheet results to our FileMaker database.
Step 8: Spreadsheet for updating the estimates with Batch Trajectories
Berry batches are complete shortly before harvest. Fermentation batches are complete when the fermented must is pressed. Maturation batches are complete when the contents of a barrel are ready for assemblage and bottling. At completion, we load all measurements of a given batch from the FileMaker database into a spreadsheet template to compute the optimized parameters for all the trajectories. Then the 2-SD rule adjusts the phenolic estimates by eliminating outliers, and with the adjusted data points, the phenolic trajectories are reestimated.
The following graphic shows a screenshot of the fingerprint for fermentation batch 2018CSCH
What we learned and where it goes
We have six primary takeaways at this point
Spectra-derived parameter estimates harbor hidden estimation errors: they are derived from wet-lab assays that also introduce estimation errors. On top of those, there are estimation errors in the model that translates spectra into parameter estimates, measurement noise in the spectrometer, and differences between spectrometers.
The spectrum is the measurement. A well-regularised linear map from the filtered curve plus color reads every phenolic at every stage — R² 0.91 pre-harvest, 0.94–0.99 in fermentation, 0.87–0.91 in the cellar — under a strict batch-held-out test.
Estimates reproduce entire trajectories, not just points. Fitting the same class-aware curve to the spectral estimates recovers the path traced by the laboratory readings, providing the strongest test that the model captures the chemistry rather than the noise.
The chemistry chooses the curve. Fermentation is extraction (Bateman for pigment, Weibull for tannin); the cellar is decline for the free pigment, stability for tannin, and a slow rise-then-plateau for the bound pigment — with bottle lots essentially flat.
Interventions are second-order. Time sets the phenolic trajectory; fining and barrel changes leave only a small, coherent mark, whereas acid, carbonate, and sulfur additions leave none.
The trajectory cleans the data. A two-pass robust fit to the raw WineXRay values reproduces our former manual corrections — with a median of ~26 ppm and closer to the manual value than to the rejected reading for 94% of edited points — so outlier correction is now automatic and, crucially, available at prediction time when no hand-adjusted value exists.
What the laboratory will not report is still a reading. WineXRay declines to give a number below its floor, and treating those blanks as censored rather than missing is what stopped the model returning negative concentrations in the first days of a ferment — the same days on which we decide how to run it.
Several threads are worth pursuing next. The per-spectral-region importance can be made genuinely interpretable by fitting to a binned spectrum or to principal components rather than to the raw collinear bands, thereby turning the stable regional shares into a defensible chemical statement. New-oak tannin pickup should be modeled as a slow, barrel-age-keyed contribution rather than a switch-day step, which the next-sample test cannot detect. The most valuable extension is prediction from early signals: whether the first weeks of extraction or the color and phenolics at press foretell where a wine will land—tying these estimates back to the color trajectories and the fermentation kinetic fingerprints developed elsewhere in the project.
References
[1] Savitzky, A., & Golay, M. J. E. (1964). Smoothing and differentiation of data by simplified least squares procedures. Analytical Chemistry, 36(8), 1627–1639.
[2] CIE (2004). Colorimetry, 3rd edition. CIE 15:2004. Vienna: Commission Internationale de l'Éclairage.
[3] Ribéreau-Gayon, P., Glories, Y., Maujean, A., & Dubourdieu, D. (2006). Handbook of Enology, Volume 2: The Chemistry of Wine Stabilization and Treatments, 2nd ed. Wiley.
[4] Boulton, R. (2001). The copigmentation of anthocyanins and its role in the color of red wine: A critical review. American Journal of Enology and Viticulture, 52(2), 67–87.
[5] Hoerl, A. E., & Kennard, R. W. (1970). Ridge regression: biased estimation for nonorthogonal problems. Technometrics, 12(1), 55–67.
[6] Efron, B., & Tibshirani, R. J. (1993). An Introduction to the Bootstrap. Chapman & Hall.
[7] Pérez-Magariño, S., & González-San José, M. L. (2004). Evolution of flavanols, anthocyanins, and their derivatives during the aging of red wines. Journal of Agricultural and Food Chemistry, 52(5), 1181–1189.
[8] Setford, P. C., Jeffery, D. W., Grbin, P. R., & Muhlack, R. A. (2017). Factors affecting extraction and evolution of phenolic compounds during red wine maceration and the role of process modelling. Trends in Food Science & Technology, 69, 106–117.
[9] Tindal, R. A., Jeffery, D. W., & Muhlack, R. A. (2021). Mathematical modelling to enhance winemaking efficiency: a review of red wine colour and polyphenol extraction and evolution. Australian Journal of Grape and Wine Research, 27(2), 219–233.
Last updated, September 17, 2026