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
-
Clone the repository
git clone git@github.com:mrosol/tempord.git cd tempord
-
Create a virtual environment (recommended)
python -m venv .venv source .venv/bin/activate # macOS / Linux # .\.venv\Scripts\activate # Windows
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ce1aca821fa59611e49d5f26a515f661106a27c759bac4f59993a175475a77b
|
|
| MD5 |
82167ade44803c58e5baa2b47b455157
|
|
| BLAKE2b-256 |
99b63237afbb7d3c374752649c02472a6d807d9226bb22130295efe5df9d747c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
065dcdb4bd596248227f9d9692743f10f76548204607be592711609017bbfdb0
|
|
| MD5 |
ddeadd80d06e2f04859e8e649c744396
|
|
| BLAKE2b-256 |
c2f32be8b46cb1efed2a9eac6dca36d67b01511ba0dabda9624acaf580eda4c1
|