It would be nice to decouple the camera rotation issue from the stage position accuracy, so we don't need to increase -m just to account for the camera angle. I think the max_shift filter doesn't even catch very many spurious alignments anyway, so perhaps we could fit the LinearRegression before filtering on max_shift and use that affine transform as a preliminary estimate of the camera rotation and other large-scale systematic alignment errors (e.g. inaccuracies in the calibration of pixel size and stage position actuator scaling). We could then "subtract out" the result of that affine transform from the pairwise shifts, leaving just the random local stage position error. Only then would we apply the max_shift filtering.