I installed the RTIMULibCal tool which is pretty cool.
pi@RPi3B:~/rpicalc/RTEllipsoidFit $ RTIMULibCal
RTIMULibCal - using RTIMULib.ini
Settings file RTIMULib.ini loaded
Using fusion algorithm RTQF
Using min/max compass calibration
Ellipsoid compass calibration not in use
Accel calibration not in use
LSM9DS1 init complete
Options are:
m - calibrate magnetometer with min/max
e - calibrate magnetometer with ellipsoid (do min/max first)
a - calibrate accelerometers
x - exit
Enter option: m
Magnetometer min/max calibration
--------------------------------
Waggle the IMU chip around, ensuring that all six axes
(+x, -x, +y, -y and +z, -z) go through their extrema.
When all extrema have been achieved, enter 's' to save, 'r' to reset
or 'x' to abort and discard the data.
Press any key to start...
Min x: 1000.00 min y: 1000.00 min z: 1000.00
Max x: -1000.00 max y: -1000.00 max z: -1000.00