Skip to main content

Generalized & powerful time-series class and related functions

Project description

zynamon

Generalized & powerful time-series class and related functions.

Synopsis

This library defines a powerful, generic time-series representation based on the popular pandas DataFrames. However, it adds meta-data as well as conveniently built-in filtering & alignment routines for both value and time dimensions. Moreover, time-series objects can be constructed from nearly any 1D data such that handling of various sources in a standardised way is made possible (e.g. regularly-sampled sensor data, event logs, audio streams etc).

Package Contents

The package is structured into the following modules:

zeit: Main class TimeSeries containing time-, value- and samples-related methods and algorithmic operators (+, -, *, /)

zeitspec: Class TimeSpec and conversion routine for a unified treatment of various timestamp representations as settings or from data (types and strings)

imex: Routines for the automatic bulk import, conversion & aggregation of data from (a lot of) CSV-like files, e.g. proper extraction of all individual time-series hidden in lengthy event logs

utils: Utilities working on TimeSeries objects such as helpers for general analysis (e.g. outliers, predictions, history etc) and operators on two arbitrary objects (incl. routines to make objects "time-coherent" by aggregation / re-sampling)

xutils: Special conversion utilities for CSV-files containing DFT spectra as generated by the "CMS X-Tools" real-time multi-channel analysis software (Siemens AG).

CLI Application

Besides the library core, the cli module provides convenient script routines for an automatic processing (e.g. bulk import and/or conversion from - a loooot of! - CSV-like files). After installation of the package, these routines can either be invoked via the Python module zynamon.cli or even simpler as standalone executables from the terminal:

zynamon ROUTINE

In total, the following tasks of ROUTINE are offered by the CLI application:

  • importer
  • compresser
  • merger

and also a generic summarizer that will collate readable information on existing time-series collections within a given root folder. Note: By default this step is already performed by the above routines.

All of the routines come with a reasonable default behaviour such that only few arguments are actually required while missing details are "guessed in a smart way". Using the --help option will generate self-explanatory information for an intuitive usage on all routines. For more details refer to the background section (e.g. expected folder structures).

GUI Application

A special routine of the above interface is finally given by

zynamon explorer

as this provides a web-based GUI experience powererd by the popular streamlit rapid prototyping package. This enables to quickly visualise multiple time-series from previously stored collection files while additional cropping, filtering and aggregation options can be applied on-the-fly (i.e. in a non-destructive way).

Background

This section provides additional information for users.

Collection & summary files

TimeSeries objects can either be stored individually or in collection files, housing one or more objects at a time. For the latter, both dict or list arrangements are available in Python, allowing to choose the more suitable layout.

In general, the following file formats are supported:

  • *.pk => Python's builtin pickle
  • *.json => JSON / readable dict-type
  • *.h5 => HDF5 hierachical storage format
  • *.parquet => Apache parquet file (implemented by pyarrow package, only for single files!)

Since collections may include a large number of different time-series, it may be desirable to have means for a quick overview. To this end, so called summary files with extension *.tsinfo can be generated, offering details in readable text as follows:

  • collection totals: # time-series, min/max lengths, common time interval (if any)
  • per time-series details: name, number of samples, time interval covered

Folder structures for projects

For "smart guess" defaults to work, a certain folder hierarchy is expected and must be present below each project's root location. This expected structure is shown in the following:

  • ---Project---
    • --Asset A1--
      • -Period P1-
        • subfolders "log-enum" (if any)
        • subfolders "log-real" (if any)
        • subfolders "streams" (if any)
        • subfolders "streams-xt" (if any)
      • -Period P2-
        • subfolders "log-enum" (if any)
        • subfolders "log-real" (if any)
        • subfolders "streams" (if any)
        • subfolders "streams-xt" (if any)
      • ...
    • --Asset A2--
      • -Period P1-
        • ...
      • -Period P2-
        • ...
    • ...

Note that all of the subfolder categories within a period are optional and, thus, zero or more items may be given. However, at least one item must be given for any category in every period, as otherwise no data will be processed!

Typical example calls

a) Importing all files acc. to a project configuration and saving all time-series separately:

zynamon importer . --cfg-file D:/MyData/cfg_project.json --save-series

b) Compressing collection files for given assets & time period sub-folders acc. desired settings:

zynamon compresser D:/MyProject [Asset1,Asset2] 2025-07 --agg-time [10,60,300,3600] --agg-mode [avg,min,max]

c) Traverse given folder and create summary files for all collections (even if different extensions may be found) and existing summary files may be overwritten:

zynamon summarizer D:/MyProject --ignore-ext --overwrite --verbosity 1

Note: This use case may occur if collection files are created at different points in time (after new data has become available) and/or with different storage formats and proper summarizing needs to be repeated.

Template for configuration files

To create a JSON configuration for a specific project (folder) layout, the following schema can be used. Obviously, not all of these fields are mandatory, but rather dependent on the actual contents of the CSV information. To keep the text short, a simplified schema documenting style is used here, where the expected types for values are denoted by /schema-type/ and *required or *required-if-category-used is appended if the field is essential:

{
    "name": /str/,
    "info": /str/,

    "root": /str/, *required*
    "path": /str/, *required*

    "assets":  /list[str]/,
    "periods": /list[str]/,

    "sub_logs_enum":  /list[str]/,
    "sub_logs_real":  /list[str]/,
    "sub_streams":    /list[str]/,
    "sub_streams_xt": /list[str]/,
    
    "def_logs_enum": /dict/ *required-if-category-used*
    {
        "name": /str/ | /list[str]/, *required*
        "time": /str/, *required*
        "data": /str/  *required*
    },
        
    "def_logs_real": /dict/ *required-if-category-used* 
    {
        "name": /str/ | /list[str]/, *required*
        "time": /str/, *required*
        "data": /str/  *required*
    },

   "def_streams": /dict/ *required-if-category-used*  
   {
        "time": /str/, *required*
        "data": /list[str]/ *required*
    },

    "def_streams_xt": /dict/ *required-if-category-used*  
    {
        "time": /str/, *required*
        "data": /str/ *required*
    },

    "_comment": /str/    
}

[ Dr. Marcus Zeller | dsp4444@gmail.com | Erlangen, Germany | 2022-2026 ]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zynamon-0.3.0.tar.gz (70.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zynamon-0.3.0-py3-none-any.whl (72.2 kB view details)

Uploaded Python 3

File details

Details for the file zynamon-0.3.0.tar.gz.

File metadata

  • Download URL: zynamon-0.3.0.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for zynamon-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7e4db982ded9b52647d44cffe465a35ae810f27683ed0e6f0c82dc9599dfa8ad
MD5 a246b916d2e8a1cde6d49a90845ba497
BLAKE2b-256 97ba212528d6004082f6613639951a387015bef31a75cd50ed73700cfa86ee88

See more details on using hashes here.

File details

Details for the file zynamon-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zynamon-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 72.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for zynamon-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba552ef6c6b2cc6cc27479833abf72dd2bb3e244cc3dd58eb3d79f2447c56192
MD5 39b13a6ed90740819924b74ce207b4c9
BLAKE2b-256 0a4368901866f7bee1e45e59f28e7642d82457fc8eefa430969b19349c61c4a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page