Chromatogram Peak Integration with USP Tailing
Operator: Abdulla Al Fahad. How tools are built and checked
A detector trace is only a column of numbers until a baseline is chosen, noise is separated from signal and boundaries are set around each peak. Each choice moves the areas, and the system-suitability figures that regulators ask for, tailing and resolution, move with them. This page does those steps in the open, one setting at a time.
It reads a time column and a signal column from a CSV, TSV or XLSX file, keeps nothing but the numbers, and reports retention time, height, area, area percent, width at half height, USP tailing factor, resolution to the previous peak and plate count.
Key features
- Three baselines: a straight line through the ends of the run, a rolling minimum, and asymmetric least squares (Eilers and Boelens 2005) solved in linear time
- Savitzky-Golay smoothing with a window and polynomial order you choose, applied to peak finding and to the height and width figures
- Peak detection from a signal-to-noise rule, an optional absolute height, a bar set by how far the corrected baseline still wanders, and a minimum width in points that rejects spikes
- Drop-line integration, which cuts overlapping peaks at the valley, or valley-to-valley baseline integration, on the raw corrected trace or the smoothed one
- USP tailing factor at 5% of the height, resolution by the baseline-width and half-height formulas, and plate count from the half-height width
- Boundary editing by time, adding a peak by time, removing a peak, and a chart exported as SVG or PNG
Baseline, smoothing and the peak figures this page reports
The file needs one time column that strictly increases and one numeric signal column. Rows where either cell is not a number are skipped and counted, and a run needs at least 30 points and at most 500,000. Time and signal units are labels only, so area comes out in signal units times time units.
Noise is the robust standard deviation of the first differences of the corrected trace, 1.4826 times the median absolute deviation divided by the square root of 2. It ignores peaks because they affect few differences. A peak qualifies when its smoothed height is at least the signal-to-noise setting times that figure and at least three times the robust spread (1.4826 times the median absolute deviation) of the smoothed, baseline-corrected trace. With a baseline that follows the drift the spread is close to the noise; a baseline that does not follow it leaves slow wiggles that raise the spread, and the bar for a peak rises with it, so those wiggles are not reported as peaks. The Noise SD figure on the page states the height a peak has to reach.
Boundaries run outward from each apex until the smoothed trace falls under 1% of the peak height (or two noise SDs), climbs by a visible amount into a neighbour, or reaches the valley shared with the next peak. Small bumps on a flank are ridden over, so ripple does not end a peak early.
Tailing is T = W0.05 / (2f), where W0.05 is the peak width at 5% of its height and f is the distance from the leading edge at that level to the apex, as defined in USP general chapter <621>. When a neighbour keeps the trace above 5% of the height, the width does not exist inside the boundaries, so no number is reported and the result explains why.
How it works
The baseline is estimated on the raw trace and subtracted. For asymmetric least squares the page minimises the sum of weighted squared residuals plus lambda times the squared second differences of the baseline, giving points above the fit the small weight p and points below the weight 1 - p, over 10 iterations. A larger lambda gives a stiffer baseline.
Peaks are found on the smoothed corrected trace with a hysteresis rule: a maximum counts only if the trace falls by a quarter of the minimum height on both sides. The retention time is the apex refined by a parabola through the three points around it.
Area is the trapezoid sum between a peak's boundaries. With drop lines two touching peaks share the boundary at their valley; with valley baselines each peak is measured above the straight line joining its own start and end.
Widths come from linear interpolation where the trace crosses the chosen fraction of the height. The baseline width for resolution comes from tangents drawn at the steepest points of each flank, intersected with the baseline.
Common use cases
- A QC analyst exports a 30-minute HPLC-UV run at 5 Hz, 9,000 points, and checks that the main peak's USP tailing is under 2.0 and its resolution from the nearest impurity is above 1.5.
- A student compares drop-line and valley integration on a shoulder peak and sees how much area the choice assigns to the smaller component.
- A method developer varies the smoothing window from 5 to 21 points and watches the half-height width and tailing of a sharp peak change.
- A lab without the instrument vendor's software on a spare PC opens a CSV from the data system, integrates a standard and exports areas to XLSX.
- A chemist adds a small peak the automatic rules missed because its signal-to-noise was 8, by typing its retention time.
How to use this tool
- Drop the trace or paste it, or load the simulated run, and check the time and signal columns.
- Pick a baseline; for asymmetric least squares start with lambda 1e6 to 1e7 and p 0.001.
- Set the smoothing window so it is narrower than the narrowest peak.
- Look at the chart: the dashed baseline should run under the peaks, not through them.
- Edit any boundary, add a missed peak by time, or remove a false one.
- Switch between drop-line and valley integration to see how much area a touching pair trades.
- Download the peak table as CSV, XLSX or PDF.
Example
A simulated 12-minute run (1,201 points, 0.01 min apart), asymmetric least squares with lambda 1e7, drop-line integration
time_min,signal_mAU
0.00,11.887
0.01,11.860
0.02,12.139
...
12.00,27.210
(a simulated trace: drifting baseline, noise, and an overlapping pair near 4.6 and 5.0 min)Peak table, with noise and the valley-to-valley areas
Noise SD 0.284 mAU
#1 RT 2.103 height 116.9 area 12.153 (18.5%) W1/2 0.0988 tailing 1.10
#2 RT 4.606 height 80.3 area 14.254 (21.7%) W1/2 0.1673 tailing 1.33 Rs 11.02 from #1
#3 RT 5.004 height 60.1 area 9.298 (14.1%) W1/2 0.1437 tailing 1.11 Rs 1.50 from #2
#4 RT 8.400 height 199.0 area 30.088 (45.7%) W1/2 0.1426 tailing 1.00
Valley-to-valley integration gives 11.803, 13.445, 8.646 and 29.514Tips for best results
- If the baseline climbs into the peak shoulders, raise lambda; if it cannot follow a drifting baseline, lower it. The chart shows it immediately.
- Set the minimum width to about a quarter of the narrowest real peak in points, so electrical spikes are rejected but a narrow peak is kept.
- For a trace already corrected by the instrument software, choose None as the baseline.
- Measure resolution with the half-height formula when a tangent width is flagged as unavailable; the two agree for symmetric peaks.
Common pitfalls
Smoothing flattens the sharp side of a peak and so understates tailing: a synthetic peak with a true tailing factor of 2.00, sampled every 0.005 min, reads 1.89 through an 11-point window. Use the narrowest window that keeps the noise down when tailing matters.
Lambda is measured in points, not in minutes: the same value is far more flexible on a trace sampled ten times faster, and the baseline then dips under the flanks of tall peaks. On a synthetic 2,251-point trace (0.002 min apart) with three peaks 80 to 100 units high, lambda 1e6 left up to 1.6 units of baseline error and 1e8 about 0.3. Raise lambda when a run has many points, and check the chart before trusting the peak count.
Plate count uses the retention time exactly as recorded; if the time axis does not start at injection, correct it first or the figure is wrong.
Unevenly spaced time stamps make the smoothing window cover different durations along the run; a warning appears when steps vary by more than 5%.
Area percent is each peak over the total of the listed peaks only, not over everything the detector saw.
Common errors and how to fix them
- Time must increase from row to row; it does not at data row 412.
- Two rows have the same time or go backwards, often from a second injection pasted below the first. Delete the extra block or choose the correct time column.
- The smoothing window must be 0, 1 or an odd number of points up to 2001.
- Enter an odd number such as 11. The polynomial order must also be smaller than the window.
- The baseline fit became unstable; try a smaller lambda.
- A very large lambda against a short run can leave the linear system without a usable pivot. Lower lambda by a factor of 100 and look at the chart.
Best practices
- Settle the baseline, smoothing window and signal-to-noise bar on a standard injection and keep them for the samples: areas from different runs are comparable only under the same settings, which the XLSX Settings sheet and the first lines of the PDF record.
- Read the Noise SD figure together with the peak height it demands. When that height is much larger than the noise, the baseline is not following the trace, and fixing the baseline is better than lowering the bar.
Drop line or valley baseline
Drop-line integration treats the corrected baseline as zero and draws a vertical line at the lowest point between two touching peaks. It is easy to reproduce, and it gives a small peak on the tail of a large one a share of the tail.
Valley-to-valley integration joins the start and end of each peak with a straight line and measures above it. In the example it lowers all four areas, from 12.153 to 11.803 for the first peak and from 14.254 to 13.445 for the second, because a sloping line under a peak cuts away part of its tail.
Frequently asked questions
Which smoothing window should I start with?
Use the odd number of points closest to a third of the peak width at half height. With a 0.01 minute step and a peak 0.1 minute wide, 3 to 5 points is enough; the default of 11 suits finer sampling.
Why is tailing blank for a peak?
Its width at 5% of the height does not fit inside the boundaries, usually because a neighbour keeps the trace above that level. Resolution and area are still reported.
Does it identify compounds or do calibration curves?
No. It reports peaks by retention time and area; matching them to standards and fitting a calibration is left to your own table.
Can I use a mass-spectrometer total ion chromatogram?
Yes, any time and intensity pair works. It treats the trace as one signal and does not read spectra.