So this error was in the code that actually ran the experiment, not the analysis. The experiment was effectively doomed from the beginning. The mistake amounts to failing to calibrate and test your experimental apparatus, which is a little hard to forgive, since it would have taken hardly any time or effort. Perhaps I’m being harsh but scientific enquiry is too important to be satisfied with conducting unrigorous experiments then apologising, which of course one could do ad infinitum.