Skip to main content

A library of events for scipy.integrate.solve_ivp.

Project description

scipy_events

Copier Badge Pixi Badge License CI Badge conda-forge Badge PyPI Badge Python version Badge

A library of events for scipy.integrate.solve_ivp.

It provides the following events:

  • ChangeWhen to apply a change when a given event happens.
  • ChangeAt to apply a change at some given times.

Usage

import numpy as np
from scipy_events import ChangeAt, solve_ivp

result = solve_ivp(
    lambda t, y: -y,
    t_span=(0, 16),
    y0=[1],
    events=[
        ChangeAt(
            times=[4, 8],
            change=lambda t, y, args: (np.full_like(y, 1), args),
        )
    ],
)

import numpy as np
from scipy_events import ChangeWhen, solve_ivp

result = solve_ivp(
    lambda t, y: -y,
    t_span=(0, 16),
    y0=[1],
    events=[
        ChangeWhen(
            condition=lambda t, y: y[0] - 1e-2,
            change=lambda t, y, args: (np.full_like(y, 1), args),
        )
    ],
)

Install

Using pixi, install from PyPI with:

pixi add --pypi scipy-events

or install the latest development version from GitHub with:

pixi add --pypi scipy-events@https://github.com/maurosilber/scipy-events.git

Otherwise, use pip or your pip-compatible package manager:

pip install scipy-events  # from PyPI
pip install git+https://github.com/maurosilber/scipy-events.git  # from GitHub

Development

This project is managed by pixi. You can install it for development using:

git clone https://github.com/maurosilber/scipy-events
cd scipy-events
pixi run pre-commit-install

Pre-commit hooks are used to lint and format the project.

Testing

Run tests using:

pixi run test

Publishing to PyPI

When a tagged commit is pushed to GitHub, the GitHub Action defined in .github/workflows/ci.yml builds and publishes the package to PyPI.

Tag a commit and push the tags with:

git tag <my-tag>
git push --tags

Trusted publishing must be enabled once in PyPI Publishing. Fill the following values in the form:

PyPI Project Name: scipy-events
            Owner: maurosilber
  Repository name: scipy-events
    Workflow name: ci.yml
 Environment name: pypi

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

scipy_events-0.4.4.tar.gz (66.0 kB view details)

Uploaded Source

Built Distribution

scipy_events-0.4.4-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file scipy_events-0.4.4.tar.gz.

File metadata

  • Download URL: scipy_events-0.4.4.tar.gz
  • Upload date:
  • Size: 66.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.26

File hashes

Hashes for scipy_events-0.4.4.tar.gz
Algorithm Hash digest
SHA256 61eb0417b1b53924b5b7b6dd1855632633e74422c20b4f18b5fc8b45d4319085
MD5 f4ebdb2cec61abc6c7f9abb46f43a532
BLAKE2b-256 0cf50e9a75f47a1f908a037be0d0abe5e82cbca4d36c1b31b6adc344451b754a

See more details on using hashes here.

File details

Details for the file scipy_events-0.4.4-py3-none-any.whl.

File metadata

File hashes

Hashes for scipy_events-0.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 43ce86a1f595fc937565ca3b675ba444bb5f8d7c42d8c9e3055665003d9dcaed
MD5 fcdc0954fc069b013f730cefaac8c8fa
BLAKE2b-256 6ff50538ca92fd0bf53e2c6cb997bd19285e0ffc12afc9193abd831423279435

See more details on using hashes here.

Supported by

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