-2

I'm implementing Kalman Filter on two types of measurements. I have GPS measurement every second (1Hz) and 100 measurment of accelration in one second (100Hz). So basically I have two huge tables and they have to be fused at some point. My aim is: I really want to write readable and maintainable code.

My first approach was: there is a class for both of the datatables (so an object is a datatable), and I do bulk calculations in the class methods (so almost all of my methods include a for loop), until I get to the actual filter. I found this approach a bit too stiff. It works, but there is so much data-type transformation, and it is just not that convenient.

Now I want to change my code. If I would want to stick to OOP, my second try would be: every single measurment is an object of either the GPS_measurment or the acceleration_measurement. This approach seems better, but this way thousands of objects would have been created.

My third try would be a data-driven design, but I'm not really familiar with this approach.

Which paradigm should I use? Or perhaps it should be solved by some kind of mixture of the above paradigms? Or should I just use procedural programming with the use of pandas dataframes?

hotigeftas
  • 151
  • 1
  • 3
  • 9
  • `numpy` arrays contain objects (such as your custom class) lose most of the fast computational advantages of `numpy`. The fast numeric code is compiled to use floats and integers. And since `pandas` use arrays, that same goes for that. `pandas` readily switches Series to object dtype if they contain strings or objects like `None`. – hpaulj Dec 24 '18 at 21:34

1 Answers1

0

It sounds like you would want to use pandas. OOP is a concept btw, not something you explicitly code in inflexibly. Generally speaking, you only want to define your own classes if you plan on extending them or encapsulating certain features. pandas and numpy are 2 modules that already do almost everything you can ask for with regards to data and they are faster in execution.

ycx
  • 3,155
  • 3
  • 14
  • 26