Skip to main content

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 here.

Citation

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

findlinear-0.4.0.tar.gz (9.1 kB view hashes)

Uploaded Source

Built Distribution

findlinear-0.4.0-py3-none-any.whl (9.4 kB view hashes)

Uploaded Python 3

Supported by

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