Quaternion extraction for python

Hi! is there any code for python where I can get the quaternion from the IMU data? Im doing a tail sitter, so I need pretty radical angles, specially pitch, so I cannot use euler. I know there is the example for c++, but Im doing everything on python (not using ardupilot or anything of the sorts, just pure python), so I reallyyyy needed that…
Anyway, any help is appreciated, thanks

Tailsitter support was added some time ago. I suggest taking a look!
Answering your initial question, our own AHRS example uses quaternions’ implementation. But I suggest taking a look at more appropriate tools such as ROS for extracting data (/mavros/imu/data) from ArduPilot and then processing it according to your needs. ROS has tested classes for this use.

Thanks for the answer. Yeap I used the C++ code from the ahrs and converted it to python. I will post in here soon so it might help somebody in the future. I cant use ardupilot, because my frame is quite unique haha Is for a journal article, so I cant specify it right now, but none of the current modes on ardupilot covers it :frowning: