PyFPT

PyFPT: A Python package for first-passage times - Published in JOSS (2023)

https://github.com/jacks0nj/pyfpt

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
    4 of 5 committers (80.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

cosmology cython first-passage-times importance-sampling inflation stochastic

Scientific Fields

Mathematics Computer Science - 37% confidence
Last synced: 6 months ago · JSON representation

Repository

Stochastic first-passage time (FPT) simulations using importance sampling.

Basic Info
  • Host: GitHub
  • Owner: Jacks0nJ
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 46.9 MB
Statistics
  • Stars: 11
  • Watchers: 2
  • Forks: 1
  • Open Issues: 4
  • Releases: 2
Topics
cosmology cython first-passage-times importance-sampling inflation stochastic
Created almost 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

PyPI version License example workflow DOI

What is PyFPT?

PyFPT is Python/Cython package to run first-passage time (FPT) simulations using importance sampling. An FPT problem is about finding the time taken to cross some threshold during a stochastic process.

This package will let you numerically investigate the tail of the probability density for first passage times for a general 1D Langevin equation.

The tail of the probability density is investigated using the method of importance sampling, where a bias increases the probability of large FPTs, resulting in a sample distribution, which are then weighted to reproduce the rare events of the target distribution. This allows very rare events (normally needing supercomputers) to be simulated efficiently with just your laptop!

Note, it was originally developed to find the local number of e-folds in slow-roll stochastic inflation. As such, analytical functionality is also included for this particular problem in the analytics module.

(back to top)

Documentation

You can find the latest documentation on PyFPT's ReadTheDocs page.

Requirements

Operating System

As PyFPT uses Cython to optimise the stochastic simulations, a C-compilier is required for installation. Therefore, PyFPT does not currently run (future releases hope to address this issue) on Windows directly. Windows uses can either install PyFPT on a virtual machine or use a cloud-based service such as SciServer.

Mac and Linux user should be able to directly install PyFPT, as these operating systems have a C-compiler. Do feel free to raise an issue or contact us if you have any problems.

Packages

The following packages are required to run PyFPT

Many of which are included in common Python distributions like Anaconda. You can check which packages you already have installed with pip list.

(back to top)

Getting Started

User Guide

The documentation contains a user guide, whose code you can run yourself as interactive Jupyter notebook by downloading them.

Installation

The package can be installed by using the following command sh pip install PyFPT in the command line wherever you have Python installed.

You can also clone the PyFPT repository

sh git clone https://github.com/Jacks0nJ/PyFPT.git to work on it locally. This would require compiling the Cython code (the .pyx files) locally as well.

(back to top)

Example Results

The PyFPT package can be used to investigate far into the tail of the probability density (down to 10^-34 and beyond!)

Or even deviations from Gaussianity!

In the above images `N' is the first-passage time in stochastic inflation.

See the user guides for details on how you can make these figures yourself!

(back to top)

Unit Testing

PyFPT uses the unittest module to maintain the code. Almost all functions have some form of basic unit testing, which hopefully will be further developed as the project continues. The tests can all be found in the tests folder.

If unittest is installed, then the tests can be run locally using

sh pytest -v This tests the functions which have been installed using pip. The easiest way to run the test suite on any modified functions is to upload to your branch to the repo, as (the uploaded) tests run every commit on the code uploaded.

(back to top)

Roadmap

  • [x] Simulate first-passage times of slow-roll inflation
  • [x] Use importance sampling to investigate rare realisations.
  • [x] Make general, for any 1D Langevin equation
  • [ ] Add multi-dimensionality
    • [ ] Add the acceleration of the field
    • [ ] Add more sophisticated noise models

See the open issues for a full list of known issues.

(back to top)

Development branches

As different contributors continue to development the code, they will do so in several different branches. Therefore, it cannot be guaranteed that any branch, other than the main, will be fully functional at any one time. The main branch will be the correct release of the code available on PyPI and what you will install using pip.

Contributing

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

And we will review your request!

(back to top)

Bugs

This is the initial release of PyFPT, so it is expected there will be some minor bugs. Feel free to either report by raising an Issue on Github, emailing joseph.jackson@port.ac.uk or fork the repository with your fix.

Your feedback is very much appreciated!

License

Distributed under an Apache-2.0 License. See LICENSE.txt for more information.

(back to top)

Contact

Joe Jackson - joseph.jackson@port.ac.uk

Project Link: https://github.com/Jacks0nJ/PyFPT

(back to top)

Acknowledgments

We would like the following contributors to PyFPT, be it through physical understanding of first-passage time processes or help developing the package

The Physics

  • David Wands
  • Vincent Vennin
  • Kazuya Koyama
  • Hooshyar Assadullahi

Package Development

  • Coleman Krawczyk
  • Ian Harry

Logo

  • Will Jackson

Resources

The following resoucres were instrumental in developing the project into a package usable by the community:

(back to top)

Owner

  • Name: Joe Jackson
  • Login: Jacks0nJ
  • Kind: user
  • Company: University of Portsmouth

PhD Student at the Institute of Cosmology and Gravitation, working on stochastic inflation.

JOSS Publication

PyFPT: A Python package for first-passage times
Published
January 14, 2023
Volume 8, Issue 81, Page 4607
Authors
Joseph H. p. Jackson ORCID
Institute of Cosmology \& Gravitation, University of Portsmouth, Dennis Sciama Building, Burnaby Road, Portsmouth, PO1 3FX, United Kingdom
Ian Harry ORCID
Institute of Cosmology \& Gravitation, University of Portsmouth, Dennis Sciama Building, Burnaby Road, Portsmouth, PO1 3FX, United Kingdom
Coleman Krawczyk ORCID
Institute of Cosmology \& Gravitation, University of Portsmouth, Dennis Sciama Building, Burnaby Road, Portsmouth, PO1 3FX, United Kingdom
Editor
Vincent Knight ORCID
Tags
first-passage times importance sampling cosmology inflation

GitHub Events

Total
  • Issues event: 1
  • Watch event: 3
  • Member event: 1
Last Year
  • Issues event: 1
  • Watch event: 3
  • Member event: 1

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 204
  • Total Committers: 5
  • Avg Commits per committer: 40.8
  • Development Distribution Score (DDS): 0.049
Past Year
  • Commits: 13
  • Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jacks0nJ j****n@p****k 194
“JoeJ” “****n@p****” 6
Daniel S. Katz d****z@i****g 2
github-actions[bot] g****] 1
Carsten Fortmann-Grote g****c@e****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 7
  • Total pull requests: 43
  • Average time to close issues: about 2 months
  • Average time to close pull requests: 41 minutes
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 43
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: about 2 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • CFGrote (4)
  • Jacks0nJ (3)
  • geraintpalmer (1)
Pull Request Authors
  • Jacks0nJ (42)
  • CFGrote (1)
  • danielskatz (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 15 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 3
  • Total maintainers: 1
pypi.org: pyfpt

Stochastic first-passage time (FPT) simulations using importance sampling

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 15 Last month
Rankings
Dependent packages count: 6.6%
Stargazers count: 21.8%
Average: 22.8%
Forks count: 23.2%
Dependent repos count: 30.6%
Downloads: 32.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/draft-pdf.yml actions
  • actions/checkout v2 composite
  • actions/upload-artifact v1 composite
  • openjournals/openjournals-draft-action master composite
.github/workflows/pylint.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
.github/workflows/python-app.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
requirements.txt pypi
  • coverage *
  • cython *
  • matplotlib *
  • mpmath *
  • nbsphinx *
  • nbsphinx-link *
  • numpy *
  • pandas *
  • pytest *
  • pytest-cov *
  • scipy *
pyproject.toml pypi
setup.py pypi