GithubHelp home page GithubHelp logo

vinci1it2000 / syncing Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 132 KB

Synchronise and re-sample time series

Home Page: http://syncing.readthedocs.io

License: European Union Public License 1.1

Python 95.77% Smarty 1.43% Shell 2.80%

syncing's Introduction

syncing: Time series synchronisation library.

Latest Version in PyPI Build status Code coverage Documentation status Issues count Supported Python versions Project License

release:1.0.9
date:2023-11-15 12:10:00
repository:https://github.com/vinci1it2000/syncing
pypi-repo:https://pypi.org/project/syncing/
docs:http://syncing.readthedocs.io/
wiki:https://github.com/vinci1it2000/syncing/wiki/
download:http://github.com/vinci1it2000/syncing/releases/
donate:https://donorbox.org/syncing
keywords:data, synchronisation, re-sampling
developers:
license:EUPL 1.1+

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):

$ pip install syncing

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

$ 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:

$ pip install syncing[all]

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:

.. dispatcher:: model
    :opt: graph_attr={'ratio': '1'}
    :code:

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

Tip

You can explore the diagram by clicking on it.

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

.. plot::
    :include-source:

    >>> 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:

    .. dispatcher:: sol
        :opt: workflow=True, graph_attr={'ratio': '1'}
        :code:

        >>> 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(...)

    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])  # doctest: +SKIP
         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(...)

syncing's People

Contributors

vinci1it2000 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

ankostis

syncing's Issues

ENH: build as "universal" wheel

Currently packaged 'wheels' are for the specific platform and python-version,
but actually this project contains pure-python code so it can "universal".

Please the following section in setup.py:

[bdist_wheel]
universal = 1

get_long_description() in setup.py fetchs too-many dependencies on build

setup.py scripts are supposed to import as little as possible because they python-environment might not have all those libraries installed.
And by invoking sphinx-builder, it loads in build-time all libraries used by docs (matplotlib & graphviz).

  • Practically it is not easy to test the project because of all those dependencies
  • Conda build needs special handlng.

Alternative

use the pure-python code from pandalone to clean README.rst for PyPi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.