I'm developing mass spectrometry (specifically, RGA-QMS or residual gas analysis mass spectrometry with a quadrupole) data reduction software and have encountered an issue with handling negative data.
My primary goal here is to calculate errors on the intensity measurements $y$ reported by the mass spec in amperes. I assume these errors follow a Poisson distribution based on the number of electrons $N$ counted over the dwell time $t$:
$$N = \frac{yt}{q}$$
where $q$ is the charge of an electron.
The error on the intensity $\sigma_y$ is therefore
$$\sigma_y = \sqrt{\frac{yq}{t}}$$
Calculating errors on these intensities should improve the robustness of curve fitting.
However, on occasion the MS reports negative intensities due to the amplifier offset, subtracted from signals to account for thermal noise, voltage drifts, etc. This is different for each system. When the current from the few counted ions is smaller than the amplifier offset, the datum can become a very small negative number (e.g. $-1e^{-15}$ where low signals are ~$1e^{-15}$ to $1e^{-12}$ and high signals go up to $1e^{-8}$).
Negative numbers are obviously incompatible with the Poisson distribution as you cannot count a negative number of a thing. While the ideal solution here is obviously to fix the amplifier offset to never produce negative values, my software will encounter negative intensities regardless due to, e.g., preexisting data with negatives or the user applying the wrong baseline correction.
Correcting for the amplifier offset is the obvious solution, however, because the offset varies between systems and sequences and isn't reported as far as I know, I can't rely on this.
I see two (relatively unsatisfying) ways forward:
- Assign negative data a 100% relative error.
- Find the most negative intensity in the sequence, add its value to all other intensities, and set that intensity equal to machine epsilon.
I made a similar suggestion to #2 in the past to a couple testers who rejected the idea (and I agree). I therefore am restricted from boosting all other intensities by some number to force them to be non-negative. This leaves me with a need to estimate the errors on negative intensities. My best idea is #1, but this feels arbitrary.
What are some different ways of dealing with this that might be more robust or mathematically sound which don't directly involve the amplifier offset?