mqr-quality
-----------
Tools for learning and practising manufacturing quality with python.
Installation
------------
`pip install mqr-quality`
Import the package using:
`import mqr`
See `examples` directory in the source code for notebooks with sample code.
Introduction
------------
This library is a toolkit for manufacturing quality activities using python.
Most of the tools are related to quite general statistical methods that are
commonly used in fields outside manufacturing.
Most of this library falls into one of two categories:
1. **Code that automates commonly used plots and tables.** These are elementary,
in that they don't require much special knowledge of the subject area and are
easy to interpret, but they require an understanding of libraries like numpy,
pandas, matplotlib, etc, and quite a few lines of boilerplate code. The goal
of including these in the library is to make common plotting and descriptive
activities fast.
2. **Code that provides a uniform interface to functionality in other libraries.**
Existing libraries provide good coverage of hypothesis tests, particularly
numpy, scipy and statsmodels. However, because the tests come from statistical
literature, and are organised varously by name, purpose or application, they
can be difficult to navigate, especially for students with limited experience
with python. Further, each library has a different interface. The purpose of
wrapping these tools is (1) to organise tests by goal or application (eg.
tests on means, tests on proportions), and (2) to provide a uniform interface
that is easy for students to navigate and use in jupyter notebooks. The `doe`
module is another example. It provides an interface for designing experiments.
It can be used with `pyDOE3` (and provides convenience functions for that),
but also provides extra features that help with the practicalties of designing
experiments, collecting and analysing data. For example, experimental designs
can be easily built up in a few lines of code by composing smaller sets of
runs.
3. **Several example notebooks showing how to do common quality tasks.** The
examples (in the `examples` directory) provide a summary of the functionality
and arrangement of this library, and also demonstrations of some common
activities in quality improvement. For example, the `basic-inference` notebook
shows how the interface to hypothesis tests are arranged, while the `probability`
notebook gives examples of calculating useful probabilities using the very
good scipy library.
Overall, the code is intended to reduce the burden of understanding python and
its various libraries, so the user can focus on understanding processes,
designing experiments, and analysing results.
**A note on wrapped code**: excluding a few tests that we implemented (because
we couldn't find an existing implementation), the confidence interval code and
hypothesis tests call through to other libraries. We think there are benefits to
wrapping the interfaces when using a notebook. However, if you use these tests
outside of a notebook, for example in scripts or automated routines, or if you
need more advanced functionality that we didn't expose in our interface, you
should look up the original functions and then call the statistical libraries
directly.
Code Organisation
-----------------
The code is organised into the following modules.
- `summary`: summary statistics
- `process`: describing and presenting processes, including capability
- `inference`: basic confidence intervals, hypothesis testing and sample size
calculation
- `anova`: tools for working with ANOVA calculations and results (statsmodels
provides the regression)
- `msa`: measurement system analysis; an automatically constructed ANOVA for
gauge reproducibility and repeatability studies
- `control`: plots for showing processes under statistical control
- `doe`: tools for designing experiments
- `plot`: various plots (below)
The plotting module has routines for generating a range of plots. The plots are
mostly arranged like this:
- `plot.Figure` (context manager): create subplots (calls `matplotlib.pyplot.subplots`)
- `plot.confint` (function): visually show the process of an hypothesis test on
the mean of a data set
- `plot.ishikawa` (function): draw an Ishikawa (fishbone) diagram
- `plot.summary` (function): draw a histogram, box plot and confidence interval
with shared x-axes
- `plot.grouped_df` (function): draw data from a dataframe grouped by column and
drawn adjacent to each other, left to right
- `plot.control` (module): draw X-bar and R charts
- `plot.correlation` (module): plot a detailed correlation matrix, including
histograms, scatter plots with best-fit lines, and confidence intervals on coefficients
- `plot.msa` (module): plot the results of measurement system analysis, including
a GRR summary
- `plot.probplot` (module): probability plots of subsets of data, with shared
summary statistics
- `plot.process` (module): graphically represent a process, including capability
- `plot.regression` (module): draw residuals from a regression analysis
Inference module
----------------
The inference module is mostly an interface to other libraries. The module contains
functions that calculate **sample size**, **confidence intervals** and
**hypothesis tests**.
The functions are arranged with the following naming scheme.
Parametric tests:
* sample size: `mqr.inference.<statistic>.size_<sample>(...)`
* confidence interval: `mqr.inference.<statistic>.confint_<sample>(...)`
* hypothesis test: `mqr.inference.<statistic>.test_<sample>(...)`
Non-parametric tests have the same form, but are in the `nonparametric` module:
* hypothesis test: `mqr.inference.<statistic>.test_<sample>(...)`
* etc.
Where:
* `<statistic>` is the statistic of interest, for example, "mean", "correlation"
coefficient, etc.
* `<sample>` is a description of the samples involved in the calculation, for
example "1sample", "nsample". Some routines don't have a sample description.
For example, hypothesis tests that deal with the difference between the means of
two unpaired samples are at:
`mqr.inference.mean.test_2sample(...)`
Plotting module
---------------
The library never renders a plot automatically, but instead expects users to
provide axes to draw into. This choice means the plotting libraries have no
side-effects, and it also allow the to change layout and plotting backend easily.
In the example notebooks, plots are wrapped in a `with plot.Figure(...)` context
manager, which creates figures, shows them, then closes them automatically. The
`(fig, ax)` that the context manager creates is the return value of
`matplotlib.pyplot.subplots(...)`. The context manager reduces the boilerplate
code required for the user (especially those unfamiliar with matplotlib) to
show a plot, and helps with a few other activities, like changing backends and
saving files. It is possilbe, for example, to quickly switch from showing plots
in a notebook to writing them into a backend that produces images for Word or
PGF/TikZ for LaTeX.
Of course, you can always create and manage axes directly, by calling
`ax, fig = matplotlib.pyplot.subplots(...)` and passing `ax` to the plotting
routines.
License
-------
This package is provided under the BSD License (3-clause).
Credit
------
Copyright (c) 2024 Nikolas Crossan, Kevin Otto
Supported by the University of Melbourne
Department of Mechanical Engineering
Raw data
{
"_id": null,
"home_page": null,
"name": "mqr-quality",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "mqr developers <mqr.python@gmail.com>",
"keywords": "quality, manufacturing, six sigma, design of experiments, dmaic, anova, grr, msa",
"author": "Nikolas Crossan, Kevin Otto",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f7/08/d0111d21441fac2a04318c397230e96cdf9daea250da785ebe011944be94/mqr_quality-0.4.6.tar.gz",
"platform": null,
"description": "mqr-quality\n-----------\nTools for learning and practising manufacturing quality with python.\n\nInstallation\n------------\n`pip install mqr-quality` \n\nImport the package using: \n`import mqr`\n\nSee `examples` directory in the source code for notebooks with sample code.\n\nIntroduction\n------------\nThis library is a toolkit for manufacturing quality activities using python.\nMost of the tools are related to quite general statistical methods that are\ncommonly used in fields outside manufacturing.\n\nMost of this library falls into one of two categories:\n1. **Code that automates commonly used plots and tables.** These are elementary,\n in that they don't require much special knowledge of the subject area and are\n easy to interpret, but they require an understanding of libraries like numpy,\n pandas, matplotlib, etc, and quite a few lines of boilerplate code. The goal\n of including these in the library is to make common plotting and descriptive\n activities fast.\n2. **Code that provides a uniform interface to functionality in other libraries.**\n Existing libraries provide good coverage of hypothesis tests, particularly\n numpy, scipy and statsmodels. However, because the tests come from statistical\n literature, and are organised varously by name, purpose or application, they\n can be difficult to navigate, especially for students with limited experience\n with python. Further, each library has a different interface. The purpose of\n wrapping these tools is (1) to organise tests by goal or application (eg.\n tests on means, tests on proportions), and (2) to provide a uniform interface\n that is easy for students to navigate and use in jupyter notebooks. The `doe`\n module is another example. It provides an interface for designing experiments.\n It can be used with `pyDOE3` (and provides convenience functions for that),\n but also provides extra features that help with the practicalties of designing\n experiments, collecting and analysing data. For example, experimental designs\n can be easily built up in a few lines of code by composing smaller sets of\n runs.\n3. **Several example notebooks showing how to do common quality tasks.** The\n examples (in the `examples` directory) provide a summary of the functionality\n and arrangement of this library, and also demonstrations of some common\n activities in quality improvement. For example, the `basic-inference` notebook\n shows how the interface to hypothesis tests are arranged, while the `probability`\n notebook gives examples of calculating useful probabilities using the very\n good scipy library.\n\nOverall, the code is intended to reduce the burden of understanding python and\nits various libraries, so the user can focus on understanding processes,\ndesigning experiments, and analysing results.\n\n**A note on wrapped code**: excluding a few tests that we implemented (because\nwe couldn't find an existing implementation), the confidence interval code and\nhypothesis tests call through to other libraries. We think there are benefits to\nwrapping the interfaces when using a notebook. However, if you use these tests\noutside of a notebook, for example in scripts or automated routines, or if you\nneed more advanced functionality that we didn't expose in our interface, you\nshould look up the original functions and then call the statistical libraries\ndirectly.\n\nCode Organisation\n-----------------\nThe code is organised into the following modules.\n\n- `summary`: summary statistics\n- `process`: describing and presenting processes, including capability\n- `inference`: basic confidence intervals, hypothesis testing and sample size\n calculation\n- `anova`: tools for working with ANOVA calculations and results (statsmodels\n provides the regression)\n- `msa`: measurement system analysis; an automatically constructed ANOVA for\n gauge reproducibility and repeatability studies\n- `control`: plots for showing processes under statistical control\n- `doe`: tools for designing experiments\n- `plot`: various plots (below)\n\nThe plotting module has routines for generating a range of plots. The plots are\nmostly arranged like this:\n\n- `plot.Figure` (context manager): create subplots (calls `matplotlib.pyplot.subplots`)\n- `plot.confint` (function): visually show the process of an hypothesis test on\n the mean of a data set\n- `plot.ishikawa` (function): draw an Ishikawa (fishbone) diagram\n- `plot.summary` (function): draw a histogram, box plot and confidence interval\n with shared x-axes\n- `plot.grouped_df` (function): draw data from a dataframe grouped by column and\n drawn adjacent to each other, left to right\n- `plot.control` (module): draw X-bar and R charts\n- `plot.correlation` (module): plot a detailed correlation matrix, including\n histograms, scatter plots with best-fit lines, and confidence intervals on coefficients\n- `plot.msa` (module): plot the results of measurement system analysis, including\n a GRR summary\n- `plot.probplot` (module): probability plots of subsets of data, with shared\n summary statistics\n- `plot.process` (module): graphically represent a process, including capability\n- `plot.regression` (module): draw residuals from a regression analysis\n\nInference module\n----------------\nThe inference module is mostly an interface to other libraries. The module contains\nfunctions that calculate **sample size**, **confidence intervals** and\n**hypothesis tests**.\n\nThe functions are arranged with the following naming scheme. \nParametric tests:\n* sample size: `mqr.inference.<statistic>.size_<sample>(...)`\n* confidence interval: `mqr.inference.<statistic>.confint_<sample>(...)`\n* hypothesis test: `mqr.inference.<statistic>.test_<sample>(...)`\n\nNon-parametric tests have the same form, but are in the `nonparametric` module:\n* hypothesis test: `mqr.inference.<statistic>.test_<sample>(...)`\n* etc.\n\nWhere:\n* `<statistic>` is the statistic of interest, for example, \"mean\", \"correlation\"\n coefficient, etc.\n* `<sample>` is a description of the samples involved in the calculation, for\n example \"1sample\", \"nsample\". Some routines don't have a sample description.\n\nFor example, hypothesis tests that deal with the difference between the means of\ntwo unpaired samples are at: \n`mqr.inference.mean.test_2sample(...)`\n\nPlotting module\n---------------\nThe library never renders a plot automatically, but instead expects users to\nprovide axes to draw into. This choice means the plotting libraries have no\nside-effects, and it also allow the to change layout and plotting backend easily.\n\nIn the example notebooks, plots are wrapped in a `with plot.Figure(...)` context\nmanager, which creates figures, shows them, then closes them automatically. The\n`(fig, ax)` that the context manager creates is the return value of\n`matplotlib.pyplot.subplots(...)`. The context manager reduces the boilerplate\ncode required for the user (especially those unfamiliar with matplotlib) to\nshow a plot, and helps with a few other activities, like changing backends and\nsaving files. It is possilbe, for example, to quickly switch from showing plots\nin a notebook to writing them into a backend that produces images for Word or\nPGF/TikZ for LaTeX.\n\nOf course, you can always create and manage axes directly, by calling\n`ax, fig = matplotlib.pyplot.subplots(...)` and passing `ax` to the plotting\nroutines.\n\nLicense\n-------\nThis package is provided under the BSD License (3-clause).\n\nCredit\n------\nCopyright (c) 2024 Nikolas Crossan, Kevin Otto\n\nSupported by the University of Melbourne \nDepartment of Mechanical Engineering\n",
"bugtrack_url": null,
"license": null,
"summary": "Manufacturing quality improvement toolkit",
"version": "0.4.6",
"project_urls": null,
"split_keywords": [
"quality",
" manufacturing",
" six sigma",
" design of experiments",
" dmaic",
" anova",
" grr",
" msa"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2db149a3d54542d908d9d83d1e43ecb00d941d67e1b864a71462d43fde33d114",
"md5": "a1f62eba0d2b96ce40191dc23b15e152",
"sha256": "cc4b92a084cba4bec9ae78f1e125122709a204cf68bb115b2f1e54731e411ed3"
},
"downloads": -1,
"filename": "mqr_quality-0.4.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a1f62eba0d2b96ce40191dc23b15e152",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 96214,
"upload_time": "2024-09-06T04:33:13",
"upload_time_iso_8601": "2024-09-06T04:33:13.672497Z",
"url": "https://files.pythonhosted.org/packages/2d/b1/49a3d54542d908d9d83d1e43ecb00d941d67e1b864a71462d43fde33d114/mqr_quality-0.4.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f708d0111d21441fac2a04318c397230e96cdf9daea250da785ebe011944be94",
"md5": "9f04a6aa2d89d4be4f55880f2c65c8c1",
"sha256": "42d197cabffc6a133ec742cd67e6ca0b17fb4cc0873734dae8a50a33aa2cdace"
},
"downloads": -1,
"filename": "mqr_quality-0.4.6.tar.gz",
"has_sig": false,
"md5_digest": "9f04a6aa2d89d4be4f55880f2c65c8c1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 75856,
"upload_time": "2024-09-06T04:33:15",
"upload_time_iso_8601": "2024-09-06T04:33:15.139282Z",
"url": "https://files.pythonhosted.org/packages/f7/08/d0111d21441fac2a04318c397230e96cdf9daea250da785ebe011944be94/mqr_quality-0.4.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 04:33:15",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mqr-quality"
}