CEREsFit
The goal of CEREsFit (Correlated Errors Regression Estimate Fit) is to provide a python package that allows to calculate linear regressions on data sets with correlated uncertainties. The calculations follow the methodology published by Mahon (1996). Typos and errors that were made in that work have been corrected. A method to allow calculating a linear regression through a fixed point, avoiding previously made errors, is also provided.
Details on CEREsFit can be found in Stephan and Trappitsch (2023).
Installation
The package can be installed from pypi via:
pip install ceresfit
Usage
Below is an example on how to use the package.
>>> import numpy as np
>>> from ceresfit import LinReg
>>> # some data
>>> xdata = np.array([1, 2, 3.1, 4.9])
>>> ydata = np.array([1.1, 1.9, 3, 5.5])
>>> # some uncertainty and correlation
>>> xunc = 0.05 * xdata
>>> yunc = 0.073 * ydata
>>> rho = np.zeros_like(xdata) + 0.5
>>> # do regression
>>> my_reg = LinReg(xdata, xunc, ydata, yunc, rho)
>>> # print out the parameters and their uncertainties
>>> my_reg.slope
(0.9983613298400896, 0.06844666435449052)
>>> my_reg.intercept
(0.05545398718611372, 0.11812746374874884)
>>> my_reg.mswd
2.5105964767071143
Detailed example on how to use the class for fitting and plotting the results can be found in these Jupyter notebooks.
Development & Contributing
This project is developed using Rye. After cloning, you can simply run
rye sync
in the project folder and you should be good to go.
Code auto formatting is implemented using
pre-commit hooks.
For local formatting and linting, please use
rye fmt
rye lint
For running tests, use:
rye test
rye run test_docs
The first of these commands runs pytest,
the second checks the documentation tests using xdoctest.
Please feel free to raise issues on GitHub and open pull requests if you have a feature to be added. Tests and adequate docstrings should be provided along with your new code.
Metadata
Release files for ceresfit 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ceresfit-0.3.2.tar.gz | 205.3 kB | Without provenance | Details for ceresfit-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ceresfit-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for ceresfit-0.3.2-py3-none-any.whl |
Total release size: 215.4 kB
Release files / ceresfit-0.3.2.tar.gz
| Download URL | ceresfit-0.3.2.tar.gz |
|---|---|
| Size | 205.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d85d9b783611429d9906d4aa844ccc42e2f2619cb9aedd6b0a0ce61b62ef97e
|
|
BLAKE2b-256 checksum How to use checksums |
db6632c4b67dc499d8ed810378701ddaed870d467794cda8973a10f71509a599
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ceresfit-0.3.2-py3-none-any.whl
| Download URL | ceresfit-0.3.2-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93af059acbd30fbb005e63108bde72f632fab8b15e82875b345bdc17d5da8578
|
|
BLAKE2b-256 checksum How to use checksums |
80e7ec23ff1160ce63d11519b461871d115c23404b5ff644c7c89f9d89fb7bf4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ceresfit 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.