Status
Compatibilities
Contact
AdAdjust
Package allowing to fit any mathematical function to (for now 1-D only) data.
Installation
pip install adadjust
Usage
from adadjust import Function
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams.update({"text.usetex": True}) # Needs texlive installed
nsamples = 1000
a = 0.3
b = -10
xstart = 0
xend = 1
noise = 0.01
x = np.linspace(xstart, xend, nsamples)
y = a * x ** 2 + b + np.random.normal(0, noise, nsamples)
def linfunc(xx, p):
return xx * p[0] + p[1]
def square(xx, p):
return xx ** 2 * p[0] + p[1]
func = Function(linfunc, "$a \\times p[0] + p[1]$")
func2 = Function(square, "$a^2 \\times p[0] + p[1]$")
params = func.fit(x, y, np.array([0, 0]))[0]
rr = func.compute_rsquared(x, y, params)
params2 = func2.fit(x, y, np.array([0, 0]))[0]
rr2 = func2.compute_rsquared(x, y, params2)
table = Function.make_table(
[func, func2], [params, params2], [rr, rr2], caption="Linear and Square fit", path_output="table.pdf"
)
table.compile()
Function.plot(x, [func, func2], [params, params2], y=y, rsquared=[rr, rr2])
plt.gcf().savefig("plot.pdf")
NOTE : to have pretty gaphs, put the line plt.rcParams.update({"text.usetex": True}) just after you imported adadjust.
This requiers that you have TexLive full installed on your computer.
The result will be :
Metadata
Release files for adadjust 0.1.46
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 |
|---|---|---|---|---|
| adadjust-0.1.46.tar.gz | 115.8 kB | Without provenance | Details for adadjust-0.1.46.tar.gz |
Release files / adadjust-0.1.46.tar.gz
| Download URL | adadjust-0.1.46.tar.gz |
|---|---|
| Size | 115.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed14d00a6f81f1f69a639eedf0fde2124523a3122959ba4e3b57c18d136f050f
|
|
BLAKE2b-256 checksum How to use checksums |
853cd799f6b8665a639f5c3fcdc6df4d879a69ecfb356bb31cb60aab27a23100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Security for adadjust 0.1.46
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.