Open alexandrecuer opened 3 years ago
Hello @alexandrecuer yes happy with this, nice to see, I did experiment with porting the timeseries engines to python a while back but that project didn’t end up going anywhere. Anyway, happy for there to be post processes written in python :+1:
@TrystanLea : would you be happy to also introduce python processes in postprocess ? right now, only php processes are supported, that's enough for many things, but with python processes, we could take advantages of the numpy library, which is very powerfull :-)
I think it could be quite simple to support python processes that but I wanted your opinion...
I recently investigate how to subclass the numpy ndarray object cf https://numpy.org/devdocs/user/basics.subclassing.html
Here is a first proof of concept of a basic pyFina object deriving from the numpy ndarray object. No averaging in that class, but we could introduce some quite easily IMO
PyFina object creation in python is very easy. Here is an example with a feed number 66 starting on timestamp 1577404800, fetching the original recording and sampling a point each half an hour, for a duration of 200 hours :
the below graph created with matplotlib is just for the example. On the Rpi of course, this would not be possible to do this
all calculations could be made using numpy, The addition of two feeds feed1 and feed2, assuming sampling them with an equal step and from the same start, could be simply :
Finally, the creation of a Fina feed could be possible with some simple methods like the following ones (plus the SQL command to inject the feed in the mariadb feed table)
of course you need numpy to be installed