Skip to main content

A numpy subclass to read emoncms PHPFINA feeds as numpy array

Project description


PyFina is a subclass of numpy np.ndarray to import emoncms PHPFINA feeds as numpy arrays

The pip installer will install any missing requirements (numpy, matplotlib)

PyFina brings the power of numpy to the PHPFINA timeseries, including basic operations and more : addition, soustraction, multiplication, division, min, max, mean, sum, slicing with the bracket operator

Note : any operation on a PyFina object results to a standard numpy nd.array object. The signature of the PyFina object is lost.

It does not prevent to add two PyFina objects of the same size but sampled with different intervals


python3 -m pip install PyFina

or, for python on Windows

py -m pip install PyFina

Post installation testing

copy the content of, paste it in a blank file on your local machine and save it using the same name.


Getting Started

To retrieve metadatas for feed number 1 :

from PyFina import getMeta, PyFina
import matplotlib.pylab as plt
# classic emoncms feed storage on linux
dir = "/var/opt/emoncms/phpfina"
meta = getMeta(1,dir)

To import the first 8 days of datas, with a sampling interval of 3600 s :

step = 3600
start = meta["start_time"]
window = 8*24*3600
length = meta["npoints"] * meta["interval"]
if window > length:
    window = length
nbpts = window // step
Text = PyFina(1,dir,start,step,nbpts)

To catch the signature of the created PyFina object :

# time start as a unixtimestamp expressed in seconds
# step/interval in seconds

To plot:

import datetime
import time
localstart = datetime.datetime.fromtimestamp(start)
utcstart = datetime.datetime.utcfromtimestamp(start)
title = "starting on :\nUTC {}\n{} {}".format(utcstart,time.tzname[0],localstart)
plt.ylabel("outdoor Temp °C")
plt.xlabel("time in hours")

With the above code, the xrange will be expressed in hour, so 192 points will be displayed

To express the xrange in seconds :

xrange = Text.timescale()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyFina-0.0.2.tar.gz (3.7 kB view hashes)

Uploaded source

Built Distribution

PyFina-0.0.2-py3-none-any.whl (4.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page