Skip to content

Commit

Permalink
Better readme, plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlynybbled committed Nov 29, 2019
1 parent 83fad6a commit 2441971
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 4 deletions.
Binary file added images/example3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manufacturing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

__all__ = ['calc_cpk', 'show_cpk']

__version__ = '0.1.0'
__version__ = '0.1.1'
7 changes: 5 additions & 2 deletions manufacturing/visual.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,18 @@ def show_cpk(data: (List[int], List[float], pd.Series, np.array),

strings = [f'Cpk = {cpk:.02f}']

strings.append(f'$\mu = {mean:.3g}$')
strings.append(f'$\sigma = {std:.3g}$')

if lower_percent_text:
strings.append(lower_percent_text)
if higher_percent_text:
strings.append(higher_percent_text)

props = dict(boxstyle='round', facecolor='white', alpha=0.75, edgecolor='grey')
ax.text(right - (right - left) * 0.05, 0.8 * top, '\n'.join(strings), bbox=props, ha='right')
ax.text(right - (right - left) * 0.05, 0.85 * top, '\n'.join(strings), bbox=props, ha='right', va='top')

ax.legend(loc='center right')
ax.legend(loc='lower right')

if show:
plt.show()
Expand Down
44 changes: 43 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,51 @@

To provide analysis tools and metrics useful in manufacturing environments.

# Installation

## From `setup.py`

Clone this repository and install into your python environment using `setuptools`:

$ git clone https://github.com/slightlynybbled/manufacturing
$ cd manufacturing
$ python setup.py install

## From Wheel File

Download the wheel file and install from pip:

~/downloads $ python -m pip install manufacturing-X.X.X-py3-none-any.whl

Of course, the `X.X.X` will be replaced with the version that you are looking at.

# Usage

todo
## Visualizations with Jupyter Notebooks

Visualizations will return a `matplotlib.Figure`; therefore, if you want to embed
an image into a jupyter notebook, you will need to use a semicolon at the end of
the function call in order to not have a double-image.

data = np.random.normal(0, 1, size=30) # generate some data
manufacturing.show_cpk(data, lower_spec_limit=-2, upper_spec_limit=2); # show the plot

Note the trailing semicolon on the second statement!

## Cpk Visualization

The most useful feature of the `manufacturing` package is the visualization of Cpk.
As hinted previously, the `show_cpk()` function is the primary method for display of
Cpk visual information. First, get your data into a `list`, `numpy.array`, or
`pandas.Series`; then supply that data, along with the `lower_spec_limit` and
`upper_spec_limit` into the `show_cpk()` function.

manufacturing.show_cpk(data, lower_spec_limit=-2, upper_spec_limit=2)

![Screenshot](images/example3.png)

In this example, it appears that the manufacturing processes are not up to the task of
making consistent product within the specified limits.

# Features

Expand Down

0 comments on commit 2441971

Please sign in to comment.