Probably start here for Magfit. There’s an example and link to the documentation.
To make use of it do an ordinary flight with plenty of yaw and circles, plus some ascent and descent.
If you need I can run it for you and check other things too, but best to research and learn your self.