Quaternion and 3D orientation offline

Hello,
I am using a compatible Arduino microcontroller (RedBear Duo) to get 9dof data from the latest adafruit 9dof. I would like to be able to get quaternions and 3d orientation offline. The setting of my project is as follow: I collected 9dof data for 1 month, there is also 1hertz GPS from the entire sensor deployment. I have calibrated all the axis of the 9dof.

At the moment I have a file with all the data inside, following there is a sample of it:

TIME,ACC_X,ACC_Y,ACC_Z,GYRO_X,GYRO_Y,GYRO_Z,MAG_X,MAG_Y,MAG_Z
2313992204,-1.694118,-2.053042,-8.886943,0.006272,-0.004091,0.000682,-48.200001,-68.400002,13.000000
2313992204,-1.674976,-2.029114,-8.886943,0.006545,-0.003682,0.000682,-48.500000,-67.599998,11.300000
2313992204,-1.674976,-2.033899,-8.882157,0.006136,-0.004091,0.000273,-47.799999,-67.500000,12.300000
2313992204,-1.703690,-2.033899,-8.882157,0.006818,-0.003682,0.000409,-47.700001,-68.099998,11.800000
2313992204,-1.694118,-2.053042,-8.877372,0.006409,-0.004500,0.000682,-47.900002,-67.400002,11.200000

I would like to use python to get the positional vectors and an animation of the body in which the sensor was. I have looked a lot on the web but I can only found online approaches in which the animation and the quaternions are builded live. I need to do this offline.

Do anyone know or have a reference to some algorithm I can use to do that?

Thank you.

RTImulib is open source and has modules to read a variety of sensors. It should not be difficult to write a new module that would take your data file as a sensor input stream.

It may have already been written, but if not and you write one, please post the code as I'm sure other people would be interested.

There are various forks of RTImulib for different processors and operating systems, including Windows and Arduino, so look around a bit. In fact, RTImulib2 offers a desktop version that gets its data from an Arduino operating the sensor. That may do just what you want.