In a project I have to store a sequence of successive rotations of an object in python. I intend to store them using scipy.spatial.transform.Rotation objects.
I have noticed that two options are available.
I store a multitude of Rotation object in an array, each Rotation object containing a single rotation of my sequence.
I store every rotation in the same Rotation object, effectively stacking them in a single object.
I wondered what were the trade offs between the methods in terms of computational speed and data access speed. And ultimately which method should be preferred.
In my particular case:
- I have a fairly big set of rotations (around 2'000'000).
- I would like to speed up the accessing time for my data as much as possible.
- I am not concerned with memory usage so I am willing to trade space for speed.
- I don't intend to apply my rotations to anything. This is purely for storage use.
- I will have to access my rotations both as quaternions (.as_quat()) and as euler angles (.as_euler())
- I will have to split my data into smaller chunk at some point (And I am aware that if I use a single Rotation object I might have to re-create on per chunk in order to split my data correctly)
What I am looking for:
- The method that has the fastest access time
- The method that is closer to good practice and coding convention in python
Thanks in advance.