Skip to main content

A python package for compound event analysis.

Project description

PCEA

.. image:: https://img.shields.io/badge/Host-pyCEA%2FREADME-orange :target: https://github.com/Koni2020/pyCEA/blob/master/README.md

.. image:: https://img.shields.io/badge/Python-3.10-blue

.. image:: https://img.shields.io/badge/Status-Building-green

What is PCEA?

pyCEA (Python Compound Event Analysis) identifies events in signals using specific thresholds and computes their occurrence time, intensity, peak, and duration. It also detects event chains (compound events) and calculates their probabilities, such as:

  • ENSO-drought-wildfire chain events
  • Heatwave-drought compound events
  • Drought-flood compound events

Compound events are the superposition of events within a specific time window, exhibiting six types of relationships.

Dependencies

The following Python packages are required:

  • numpy <https://numpy.org/>_
  • pandas <https://pandas.pydata.org/>_

Installation

Install pyCEA via pip::

pip install PCEA

Usage

Here are two quick examples of using pyCEA:

  1. Reading data from a CSV file::

    import numpy as np from PCEA import CEA import pandas as pd

    Read data from demo.csv, where columns represent variables and rows represent sampling times.

    Ensure that demo.csv exists and has numerical data.

    ts = pd.read_csv("./data/demo.csv", index_col=0, header=0)

    Select specific columns for analysis

    ts = ts.iloc[:, [0, 1]]

    Create a CEA instance with specified parameters

    cea = CEA(ts, delta=6, threshold=[-np.inf, -0.5])

    Run compound event analysis and save the results to an Excel file

    cea.run_cea(save_path='./data/results.xlsx')

  2. Input a boolean matrix::

    import numpy as np from PCEA import CEA

    Generate a boolean matrix (720 rows by 3 columns)

    ts = np.random.choice([True, False], [720, 3])

    Create a CEA instance for boolean input, setting is_binary_array to True

    cea = CEA(ts, delta=3, is_binary_array=True)

    Run compound event analysis and save the results to an Excel file

    cea.run_cea(save_path='./data/results.xlsx')

More examples can be found in Github <https://github.com/Koni2020/PCEA/blob/master/README.md>_.

References

  • Donges J F, Schleussner C F, Siegmund J F, et al. Event coincidence analysis for quantifying statistical interrelationships between event time series: On the role of flood events as triggers of epidemic outbreaks[J]. The European Physical Journal Special Topics, 2016, 225: 471-487. <https://link.springer.com/article/10.1140/epjst/e2015-50233-y>_

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

PCEA-0.1.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

PCEA-0.1.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: PCEA-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.17

File hashes

Hashes for PCEA-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d2ea6e4abee3319903d92846c3d59d508087291c0bc230bb57441b2408801f3b
MD5 4e853b754ad2f693b7553497ee11d153
BLAKE2b-256 903ed6ca3141ba0514d065ebf42bc0770a5965de8ef19fff90487fd118c8759b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: PCEA-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.17

File hashes

Hashes for PCEA-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40d2dc0d6943a8a00588bada7a0dd4c4fab7870126772645296a5f09418e0717
MD5 a731a5c362cca0531960a507ffbf193b
BLAKE2b-256 67e05e5bff6c28a6c7a1369caf602cbc3b11c5386c8492077240d6e4662d038f

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