PyFPT
PyFPT: A Python package for first-passage times - Published in JOSS (2023)
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
Scientific Fields
Repository
Stochastic first-passage time (FPT) simulations using importance sampling.
Basic Info
Statistics
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 4
- Releases: 2
Topics
Metadata Files
README.md
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.
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.
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.
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!
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.
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.
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".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
And we will review your request!
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.
Contact
Joe Jackson - joseph.jackson@port.ac.uk
Project Link: https://github.com/Jacks0nJ/PyFPT
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:
Owner
- Name: Joe Jackson
- Login: Jacks0nJ
- Kind: user
- Company: University of Portsmouth
- Repositories: 2
- Profile: https://github.com/Jacks0nJ
PhD Student at the Institute of Cosmology and Gravitation, working on stochastic inflation.
JOSS Publication
PyFPT: A Python package for first-passage times
Authors
Institute of Cosmology \& Gravitation, University of Portsmouth, Dennis Sciama Building, Burnaby Road, Portsmouth, PO1 3FX, United Kingdom
Tags
first-passage times importance sampling cosmology inflationGitHub 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
Top Committers
| Name | 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
- Homepage: https://github.com/Jacks0nJ/PyFPT.git
- Documentation: https://pyfpt.readthedocs.io/
- License: Apache Software License
-
Latest release: 1.0.2
published over 3 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/upload-artifact v1 composite
- openjournals/openjournals-draft-action master composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- actions/checkout v3 composite
- actions/setup-python v3 composite
- coverage *
- cython *
- matplotlib *
- mpmath *
- nbsphinx *
- nbsphinx-link *
- numpy *
- pandas *
- pytest *
- pytest-cov *
- scipy *