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:
>>> 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(...)
Metadata
Release files for syncing 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| syncing-1.0.9.tar.gz | 20.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| syncing-1.0.9-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 39.4 kB
Release files / syncing-1.0.9.tar.gz
| Download URL | syncing-1.0.9.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d13eac88c2a37b8ea908e4f76143d50c0e023cc82f47af66a3abd6245cdb35e7
|
|
BLAKE2b-256 checksum How to use checksums |
a4585ddfa89e305e98829f00fd487f64a4772d88b8ff1f19378061a3aa57f9bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / syncing-1.0.9-py2.py3-none-any.whl
| Download URL | syncing-1.0.9-py2.py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
46092981e9f635c7b19aa50185aa0fee3a4808402d6066514c3fa50a23938047
|
|
BLAKE2b-256 checksum How to use checksums |
e2cf85ae44393178907bab478399412fa78b7f3a5d3e5bd2900a55c8fdf4a5fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|