To find the linear segment of a curve or dataset.
Project description
findlinear: Determining the linear segments of data with Bayesian model comparison
findlinear
is a Python module for finding the linear segment given a curve or dataset with x
and y
.
How does it work?
It uses the idea of Bayesian model comparison and calculate the evidence of each possible segment of curve being linear.
After calculating the evidence of each segment, it detects the global maximum, or uses the findpeaks
library to find the local maxima of evidence, from which the user can choose the relevant linear segment (e.g. that with the largest evidence, or that with the largest slope when the data consists of multiple linear segments).
Installation
For users, type in terminal
> pip install findlinear
For developers, create a virtual environment and then type
> git clone https://git.ecdf.ed.ac.uk/s1856140/findlinear.git
> cd findlinear
> poetry install --with dev
Quickstart
Data x
is a list or a 1D Numpy array, sorted ascendingly; the data y
is a list or a Numpy array, with each row being one replicate of measurement.
>>> from findlinear.findlinear import findlinear, get_example_data
>>> x, y = get_example_data()
>>> fl = findlinear(x, y)
>>> fl.find_all()
>>> fl.plot()
>>> fl.get_argmax()
>>> fl.get_peaks()
Documentation
Detailed documentation is available on Readthedocs.
Citation
A preprint is coming soon.
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
Hashes for findlinear-0.4.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5714d93912f017cf2ce9a1684090c2522520c9a174812cb407f95de06ef8c81e |
|
MD5 | 1d4d601f341d02fe87a7d41ac102b2bc |
|
BLAKE2b-256 | c48ce0382bd7c335823ef2c398e453f944ac35584d76249e3dc9509128be4a0e |