From 48a8add1b8822cf6312cf99e38816234b98a1642 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Fri, 6 Dec 2024 23:10:54 +0100 Subject: [PATCH 1/9] Added Classifiers to SetUp --- setup.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index df2b1d5..64a6370 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name = "fitting_toolkit", - version = "1.0.1", + version = "1.0.2", package_dir={"": "src"}, packages=[""], long_description=description, @@ -20,6 +20,12 @@ "Source": "https://github.com/davidkowalk/fitting_toolkit/", "Tracker": "https://github.com/davidkowalk/fitting_toolkit/issues" }, + classifiers=[ + "Intended Audience :: Students / Scientists", + "Programming Language Python:: Python", + "Programming Language Python:: Python :: 3", + "Natural Language :: English" + ], license="MIT", description="Easy and Flexible Curve Fitting", url="https://github.com/davidkowalk/fitting_toolkit/" From cd085aa4b08c251f37c778be2fa12ba738a57c85 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Fri, 6 Dec 2024 23:15:14 +0100 Subject: [PATCH 2/9] Set Docs Link to Stable Branch --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 64a6370..181a96b 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ long_description_content_type="text/markdown", install_requires = requirements, project_urls = { - "Documentation": "https://github.com/davidkowalk/fitting_toolkit/blob/development/docs/manual.md", + "Documentation": "https://github.com/davidkowalk/fitting_toolkit/blob/Stable/docs/manual.md", "Source": "https://github.com/davidkowalk/fitting_toolkit/", "Tracker": "https://github.com/davidkowalk/fitting_toolkit/issues" }, From 411fd12df2e327d15c05783c637b6ef1e1c286a5 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 02:19:45 +0100 Subject: [PATCH 3/9] Attempt to resolve #19 by using svg in html as fallback --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f11f43..74c3d02 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ pip install fitting-toolkit==1.0.1 You can find all releases here: -[Releases](https://github.com/davidkowalk/fitting_toolkit/releases) +[](https://github.com/davidkowalk/fitting_toolkit/releases) After downloading the desired version you can find the `fitting_toolkit.py` in the `src` folder and copy it into your project. From 7e9a7c3309e892120acd2fd45bf1c1dd8f962b3e Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 02:27:46 +0100 Subject: [PATCH 4/9] replace markdown link with html as fallback inline SVG was not rendered inside markdown link. attempting as fallback --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74c3d02..58e0cc4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ pip install fitting-toolkit==1.0.1 You can find all releases here: -[](https://github.com/davidkowalk/fitting_toolkit/releases) + After downloading the desired version you can find the `fitting_toolkit.py` in the `src` folder and copy it into your project. From 34f02d5d17e1f3552037af67264fd2362f475af3 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 02:34:00 +0100 Subject: [PATCH 5/9] Rehosting Button-Image to GitHub --- README.md | 2 +- docs/img/download.svg | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 docs/img/download.svg diff --git a/README.md b/README.md index 58e0cc4..b914f8f 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ pip install fitting-toolkit==1.0.1 You can find all releases here: - +![Download](./docs/img/download.svg) After downloading the desired version you can find the `fitting_toolkit.py` in the `src` folder and copy it into your project. diff --git a/docs/img/download.svg b/docs/img/download.svg new file mode 100644 index 0000000..421529b --- /dev/null +++ b/docs/img/download.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 1d185b307eb282adf4ff9d8ab87fdd31b0031272 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 09:38:32 +0100 Subject: [PATCH 6/9] Updated Shields to include pip installs --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b914f8f..2193256 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -![GitHub commit activity](https://img.shields.io/github/commit-activity/m/davidkowalk/fitting_toolkit) ![GitHub License](https://img.shields.io/github/license/davidkowalk/fitting_toolkit) -![University](https://img.shields.io/badge/Univeristy_of_Bonn-brown) ![Version](https://img.shields.io/badge/version-1.0.1-green) +![GitHub commit activity](https://img.shields.io/github/commit-activity/m/davidkowalk/fitting_toolkit) ![GitHub Repo stars](https://img.shields.io/github/stars/davidkowalk/fitting_toolkit?style=flat&label=github%20stars) +![PyPI - Downloads](https://img.shields.io/pypi/dm/fitting-toolkit?label=pip%20installs)\ +![University](https://img.shields.io/badge/Univeristy_of_Bonn-brown) From 7172a2acdd77fe379827d60a63e18c542216994d Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 09:45:57 +0100 Subject: [PATCH 7/9] Update instructions for manually installing clones --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2193256..18b2e6a 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,18 @@ You can find all releases here: ![Download](./docs/img/download.svg) +To install the current development version ahead of releases check out the development branches. +| Branch | Purpose +|-----------------|------------- +| development-1.0 | Bug fixes and documentation adding onto version 1.0.1 +| development-1.1 | Development of new major features After downloading the desired version you can find the `fitting_toolkit.py` in the `src` folder and copy it into your project. To build the project yourself and install it, make sure `setuptools` and `wheel` are installed, then run ``` python3 setup.py sdist bdist_wheel -pip install .\dist\fitting_toolkit-1.0.1-py3-none-any.whl --force-reinstall +pip install --no-deps --force-reinstall ./dist/fitting_toolkit-VERSION_NUMBER-py3-none-any.whl pip show fitting-toolkit -v ``` From ec6046ea21780a70828dae351c0df512b25348ab Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 10:07:42 +0100 Subject: [PATCH 8/9] Added package description for pip website --- package_description.md | 98 ++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 package_description.md diff --git a/package_description.md b/package_description.md new file mode 100644 index 0000000..4b01ca8 --- /dev/null +++ b/package_description.md @@ -0,0 +1,98 @@ + + +![GitHub License](https://img.shields.io/github/license/davidkowalk/fitting_toolkit) +![Version](https://img.shields.io/badge/version-1.0.1-green) +![GitHub commit activity](https://img.shields.io/github/commit-activity/m/davidkowalk/fitting_toolkit) +![GitHub Repo stars](https://img.shields.io/github/stars/davidkowalk/fitting_toolkit?style=flat&label=github%20stars) +![PyPI - Downloads](https://img.shields.io/pypi/dm/fitting-toolkit?label=pip%20installs)\ +![University](https://img.shields.io/badge/Univeristy_of_Bonn-brown) + + + +# Fitting Toolkit +This toolkit aims at providing flexible and powerful tools for data analysis and modelling, but remain easy to use. +This toolkit is aimed primarily at my peers, students of physics at the university of bonn, and to a degree at professionals within my field. I am optimizing this toolkit to be used on the scale typical of lab courses and homework assignments but if possible it should be powerful enough to run decently sized datasets on an average laptop. + +This package wraps numpy for fast data management and manipulation, scipy for `curve_fit()` and matplotlib for display options. + +## Quick Introduction + +### Installation + +There are multiple ways to install this package. The easiest is via pip: +``` +pip install fitting-toolkit +``` +If you need a specific version (for example due to compatibillity issues) you can specify the version via `fitting-toolkit==version`, e.g: +``` +pip install fitting-toolkit==1.0.1 +``` + +### Alternative Installation Methods + +To install the current development version ahead of releases check out the development branches on GitHub. +| Branch | Purpose +|-----------------|------------- +| development-1.0 | Bug fixes and documentation adding onto version 1.0.1 +| development-1.1 | Development of new major features + +After downloading the desired version you can find the `fitting_toolkit.py` in the `src` folder and copy it into your project. + +To build the project yourself and install it, make sure `setuptools` and `wheel` are installed, then run +``` +python3 setup.py sdist bdist_wheel +pip install --no-deps --force-reinstall ./dist/fitting_toolkit-VERSION_NUMBER-py3-none-any.whl +pip show fitting-toolkit -v +``` + +### Requirements +This project requires the following modules along with their dependencies: +- numpy +- matplotlib +- scipy + +It is highly recommended that the user familiarizes themselves with the functionality of these modules first. A rudimentary understanding of `numpy` and `matplotlib.pyplot` is required. + +If you install via pip the dependencies will automatically be installed. However if the project files are used directly you may want to install dependencies manually: + +To install the dependencies, first a [virtual environment](https://docs.python.org/3/library/venv.html) should be created. `requirements.txt` lists all necessary packages. Run: +``` +pip install -r requirements.txt +``` + +### Getting Started + +You can now import the relevant functions into your code: +```python +from fitting_toolkit import curve_fit, plot_fit +import numpy as np +``` +The `curve_fit` requires numpy-arrays. Therefore numpy has to be imported as well. + +We can now start by defining our data. +```python +x = np.array((1, 2, 3, 4, 5)) +y = np.array((1, 2, 1.75, 2.25, 3)) +dy = 0.1*y+0.05 +dx = 0.1 +``` +We chose a simple linear model: +```python +def f(x, a, b): + return a * x + b +``` +We can now fit the model to the data: +```python +params, cov, lower_conf, upper_conf = curve_fit(f, x, y, yerror=dy) +``` +This functions returns 4 arrays. First the parameters of the model, the covariance matrix of those parameters and then the lower and upper limits of the confidence interval around the fit. Note that the confidence interval is absolute. To get the error in relation to the fitted function you would need to find the difference at each point. + +The resulting fit can now be plotted. This toolkit provides a premade function to generate plots: +```python +from matplotlib import pyplot as plt +fig, ax = plot_fit(x, y, f, params, lower_conf, upper_conf, xerror=dx, yerror=dy) +plt.show() +``` +Note that the fitted function is not automatically displayed. Instead the figure and axis-objects are returned. + +![Example Graph](https://github.com/davidkowalk/fitting_toolkit/blob/Stable/docs/img/example_fit.png?raw=true) \ No newline at end of file diff --git a/setup.py b/setup.py index 181a96b..0b5d1ef 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup #run with python3 setup.py sdist bdist_wheel -with open("./README.md") as f: +with open("./package_description.md") as f: description = f.read() with open("./requirements.txt", encoding="utf-16") as f: From c795b9a72f7124076e756e87b1226852e1c8d8a8 Mon Sep 17 00:00:00 2001 From: "David J. Kowalk" Date: Sat, 7 Dec 2024 14:21:44 +0100 Subject: [PATCH 9/9] increment Version shield --- README.md | 2 +- package_description.md | 2 +- setup.py | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 18b2e6a..159c8e5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![GitHub License](https://img.shields.io/github/license/davidkowalk/fitting_toolkit) -![Version](https://img.shields.io/badge/version-1.0.1-green) +![Version](https://img.shields.io/badge/version-1.0.2-green) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/davidkowalk/fitting_toolkit) ![GitHub Repo stars](https://img.shields.io/github/stars/davidkowalk/fitting_toolkit?style=flat&label=github%20stars) ![PyPI - Downloads](https://img.shields.io/pypi/dm/fitting-toolkit?label=pip%20installs)\ diff --git a/package_description.md b/package_description.md index 4b01ca8..7e800da 100644 --- a/package_description.md +++ b/package_description.md @@ -1,7 +1,7 @@ ![GitHub License](https://img.shields.io/github/license/davidkowalk/fitting_toolkit) -![Version](https://img.shields.io/badge/version-1.0.1-green) +![GitHub Release](https://img.shields.io/github/v/release/davidkowalk/fitting_toolkit?color=green) ![GitHub commit activity](https://img.shields.io/github/commit-activity/m/davidkowalk/fitting_toolkit) ![GitHub Repo stars](https://img.shields.io/github/stars/davidkowalk/fitting_toolkit?style=flat&label=github%20stars) ![PyPI - Downloads](https://img.shields.io/pypi/dm/fitting-toolkit?label=pip%20installs)\ diff --git a/setup.py b/setup.py index 0b5d1ef..9aa3537 100644 --- a/setup.py +++ b/setup.py @@ -21,9 +21,8 @@ "Tracker": "https://github.com/davidkowalk/fitting_toolkit/issues" }, classifiers=[ - "Intended Audience :: Students / Scientists", - "Programming Language Python:: Python", - "Programming Language Python:: Python :: 3", + "Programming Language :: Python", + "Programming Language :: Python :: 3", "Natural Language :: English" ], license="MIT",