emon-tools
is a Python library that provides a streamlined API interface for seamless interactions with EmonCMS, along with tools designed to analyze and visualize PhpFina files.
Explore the project Wiki for detailed documentation and guides: emon_tools Wiki.
The emon-tools
package offers flexible installation options tailored to various use cases. Depending on your requirements, you can choose to install the complete package or specific subsets of dependencies.
-
Environment Management: Always use a virtual environment (e.g.,
venv
orconda
) to isolate your dependencies and prevent conflicts with other projects. -
Upgrading Dependencies: Keep your dependencies up to date by running
pip install --upgrade emon-tools
periodically. -
Check Requirements: Review the module's requirements in the
setup.cfg
file or on the PyPI page to ensure compatibility with your system.
To install the entire emon-tools package along with all dependencies, run the following command:
pip install emon-tools["all"]
Included Dependencies:
- aiohttp
- numpy
- pandas
- matplotlib
Tip: This is the best option if you plan to use all features, including data manipulation and visualization.
You can install specific modules and their dependencies as needed. For example:
- To enable
emon_fina
module:
pip install emon-tools["fina"]
- To enable pandas time-series output functionality:
pip install emon-tools["fina, time_series"]
- To include graph plotting capabilities:
pip install emon-tools["fina, plot"]
- To enable
emon_api
module:
pip install emon-tools["api"]
- To enable
emon_fina
andemon_api
modules:
pip install emon-tools["api, fina"]
emon_tools
is modular, allowing you to install and use individual components as needed.
The emon_fina
module facilitates the analysis and processing of time-series data, particularly from PhpFina file formats.
- Data Reading: Efficiently read data from PhpFina file formats.
- Time-Series Analysis: Compute daily statistics such as min, max, mean, and more.
- Filtering: Validate and filter data based on custom thresholds.
- Utilities: Timestamp manipulation and interval computation tools.
from emon_tools.fina_time_series import FinaDataFrame
from emon_tools.fina_plot import PlotData
fdf = FinaDataFrame(
feed_id=1,
data_dir="/path/to/phpfina/files"
)
# Access metadata of the .meta file:
print("Meta: ", fdf.meta)
# get height days of data points from meta start_time
ts = fdf.get_fina_df_time_series(
start=fdf.meta.start_time,
step=10,
window=8 * 24 * 3600
)
PlotData.plot(data=ts)
The emon_api
module is Emoncms python api interface, used to easy interract with an EmonCMS instance via its JSON API.
- Streamlined Interface: A user-friendly Python API for EmonCMS.
- RESTful Communication: Perform seamless data exchanges with EmonCMS through JSON APIs.
- Data Management: Retrieve and manage feeds, inputs, and other EmonCMS structures with ease.
from emon_tools.emon_api import EmonFeedsApi
cli = EmonApi(
url="http://127.0.0.1:8080",
api_key="MyAPIKey123"
)
# Get current inputs and feeds on Emoncms server
inputs = cli.list_inputs()
print("Inputs: ", inputs)
feeds = cli.list_feeds()
print("Feeds: ", feeds)
- Wiki: See
emon_api
module wiki section. - Examples: Explore api_bulk_structure for input and feed supervision, as well as posting bulk dummy data.
To ensure everything is functioning correctly, run the test suite:
pytest -v
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch.
- Submit a pull request with a clear description.
This project is licensed under the MIT License. See LICENSE for more details.