Skip to main content

Temporal orders and causal vector for physiological data analysis

Project description

tempord

tempord is a Python package for computing temporal order between pairs of time series signals based on paper:

M. Młyńczak, "Temporal orders and causal vector for physiological data analysis," 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), Montreal, QC, Canada, 2020, pp. 750-753, doi: 10.1109/EMBC44109.2020.9176842.

📦 Installation

  1. Clone the repository

    git clone git@github.com:mrosol/tempord.git
    cd tempord
    
  2. Create a virtual environment (recommended)

    python -m venv .venv
    source .venv/bin/activate   # macOS / Linux
    # .\.venv\Scripts\activate  # Windows
    
  3. Install required packages

    pip install -r requirements.txt
    

⚙️ Usage

Import the main function from the tempord module and call it with a pandas.DataFrame containing your signals as columns.

from tempord import tempord
import pandas as pd

# example DataFrame with two signals
df = pd.DataFrame({'s1': signal1, 's2': signal2})

results = tempord(
    df,
    method="LM",                # or "TD"
    thr=0.7,                      # threshold (>=0 to apply)
    scaling=1,                    # 0=no scaling, 1=min-max, 2=z-score
    sig_length=10,                # window length in seconds
    max_shift_seconds=(-1, 1),    # backward/forward range in seconds
    fs=25,                        # sampling frequency (Hz)
    make_figure=True              # generate a matplotlib Figure
)

# `results` is a dict keyed by signal‑pair tuples (e.g. ('s1','s2')).
# Each value contains:
# - "Tempord": DataFrame of parameter values for each point/shift
# - "Max": DataFrame with the shift giving the maximum parameter per point
# - "Fig": matplotlib figure object (or None)

Plotting and post‑processing

The module provides helper functions used internally:

  • get_causal_vector – extracts the shift of maximum parameter values.
  • make_plot – draws a heatmap of the parameter matrix and overlays the maxima curve.

📌 Notes

  • Input signals should be numeric and of equal length. Windowing and shifting that fall outside the signal boundaries are skipped quietly.

Contact

mail: maciej.rosol@pw.edu.pl

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

tempord-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

tempord-0.1.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file tempord-0.1.1.tar.gz.

File metadata

  • Download URL: tempord-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tempord-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4235b97454d9e7e6d457697cbe1bdf869cbb6bb70ae983cd848ffd1f39035a58
MD5 eccca59920a1bbe474d4ae8f5ca79c9b
BLAKE2b-256 bdc27deac6f057faad8c6aca35f1bac654d2350fe05dbb4c939316b2a66ab684

See more details on using hashes here.

File details

Details for the file tempord-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tempord-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tempord-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 847efddb0800b079b750091e3c339814c715f7ed61f7170de4e9046bf017abae
MD5 cfc452d2866e008bb4610be14c16fab8
BLAKE2b-256 34fd6dc204da8f4acc844e548d45a96f876f4216ed6c38ba03bbaa1adafbbfa6

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