syncing


Namesyncing JSON
Version 1.0.9 PyPI version JSON
download
home_pagehttps://github.com/vinci1it2000/syncing
SummaryTime series synchronisation and resample library.
upload_time2023-11-15 11:30:37
maintainer
docs_urlNone
authorVincenzo Arcidiacono
requires_python
licenseEUPL 1.1+
keywords python utility library synchronise data scientific engineering resample time series
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. _start-intro:


What is syncing?
****************

**syncing** is an useful library to synchronise and re-sample time
series.

**synchronisation** is based on the **fourier transform** and the
**re-sampling** is performed with a specific interpolation method.


Installation
************

To install it use (with root privileges):

.. code:: console

   $ pip install syncing

Or download the last git version and use (with root privileges):

.. code:: console

   $ python setup.py install


Install extras
==============

Some additional functionality is enabled installing the following
extras:

*  cli: enables the command line interface.

*  plot: enables to plot the model process and its workflow.

*  dev: installs all libraries plus the development libraries.

To install syncing and all extras (except development libraries), do:

.. code:: console

   $ pip install syncing[all]

.. _end-quick:


Synchronising Laboratory Data
*****************************

This example shows how to synchronise two data-sets *obd* and *dyno*
(respectively they are the On-Board Diagnostics of a vehicle and
Chassis dynamometer) with a reference signal *ref*. To achieve this we
use the model syncing model to visualize the model:

>>> from syncing.model import dsp
>>> model = dsp.register()
>>> model.plot(view=False)
SiteMap(...)

[graph]

Tip: You can explore the diagram by clicking on it.

First of all, we generate synthetically the data-sets to feed the
model:

>>> import numpy as np
>>> data_sets = {}
>>> time = np.arange(0, 150, .1)
>>> velocity = (1 + np.sin(time / 10)) * 60
>>> data_sets['ref'] = dict(
...     time=time,                                               # [10 Hz]
...     velocity=velocity / 3.6                                  # [m/s]
... )
>>> data_sets['obd'] = dict(
...     time=time[::10] + 12,                                    # 1 Hz
...     velocity=velocity[::10] + np.random.normal(0, 5, 150),   # [km/h]
...     engine_rpm=np.maximum(
...         np.random.normal(velocity[::10] * 3 + 600, 5), 800
...     )                                                        # [RPM]
... )
>>> data_sets['dyno'] = dict(
...     time=time + 6.66,                                        # 10 Hz
...     velocity=velocity + np.random.normal(0, 1, 1500)         # [km/h]
... )

To synchronise the data-sets and plot the workflow:

>>> from syncing.model import dsp
>>> sol = dsp(dict(
...     data=data_sets, x_label='time', y_label='velocity',
...     reference_name='ref', interpolation_method='cubic'
... ))
>>> sol.plot(view=False)
SiteMap(...)

[graph]

Finally, we can analyze the time shifts and the synchronised and
re-sampled data-sets:

>>> import pandas as pd
>>> import schedula as sh
>>> pd.DataFrame(sol['shifts'], index=[0])  
     obd  dyno
...
>>> df = pd.DataFrame(dict(sh.stack_nested_keys(sol['resampled'])))
>>> df.columns = df.columns.map('/'.join)
>>> df['ref/velocity'] *= 3.6
>>> ax = df.set_index('ref/time').plot(secondary_y='obd/engine_rpm')
>>> ax.set_ylabel('[km/h]'); ax.right_ax.set_ylabel('[RPM]')
Text(...)

   .. image:: setup-58plrwu3/pypi-1.*

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vinci1it2000/syncing",
    "name": "syncing",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,utility,library,synchronise,data,scientific,engineering,resample,time series",
    "author": "Vincenzo Arcidiacono",
    "author_email": "vinci1it2000@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a4/58/5ddfa89e305e98829f00fd487f64a4772d88b8ff1f19378061a3aa57f9bb/syncing-1.0.9.tar.gz",
    "platform": null,
    "description": ".. _start-intro:\n\n\nWhat is syncing?\n****************\n\n**syncing** is an useful library to synchronise and re-sample time\nseries.\n\n**synchronisation** is based on the **fourier transform** and the\n**re-sampling** is performed with a specific interpolation method.\n\n\nInstallation\n************\n\nTo install it use (with root privileges):\n\n.. code:: console\n\n   $ pip install syncing\n\nOr download the last git version and use (with root privileges):\n\n.. code:: console\n\n   $ python setup.py install\n\n\nInstall extras\n==============\n\nSome additional functionality is enabled installing the following\nextras:\n\n*  cli: enables the command line interface.\n\n*  plot: enables to plot the model process and its workflow.\n\n*  dev: installs all libraries plus the development libraries.\n\nTo install syncing and all extras (except development libraries), do:\n\n.. code:: console\n\n   $ pip install syncing[all]\n\n.. _end-quick:\n\n\nSynchronising Laboratory Data\n*****************************\n\nThis example shows how to synchronise two data-sets *obd* and *dyno*\n(respectively they are the On-Board Diagnostics of a vehicle and\nChassis dynamometer) with a reference signal *ref*. To achieve this we\nuse the model syncing model to visualize the model:\n\n>>> from syncing.model import dsp\n>>> model = dsp.register()\n>>> model.plot(view=False)\nSiteMap(...)\n\n[graph]\n\nTip: You can explore the diagram by clicking on it.\n\nFirst of all, we generate synthetically the data-sets to feed the\nmodel:\n\n>>> import numpy as np\n>>> data_sets = {}\n>>> time = np.arange(0, 150, .1)\n>>> velocity = (1 + np.sin(time / 10)) * 60\n>>> data_sets['ref'] = dict(\n...     time=time,                                               # [10 Hz]\n...     velocity=velocity / 3.6                                  # [m/s]\n... )\n>>> data_sets['obd'] = dict(\n...     time=time[::10] + 12,                                    # 1 Hz\n...     velocity=velocity[::10] + np.random.normal(0, 5, 150),   # [km/h]\n...     engine_rpm=np.maximum(\n...         np.random.normal(velocity[::10] * 3 + 600, 5), 800\n...     )                                                        # [RPM]\n... )\n>>> data_sets['dyno'] = dict(\n...     time=time + 6.66,                                        # 10 Hz\n...     velocity=velocity + np.random.normal(0, 1, 1500)         # [km/h]\n... )\n\nTo synchronise the data-sets and plot the workflow:\n\n>>> from syncing.model import dsp\n>>> sol = dsp(dict(\n...     data=data_sets, x_label='time', y_label='velocity',\n...     reference_name='ref', interpolation_method='cubic'\n... ))\n>>> sol.plot(view=False)\nSiteMap(...)\n\n[graph]\n\nFinally, we can analyze the time shifts and the synchronised and\nre-sampled data-sets:\n\n>>> import pandas as pd\n>>> import schedula as sh\n>>> pd.DataFrame(sol['shifts'], index=[0])  \n     obd  dyno\n...\n>>> df = pd.DataFrame(dict(sh.stack_nested_keys(sol['resampled'])))\n>>> df.columns = df.columns.map('/'.join)\n>>> df['ref/velocity'] *= 3.6\n>>> ax = df.set_index('ref/time').plot(secondary_y='obd/engine_rpm')\n>>> ax.set_ylabel('[km/h]'); ax.right_ax.set_ylabel('[RPM]')\nText(...)\n\n   .. image:: setup-58plrwu3/pypi-1.*\n",
    "bugtrack_url": null,
    "license": "EUPL 1.1+",
    "summary": "Time series synchronisation and resample library.",
    "version": "1.0.9",
    "project_urls": {
        "Documentation": "http://syncing.readthedocs.io",
        "Donate": "https://donorbox.org/syncing",
        "Download": "https://github.com/vinci1it2000/syncing/tarball/v1.0.9",
        "Homepage": "https://github.com/vinci1it2000/syncing",
        "Issue tracker": "https://github.com/vinci1it2000/syncing/issues"
    },
    "split_keywords": [
        "python",
        "utility",
        "library",
        "synchronise",
        "data",
        "scientific",
        "engineering",
        "resample",
        "time series"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e2cf85ae44393178907bab478399412fa78b7f3a5d3e5bd2900a55c8fdf4a5fe",
                "md5": "44dd9d2b57a6ac3ff55ce086a554e669",
                "sha256": "46092981e9f635c7b19aa50185aa0fee3a4808402d6066514c3fa50a23938047"
            },
            "downloads": -1,
            "filename": "syncing-1.0.9-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "44dd9d2b57a6ac3ff55ce086a554e669",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 18988,
            "upload_time": "2023-11-15T11:30:35",
            "upload_time_iso_8601": "2023-11-15T11:30:35.498482Z",
            "url": "https://files.pythonhosted.org/packages/e2/cf/85ae44393178907bab478399412fa78b7f3a5d3e5bd2900a55c8fdf4a5fe/syncing-1.0.9-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4585ddfa89e305e98829f00fd487f64a4772d88b8ff1f19378061a3aa57f9bb",
                "md5": "8130d733dddf2c76744fa4ac9d5c405f",
                "sha256": "d13eac88c2a37b8ea908e4f76143d50c0e023cc82f47af66a3abd6245cdb35e7"
            },
            "downloads": -1,
            "filename": "syncing-1.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "8130d733dddf2c76744fa4ac9d5c405f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 20417,
            "upload_time": "2023-11-15T11:30:37",
            "upload_time_iso_8601": "2023-11-15T11:30:37.187457Z",
            "url": "https://files.pythonhosted.org/packages/a4/58/5ddfa89e305e98829f00fd487f64a4772d88b8ff1f19378061a3aa57f9bb/syncing-1.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-15 11:30:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vinci1it2000",
    "github_project": "syncing",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "syncing"
}
        
Elapsed time: 0.42587s