mosaik-csv


Namemosaik-csv JSON
Version 2.0.0 PyPI version JSON
download
home_pagehttps://gitlab.com/mosaik/components/data/mosaik-csv
SummaryPresents CSV datasets to mosaik as models.
upload_time2023-11-21 14:38:41
maintainer
docs_urlNone
authormosaik development team
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            In this repository we have two modules: mosaik_csv and mosaik_csv_writer.

Installation
============

::

    $ pip install mosaik-csv

If installation of psutil fails, installing python developer edition and gcc should help::

    $ sudo apt-get install gcc python3-dev

mosaik_csv
==========

This simulator reads CSV data and sends it to mosaik.

The following code shows an example how to use the mosaik_csv simulator.
The date_format, delimiter parameter and type are optional.
If they are not defined, the standard value is 'YYYY-MM-DD HH:mm:ss' for the date_format, ',' for delimiter and time-based for type.
The first line of the CSV file refers to the model name. If no model name is defined, 'Data' is set as the default::

    sim_config = {
        'CSV': {
            'python': 'mosaik_csv:CSV',
        }
    }
    world = mosaik.World(sim_config)
    csv_sim = world.start('CSV', sim_start='01.01.2016 00:00',
                                 datafile='data.csv',
                                 date_format='DD.MM.YYYY HH:mm',
                                 delimiter=',',type=time-based)
    csv = csv_sim.Data.create(20)


mosaik_csv_writer
=================

This simulator writes simulation results to a CSV file.


The following code shows an example how to use the mosaik_csv_writer simulator.
The date_format, delimiter parameter and print_results are optional.
If they are not defined, the standard value is 'YYYY-MM-DD HH:mm:ss' for the date_format, ',' for delimiter and False for print_results.

While creating the instance of the mosaik_csv_writer (csv_writer = csv_sim_writer.Monitor(buff_size = 30 * 60)) the user can define a
buff_size depending on the simulation time (default buff_size = 500). This buff_size tells the simulator to write the data into a CSV file after every defined buffer duration. This feature speeds up the writing process of the simulator. In the given example the simulator will write the accumulated data into a CSV file after every 30 minutes simulation time (30 * 60 simulation steps)::

    sim_config = {
        'CSV_writer': {
            'python': 'mosaik_csv_writer:CSVWriter',
        }
    }
    world = mosaik.World(sim_config)
    csv_sim_writer = world.start('CSV_writer', start_date = '01.01.2016 00:00',
                                               date_format='%Y-%m-%d %H:%M:%S', 
                                               output_file='results.csv',
                                               print_results=False)
    csv_writer = csv_sim_writer.Monitor(buff_size = 30 * 60)  # write data after every 30 mins

Tests
=====

You can run the tests with::

    $ git clone https://gitlab.com/mosaik/mosaik-csv.git
    $ cd mosaik-csv
    $ pip install -r requirements.txt
    $ pip install -e .
    $ pytest tests


Changelog
=========

2.0.0 - 2023-11-21
------------------

- [CHANGE] Use pandas for CSV reader.
- [NEW] Add CSV writer.


1.2.0 - 2021-05-21
------------------

- [CHANGE] Updated to mosaik-api 3.0.


1.1.0 - 2021-03-11
------------------

- [FEATURE] Allow to define the delimiter.
- [FEATURE] Allow to define the date format.


1.0.4 - 2021-03-04
------------------

- [CHANGE] Adjustment to new arrow API.


1.0.3 – 2019-10-10
------------------

- [CHANGE] Added closing of input file.
- [CHANGE] Adjustment to new arrow API.


1.0.2 – 2014-09-22
------------------

- [CHANGE] Updated to mosaik-api 2.0.


1.0.1 – 2014-06-23
------------------

- [CHANGE] Updated to mosaik-api 2.0a3.


1.0 – 2014-03-26
----------------

- Initial release


Authors
=======

The original concepts for mosaik CSV reader were developed by Stefan Scherfke.

The author of mosaik CSV writer is Mohammad Arhum.

Additional contributors: Robin Huwa, Pranay Kasturi, Annika Ofenloch, Thomas Raub, Jan Sören Schwarz, Deborah Tolk



            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/mosaik/components/data/mosaik-csv",
    "name": "mosaik-csv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "mosaik development team",
    "author_email": "mosaik@offis.de",
    "download_url": "https://files.pythonhosted.org/packages/d8/60/ed34d532f634f207cfa100cfc828484e7f91c9a28f228164d0610db9150a/mosaik-csv-2.0.0.tar.gz",
    "platform": null,
    "description": "In this repository we have two modules: mosaik_csv and mosaik_csv_writer.\n\nInstallation\n============\n\n::\n\n    $ pip install mosaik-csv\n\nIf installation of psutil fails, installing python developer edition and gcc should help::\n\n    $ sudo apt-get install gcc python3-dev\n\nmosaik_csv\n==========\n\nThis simulator reads CSV data and sends it to mosaik.\n\nThe following code shows an example how to use the mosaik_csv simulator.\nThe date_format, delimiter parameter and type are optional.\nIf they are not defined, the standard value is 'YYYY-MM-DD HH:mm:ss' for the date_format, ',' for delimiter and time-based for type.\nThe first line of the CSV file refers to the model name. If no model name is defined, 'Data' is set as the default::\n\n    sim_config = {\n        'CSV': {\n            'python': 'mosaik_csv:CSV',\n        }\n    }\n    world = mosaik.World(sim_config)\n    csv_sim = world.start('CSV', sim_start='01.01.2016 00:00',\n                                 datafile='data.csv',\n                                 date_format='DD.MM.YYYY HH:mm',\n                                 delimiter=',',type=time-based)\n    csv = csv_sim.Data.create(20)\n\n\nmosaik_csv_writer\n=================\n\nThis simulator writes simulation results to a CSV file.\n\n\nThe following code shows an example how to use the mosaik_csv_writer simulator.\nThe date_format, delimiter parameter and print_results are optional.\nIf they are not defined, the standard value is 'YYYY-MM-DD HH:mm:ss' for the date_format, ',' for delimiter and False for print_results.\n\nWhile creating the instance of the mosaik_csv_writer (csv_writer = csv_sim_writer.Monitor(buff_size = 30 * 60)) the user can define a\nbuff_size depending on the simulation time (default buff_size = 500). This buff_size tells the simulator to write the data into a CSV file after every defined buffer duration. This feature speeds up the writing process of the simulator. In the given example the simulator will write the accumulated data into a CSV file after every 30 minutes simulation time (30 * 60 simulation steps)::\n\n    sim_config = {\n        'CSV_writer': {\n            'python': 'mosaik_csv_writer:CSVWriter',\n        }\n    }\n    world = mosaik.World(sim_config)\n    csv_sim_writer = world.start('CSV_writer', start_date = '01.01.2016 00:00',\n                                               date_format='%Y-%m-%d %H:%M:%S', \n                                               output_file='results.csv',\n                                               print_results=False)\n    csv_writer = csv_sim_writer.Monitor(buff_size = 30 * 60)  # write data after every 30 mins\n\nTests\n=====\n\nYou can run the tests with::\n\n    $ git clone https://gitlab.com/mosaik/mosaik-csv.git\n    $ cd mosaik-csv\n    $ pip install -r requirements.txt\n    $ pip install -e .\n    $ pytest tests\n\n\nChangelog\n=========\n\n2.0.0 - 2023-11-21\n------------------\n\n- [CHANGE] Use pandas for CSV reader.\n- [NEW] Add CSV writer.\n\n\n1.2.0 - 2021-05-21\n------------------\n\n- [CHANGE] Updated to mosaik-api 3.0.\n\n\n1.1.0 - 2021-03-11\n------------------\n\n- [FEATURE] Allow to define the delimiter.\n- [FEATURE] Allow to define the date format.\n\n\n1.0.4 - 2021-03-04\n------------------\n\n- [CHANGE] Adjustment to new arrow API.\n\n\n1.0.3 \u2013 2019-10-10\n------------------\n\n- [CHANGE] Added closing of input file.\n- [CHANGE] Adjustment to new arrow API.\n\n\n1.0.2 \u2013 2014-09-22\n------------------\n\n- [CHANGE] Updated to mosaik-api 2.0.\n\n\n1.0.1 \u2013 2014-06-23\n------------------\n\n- [CHANGE] Updated to mosaik-api 2.0a3.\n\n\n1.0 \u2013 2014-03-26\n----------------\n\n- Initial release\n\n\nAuthors\n=======\n\nThe original concepts for mosaik CSV reader were developed by Stefan Scherfke.\n\nThe author of mosaik CSV writer is Mohammad Arhum.\n\nAdditional contributors: Robin Huwa, Pranay Kasturi, Annika Ofenloch, Thomas Raub, Jan S\u00f6ren Schwarz, Deborah Tolk\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Presents CSV datasets to mosaik as models.",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/mosaik/components/data/mosaik-csv"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa8c93074a658aa544271b4d95db30275bc1c97c313805078fc3b53bf3f5d150",
                "md5": "eceb0e5c50eda4bd167a80c147983f45",
                "sha256": "a0330b8018cf0fc39b3849e55982f75150a3e7b516c23e081067fdca9b933e1c"
            },
            "downloads": -1,
            "filename": "mosaik_csv-2.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eceb0e5c50eda4bd167a80c147983f45",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 15093,
            "upload_time": "2023-11-21T14:38:39",
            "upload_time_iso_8601": "2023-11-21T14:38:39.765199Z",
            "url": "https://files.pythonhosted.org/packages/fa/8c/93074a658aa544271b4d95db30275bc1c97c313805078fc3b53bf3f5d150/mosaik_csv-2.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d860ed34d532f634f207cfa100cfc828484e7f91c9a28f228164d0610db9150a",
                "md5": "2c8a14a592e9ffa7197bac5864657c2e",
                "sha256": "5984e22f1dd53d8f37b9daf063fa058e7221b9083f264c1ada9374a20dd0ddf2"
            },
            "downloads": -1,
            "filename": "mosaik-csv-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2c8a14a592e9ffa7197bac5864657c2e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15065,
            "upload_time": "2023-11-21T14:38:41",
            "upload_time_iso_8601": "2023-11-21T14:38:41.486465Z",
            "url": "https://files.pythonhosted.org/packages/d8/60/ed34d532f634f207cfa100cfc828484e7f91c9a28f228164d0610db9150a/mosaik-csv-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-21 14:38:41",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "mosaik",
    "gitlab_project": "components",
    "lcname": "mosaik-csv"
}
        
Elapsed time: 0.14340s