roadtraffic


Nameroadtraffic JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/iarokr/roadtraffic
SummaryA package for road traffic data analysis
upload_time2023-12-04 15:10:16
maintainer
docs_urlNone
authorIaroslav Kriuchkov
requires_python>=3.8, <4
licenseGNU General Public License v3 (GPLv3)
keywords road traffic data analysis convex regression quantile regression
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # roadtraffic

![PyPI](https://img.shields.io/pypi/v/roadtraffic)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roadtraffic)
![Build](https://img.shields.io/github/actions/workflow/status/iarokr/roadtraffic/publish-roadtraffic.yml)



## Overview

The [roadtraffic](https://pypi.org/project/roadtraffic/) Python package for traffic data processing and fundamental diagram estimation. A fundamental diagram is estimated using convex regression with the help of the [pyStoNED](https://github.com/ds2010/pyStoNED) package. The [mosek](https://www.mosek.com/) solver is used for the estimation. For the academic purposes, you can obtain a [free academic license](https://www.mosek.com/products/academic-licenses/) for the solver. You can also use the free NEOS server for the estimation, but the computational time will be longer.

Currently only data from Finnish roads, collected through this package is supported. The source of data is [Fintraffic / digitraffic.fi](https://www.digitraffic.fi/en/), license CC 4.0 BY.

The package works on the raw data. The data can be aggregated over time and road direction/lane. The aggregated data is then bagged for computational efficiency. The estimation of the fundamental diagram is done on the bagged data. The availability of raw data depends on the traffic measurement station. The earliest data are from 1995. New data are available every day at 3 am (Helsinki time zone). The developers of the package are not affiliated with Fintraffic and can't influence the availability or quality of the data.

## Installation
The installation of the package is avalable through the PyPI:
```shell
    pip install roadtraffic
```

## Basic usage
The package offers an opportunity to work with Finnish traffic data. You can select a traffic measurement station (TMS or LAM, in Finnish) from the official [metadata](https://tie.digitraffic.fi/api/tms/v1/stations) using *tmsNumber* field or the [map](https://liikennetilanne.fintraffic.fi/kartta/?lang=fi&x=3010000&y=9720000&z=5&checkedLayers=1,10&basemap=streets-vector) taking the integer part or *lamid* field. 

Let's take as an example the traffic management station number 162, located on Kehä II in Espoo, Finland and load, process the data and estimate the model for September 10-11, 2019.
```python
# Import dependencies
from roadtraffic import fintraffic 

# Traffic measurement station of interest
tms_id = 162

# Initiate the list of days (tuples) of interest (Sep 10-11, 2019)
days_list = [
    (2019, 253),
    (2019, 254),
]

# Specify the road direction
# Information about the direction could be obtained from the metadata or the map
direction = 1

# Initiate the class for Fintraffic data
tms = fintraffic.TrafficMeasurementStation(tms_id, days_list)

# Load raw data for the selected period
tms.raw.load()

# Clean data for the direction
tms.raw.clean(direction=direction)

# Aggregate data
tms.raw_to_agg(aggregation_time_period='5', aggregation_time_period_unit='min')

# Bag data
tms.agg_to_bag(num_bags_density=40, num_bags_flow=200)

# Estimate the model for the median
tms.bag.estimate_model("quantile", [0.5], email="test@test.test") # you can specify your email to receive the log file

# Obtain the results
tms.bag.models.get_estimate(0.5)

# Estimate the model for the mean
tms.bag.estimate_model("mean", email="test@test.test")

# Obtain the results
tms.bag.models.get_estimate("mean")

```



## Authors
- [Iaroslav Kriuchkov](https://www.researchgate.net/profile/Iaroslav-Kriuchkov-3), Doctoral Researcher at Aalto University School of Business, Finland
- [Timo Kuosmanen](https://www.researchgate.net/profile/Timo-Kuosmanen), Professor at Turku University School of Economics, Finland

## License

roadtraffic is licensed under the GNU GPLv3 License - see the [LICENSE](LICENSE) file for details



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iarokr/roadtraffic",
    "name": "roadtraffic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8, <4",
    "maintainer_email": "Iaroslav Kriuchkov <iaroslav.kriuchkov@aalto.fi>",
    "keywords": "road traffic,data analysis,convex regression,quantile regression",
    "author": "Iaroslav Kriuchkov",
    "author_email": "\"Iaroslav Kriuchkov, Timo Kuosmanen\" <iaroslav.kriuchkov@aalto.fi>",
    "download_url": "https://files.pythonhosted.org/packages/50/eb/e21eb73449f1c90db0dd56e46c49c50e989c48110c2e4fc416554f731581/roadtraffic-1.0.0.tar.gz",
    "platform": null,
    "description": "# roadtraffic\n\n![PyPI](https://img.shields.io/pypi/v/roadtraffic)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/roadtraffic)\n![Build](https://img.shields.io/github/actions/workflow/status/iarokr/roadtraffic/publish-roadtraffic.yml)\n\n\n\n## Overview\n\nThe [roadtraffic](https://pypi.org/project/roadtraffic/) Python package for traffic data processing and fundamental diagram estimation. A fundamental diagram is estimated using convex regression with the help of the [pyStoNED](https://github.com/ds2010/pyStoNED) package. The [mosek](https://www.mosek.com/) solver is used for the estimation. For the academic purposes, you can obtain a [free academic license](https://www.mosek.com/products/academic-licenses/) for the solver. You can also use the free NEOS server for the estimation, but the computational time will be longer.\n\nCurrently only data from Finnish roads, collected through this package is supported. The source of data is [Fintraffic / digitraffic.fi](https://www.digitraffic.fi/en/), license CC 4.0 BY.\n\nThe package works on the raw data. The data can be aggregated over time and road direction/lane. The aggregated data is then bagged for computational efficiency. The estimation of the fundamental diagram is done on the bagged data. The availability of raw data depends on the traffic measurement station. The earliest data are from 1995. New data are available every day at 3 am (Helsinki time zone). The developers of the package are not affiliated with Fintraffic and can't influence the availability or quality of the data.\n\n## Installation\nThe installation of the package is avalable through the PyPI:\n```shell\n    pip install roadtraffic\n```\n\n## Basic usage\nThe package offers an opportunity to work with Finnish traffic data. You can select a traffic measurement station (TMS or LAM, in Finnish) from the official [metadata](https://tie.digitraffic.fi/api/tms/v1/stations) using *tmsNumber* field or the [map](https://liikennetilanne.fintraffic.fi/kartta/?lang=fi&x=3010000&y=9720000&z=5&checkedLayers=1,10&basemap=streets-vector) taking the integer part or *lamid* field. \n\nLet's take as an example the traffic management station number 162, located on Keh\u00e4 II in Espoo, Finland and load, process the data and estimate the model for September 10-11, 2019.\n```python\n# Import dependencies\nfrom roadtraffic import fintraffic \n\n# Traffic measurement station of interest\ntms_id = 162\n\n# Initiate the list of days (tuples) of interest (Sep 10-11, 2019)\ndays_list = [\n    (2019, 253),\n    (2019, 254),\n]\n\n# Specify the road direction\n# Information about the direction could be obtained from the metadata or the map\ndirection = 1\n\n# Initiate the class for Fintraffic data\ntms = fintraffic.TrafficMeasurementStation(tms_id, days_list)\n\n# Load raw data for the selected period\ntms.raw.load()\n\n# Clean data for the direction\ntms.raw.clean(direction=direction)\n\n# Aggregate data\ntms.raw_to_agg(aggregation_time_period='5', aggregation_time_period_unit='min')\n\n# Bag data\ntms.agg_to_bag(num_bags_density=40, num_bags_flow=200)\n\n# Estimate the model for the median\ntms.bag.estimate_model(\"quantile\", [0.5], email=\"test@test.test\") # you can specify your email to receive the log file\n\n# Obtain the results\ntms.bag.models.get_estimate(0.5)\n\n# Estimate the model for the mean\ntms.bag.estimate_model(\"mean\", email=\"test@test.test\")\n\n# Obtain the results\ntms.bag.models.get_estimate(\"mean\")\n\n```\n\n\n\n## Authors\n- [Iaroslav Kriuchkov](https://www.researchgate.net/profile/Iaroslav-Kriuchkov-3), Doctoral Researcher at Aalto University School of Business, Finland\n- [Timo Kuosmanen](https://www.researchgate.net/profile/Timo-Kuosmanen), Professor at Turku University School of Economics, Finland\n\n## License\n\nroadtraffic is licensed under the GNU GPLv3 License - see the [LICENSE](LICENSE) file for details\n\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 (GPLv3)",
    "summary": "A package for road traffic data analysis",
    "version": "1.0.0",
    "project_urls": {
        "Download": "https://pypi.org/project/roadtraffic/",
        "Homepage": "https://github.com/iarokr/roadtraffic",
        "changelog": "https://github.com/iarokr/roadtraffic/blob/main/CHANGELOG.md",
        "repository": "https://github.com/iarokr/roadtraffic"
    },
    "split_keywords": [
        "road traffic",
        "data analysis",
        "convex regression",
        "quantile regression"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6bbae041c776c7248d08c9e76c2d227b8f520b47044814cf8ec6c2f21d5298f",
                "md5": "be67af6787e8f14c423486975655e266",
                "sha256": "fde2c3e2c2243cd116a32c3c387a2ec8aa9b560e97eb8f93a231ab8ed8ad67d3"
            },
            "downloads": -1,
            "filename": "roadtraffic-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "be67af6787e8f14c423486975655e266",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8, <4",
            "size": 32311,
            "upload_time": "2023-12-04T15:10:14",
            "upload_time_iso_8601": "2023-12-04T15:10:14.033107Z",
            "url": "https://files.pythonhosted.org/packages/e6/bb/ae041c776c7248d08c9e76c2d227b8f520b47044814cf8ec6c2f21d5298f/roadtraffic-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "50ebe21eb73449f1c90db0dd56e46c49c50e989c48110c2e4fc416554f731581",
                "md5": "e0e74f584e1f82161e452faf6242f4d6",
                "sha256": "50932b0aea34c7157a468330351a229de84b574d2a85e849dc24e1812bfaccf7"
            },
            "downloads": -1,
            "filename": "roadtraffic-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e0e74f584e1f82161e452faf6242f4d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8, <4",
            "size": 31291,
            "upload_time": "2023-12-04T15:10:16",
            "upload_time_iso_8601": "2023-12-04T15:10:16.032896Z",
            "url": "https://files.pythonhosted.org/packages/50/eb/e21eb73449f1c90db0dd56e46c49c50e989c48110c2e4fc416554f731581/roadtraffic-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-04 15:10:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "iarokr",
    "github_project": "roadtraffic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "roadtraffic"
}
        
Elapsed time: 0.31224s