# LabPartner - A Tool for Undergraduate Physics Students
[![PyPI package](https://img.shields.io/badge/pip%20install-labpartner_uom-brightgreen)](https://pypi.org/project/labpartner_uom/) [![version number](https://img.shields.io/pypi/v/labpartner_uom?color=green&label=version)](https://github.com/SiddharthSule/labpartner_uom/releases) [![Actions Status](https://github.com/SiddharthSule/labpartner_uom/workflows/Test/badge.svg)](https://github.com/SiddharthSule/labpartner_uom/actions) [![License](https://img.shields.io/github/license/SiddharthSule/labpartner_uom)](https://github.com/SiddharthSule/labpartner_uom/blob/main/LICENSE)
Struggling with Lab? Me too!
Over the course of my undergraduate studies at the University of Manchester, UK, I had three years of lab. Now, as someone who teaches those labs alongside my PhD, I thought it would be useful to automate some of the more painful parts of lab, so the students can just focus on understanding the physics and assessing their results.
This Python is Package can:
- Apply ~Linear and Quadratic~ **ANY** fit to Data, and Plot Results
- Propagate Errors for all functions
It is important to acknowledge that there are other similar, very useful tools (OriginPro, LSFR, your own code). I just wanted to try making something that works as an all-in-one system, effectively acting as a Lab Partner!
## Installation
To install this package, simply type:
```bash
pip install labpartner_uom
```
PyPI might use labpartner-uom, but this command does the same. Someday I hope to remove the '_uom'!
## Usage
### Data Analysis and Plotting
There are a few presets which allow you to auto-analyse your results.
```python
import labpartner_uom as lp
lp.analyse(x, y, yerr, fit) # For data arrays
lp.analyse_from_file(filename, fit) # For data in .csv files
# Example with specific labels
lp.analyse(t, d, derr, "Quadratic", xlabel="Time (s)", ylabel="Distance (s)")
```
This should print the results of the fitting, as well save a .png and .pdf of the plot.
Options of fits include: Linear, Quadratic, Gaussian, Exponential, Logarithmic, Sine, Cosine and more! You can also add your own functions to fit:
```python
lp.analyse(x, y, yerr, "a * exp(b * x) * sin(c * x) + d")
```
### Error Propagation
To propagate errors, simply write up the function and the variables which have uncertainties.
```python
import labpartner_uom as lp
prop = lp.errorpropagator.propagate_error(func, vars)
# Example
prop = lp.errorpropagator.propagate_error("A*x**2 + B*y + C", ["x", "y"])
```
### Examples
I have given some full examples on how to use the code for a lab experiment. The first example contains a simple analysis, while the other is for free and forced oscillations, a lab I demonstrated.
You can find these examples [here](docs/examples/)
### Advanced Usage
The guide above gives you a quick result. However, there is more for advanced users:
- Customisation of Plots
- Fitting without Errors
You can find more details on this in [more-stuff.md](docs/extended/more-stuff.md)
---
Siddharth Sule, 2024
Based On Tom Chen's Example Package: https://github.com/tomchen/example_pypi_package
Raw data
{
"_id": null,
"home_page": "https://github.com/SiddharthSule/labpartner_uom",
"name": "labpartner-uom",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "physics,laboratory,undergraduate,tools",
"author": "Siddharth Sule",
"author_email": "siddharth.sule@manchester.ac.uk",
"download_url": "https://files.pythonhosted.org/packages/9b/1c/4011f7df7d3c2466527662c19704c0f9200dbed52e50caf3ff6f1201b5ca/labpartner_uom-1.0.8.tar.gz",
"platform": null,
"description": "# LabPartner - A Tool for Undergraduate Physics Students\n\n[![PyPI package](https://img.shields.io/badge/pip%20install-labpartner_uom-brightgreen)](https://pypi.org/project/labpartner_uom/) [![version number](https://img.shields.io/pypi/v/labpartner_uom?color=green&label=version)](https://github.com/SiddharthSule/labpartner_uom/releases) [![Actions Status](https://github.com/SiddharthSule/labpartner_uom/workflows/Test/badge.svg)](https://github.com/SiddharthSule/labpartner_uom/actions) [![License](https://img.shields.io/github/license/SiddharthSule/labpartner_uom)](https://github.com/SiddharthSule/labpartner_uom/blob/main/LICENSE)\n\nStruggling with Lab? Me too!\n\nOver the course of my undergraduate studies at the University of Manchester, UK, I had three years of lab. Now, as someone who teaches those labs alongside my PhD, I thought it would be useful to automate some of the more painful parts of lab, so the students can just focus on understanding the physics and assessing their results.\n\nThis Python is Package can:\n- Apply ~Linear and Quadratic~ **ANY** fit to Data, and Plot Results\n- Propagate Errors for all functions\n\nIt is important to acknowledge that there are other similar, very useful tools (OriginPro, LSFR, your own code). I just wanted to try making something that works as an all-in-one system, effectively acting as a Lab Partner!\n\n## Installation\n\nTo install this package, simply type:\n\n```bash\npip install labpartner_uom\n```\nPyPI might use labpartner-uom, but this command does the same. Someday I hope to remove the '_uom'!\n\n## Usage\n\n### Data Analysis and Plotting\n\nThere are a few presets which allow you to auto-analyse your results.\n\n```python\nimport labpartner_uom as lp\n\nlp.analyse(x, y, yerr, fit) # For data arrays\nlp.analyse_from_file(filename, fit) # For data in .csv files\n\n# Example with specific labels\nlp.analyse(t, d, derr, \"Quadratic\", xlabel=\"Time (s)\", ylabel=\"Distance (s)\")\n```\n\nThis should print the results of the fitting, as well save a .png and .pdf of the plot.\n\nOptions of fits include: Linear, Quadratic, Gaussian, Exponential, Logarithmic, Sine, Cosine and more! You can also add your own functions to fit:\n\n```python\nlp.analyse(x, y, yerr, \"a * exp(b * x) * sin(c * x) + d\")\n```\n\n### Error Propagation\n\nTo propagate errors, simply write up the function and the variables which have uncertainties.\n\n```python\nimport labpartner_uom as lp\nprop = lp.errorpropagator.propagate_error(func, vars)\n\n# Example\nprop = lp.errorpropagator.propagate_error(\"A*x**2 + B*y + C\", [\"x\", \"y\"])\n```\n\n### Examples\n\nI have given some full examples on how to use the code for a lab experiment. The first example contains a simple analysis, while the other is for free and forced oscillations, a lab I demonstrated.\n\nYou can find these examples [here](docs/examples/)\n\n### Advanced Usage\n\nThe guide above gives you a quick result. However, there is more for advanced users:\n- Customisation of Plots\n- Fitting without Errors\n\nYou can find more details on this in [more-stuff.md](docs/extended/more-stuff.md)\n\n\n---\nSiddharth Sule, 2024\n\nBased On Tom Chen's Example Package: https://github.com/tomchen/example_pypi_package\n",
"bugtrack_url": null,
"license": "",
"summary": "Python Package with tools for Undergraduate Physics Laboratory",
"version": "1.0.8",
"project_urls": {
"Bug Reports": "https://github.com/SiddharthSule/labpartner_uom/issues",
"Documentation": "https://github.com/SiddharthSule/labpartner_uom/docs",
"Homepage": "https://github.com/SiddharthSule/labpartner_uom",
"Source Code": "https://github.com/SiddharthSule/labpartner_uom"
},
"split_keywords": [
"physics",
"laboratory",
"undergraduate",
"tools"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "81e105c4f724b7fc5d0d4de1e871573139027a6cf7245f094e81a9bb6bcc4191",
"md5": "111d0ca78bbf91f99b6f8ece7944114f",
"sha256": "fbd7929ee4e1d33d96a23a86a0307134c2bff66a0c93a09477834959da64b572"
},
"downloads": -1,
"filename": "labpartner_uom-1.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "111d0ca78bbf91f99b6f8ece7944114f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 18971,
"upload_time": "2024-01-25T19:56:12",
"upload_time_iso_8601": "2024-01-25T19:56:12.561343Z",
"url": "https://files.pythonhosted.org/packages/81/e1/05c4f724b7fc5d0d4de1e871573139027a6cf7245f094e81a9bb6bcc4191/labpartner_uom-1.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b1c4011f7df7d3c2466527662c19704c0f9200dbed52e50caf3ff6f1201b5ca",
"md5": "d627eb0b370eab7241a27d5663fe2d6c",
"sha256": "e6a47ea708cbed4949bb50eb6e326aae86b939f5a2fdb97aed7a8acbb4750191"
},
"downloads": -1,
"filename": "labpartner_uom-1.0.8.tar.gz",
"has_sig": false,
"md5_digest": "d627eb0b370eab7241a27d5663fe2d6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 22067,
"upload_time": "2024-01-25T19:56:14",
"upload_time_iso_8601": "2024-01-25T19:56:14.411295Z",
"url": "https://files.pythonhosted.org/packages/9b/1c/4011f7df7d3c2466527662c19704c0f9200dbed52e50caf3ff6f1201b5ca/labpartner_uom-1.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-25 19:56:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SiddharthSule",
"github_project": "labpartner_uom",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "labpartner-uom"
}