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

You can install tempord from PyPI or clone the repository for development.

Option 1: Install from PyPI

pip install tempord

Option 2: Clone and install from source

  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.2.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.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tempord-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 1ce1aca821fa59611e49d5f26a515f661106a27c759bac4f59993a175475a77b
MD5 82167ade44803c58e5baa2b47b455157
BLAKE2b-256 99b63237afbb7d3c374752649c02472a6d807d9226bb22130295efe5df9d747c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tempord-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 065dcdb4bd596248227f9d9692743f10f76548204607be592711609017bbfdb0
MD5 ddeadd80d06e2f04859e8e649c744396
BLAKE2b-256 c2f32be8b46cb1efed2a9eac6dca36d67b01511ba0dabda9624acaf580eda4c1

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