I translated APM's accelerometer scaling code to python:
https://github.com/jschall/magfit_scalingIt doesn't yet throw away outliers like tridge's magfit, but it may be better if it did. It produces much better results than magfit - see mag_field.png.
Even if we don't find scaling to be useful (I think we might as well do it), it still produces much better offsets because it doesn't make the assumption that there is no soft-iron error.
If we could introduce this in MP and APM Planner, that would be great. It still needs sanity checks and it should probably throw away the worst outliers and then run itself again several times like Tridge's magfit does.