Welcome to phuzzy’s documentation!¶
phuzzy¶
Fuzzy calculation in Python.
- Free software: MIT license
- Documentation: https://phuzzy.readthedocs.io.
Features¶
- TODO
Credits¶
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Installation¶
Stable release¶
To install phuzzy, run this command in your terminal:
$ pip install phuzzy
This is the preferred method to install phuzzy, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources¶
The sources for phuzzy can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/lepy/phuzzy
Or download the tarball:
$ curl -OL https://github.com/lepy/phuzzy/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Usage¶
To use phuzzy in a project:
import phuzzy
tn = phuzzy.TruncNorm(alpha0=[2, 3], alpha1=[], number_of_alpha_levels=15, name="t")
tri = phuzzy.Triangle(alpha0=[1, 4], alpha1=[2], number_of_alpha_levels=5)
f = tn + tri
print(f.df)
available shapes¶
Uniform¶
1 2 3 | import phuzzy.mpl as phm
uni = phm.Uniform(alpha0=[1, 4], number_of_alpha_levels=5, name="x")
uni.plot(show=True, filepath="/tmp/uniform.png", title=True)
|
Triangle¶
1 2 3 4 | import phuzzy.mpl as phm
tri = phm.Triangle(alpha0=[1, 4], alpha1=[2], number_of_alpha_levels=5)
tri.plot(show=False, filepath="/tmp/triangle.png", title=True)
|
Trapezoid¶
1 2 3 | import phuzzy.mpl as phm
trap = phm.Trapezoid(alpha0=[1, 5], alpha1=[2, 3], number_of_alpha_levels=5)
trap.plot(show=False, filepath="/tmp/trapezoid.png", title=True)
|
TruncNorm¶
1 2 3 | import phuzzy.mpl as phm
tn = phm.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="x")
tn.plot(show=False, filepath="/tmp/truncnorm.png", title=True)
|
TruncGenNorm¶
1 2 3 | import phuzzy.mpl as phm
tgn = phm.TruncGenNorm(alpha0=[1, 4], alpha1=[2, 3], number_of_alpha_levels=15, beta=3.)
tgn.plot(show=False, filepath="/tmp/truncgennorm.png", title=True)
|
Superellipse¶
1 2 3 | import phuzzy.mpl as phm
se = phm.Superellipse(alpha0=[-1, 2.], alpha1=None, m=1.0, n=.5, number_of_alpha_levels=17)
se.plot(show=True, filepath="/tmp/superellipse.png", title=True)
|
basic operations¶
Addition¶
1 2 3 4 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x + y
z.name = "x+y"
|
1 2 3 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
z = 3 + x
z = x + 3
|
Substraction¶
1 2 3 4 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x - y
z.name = "x-y"
|
1 2 3 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = 3 - x
z = x - 3
|
Multiplication¶
1 2 3 4 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x * y
z.name = "x*y"
|
1 2 3 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
z = 3 * x
z = x * 3
|
Division¶
1 2 3 4 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x / y
z.name = "x/y"
|
1 2 3 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
z = 3 / x
z = x / 3
|
Exponentiation¶
1 2 3 4 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
y = phuzzy.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="y")
z = x ** y
z.name = "x^y"
|
1 2 | x = phuzzy.Trapezoid(alpha0=[0, 4], alpha1=[2, 3], number_of_alpha_levels=5)
z = x**3
|
Absolute value¶
1 2 3 | x = phuzzy.Trapezoid(alpha0=[-1, 4], alpha1=[2, 3], number_of_alpha_levels=5)
z = abs(x)
z = x.abs()
|
Shapes¶
Uniform¶
1 2 3 | import phuzzy.mpl as phm
uni = phm.Uniform(alpha0=[1, 4], number_of_alpha_levels=5, name="x")
uni.plot(show=True, filepath="/tmp/uniform.png", title=True)
|
Triangle¶
1 2 3 4 | import phuzzy.mpl as phm
tri = phm.Triangle(alpha0=[1, 4], alpha1=[2], number_of_alpha_levels=5)
tri.plot(show=False, filepath="/tmp/triangle.png", title=True)
|
Trapezoid¶
1 2 3 | import phuzzy.mpl as phm
trap = phm.Trapezoid(alpha0=[1, 5], alpha1=[2, 3], number_of_alpha_levels=5)
trap.plot(show=False, filepath="/tmp/trapezoid.png", title=True)
|
TruncNorm¶
1 2 3 | import phuzzy.mpl as phm
tn = phm.TruncNorm(alpha0=[1, 3], number_of_alpha_levels=15, name="x")
tn.plot(show=False, filepath="/tmp/truncnorm.png", title=True)
|
TruncGenNorm¶
1 2 3 | import phuzzy.mpl as phm
tgn = phm.TruncGenNorm(alpha0=[1, 4], alpha1=[2, 3], number_of_alpha_levels=15, beta=3.)
tgn.plot(show=False, filepath="/tmp/truncgennorm.png", title=True)
|
Superellipse¶
1 2 3 | import phuzzy.mpl as phm
se = phm.Superellipse(alpha0=[-1, 2.], alpha1=None, m=1.0, n=.5, number_of_alpha_levels=17)
se.plot(show=True, filepath="/tmp/superellipse.png", title=True)
|
Plots¶
import phuzzy
from phuzzy.mpl import mix_mpl
import phuzzy.mpl.plots
x = phuzzy.TruncNorm(alpha0=[1, 2], name="x")
y = phuzzy.Triangle(alpha0=[3, 6], alpha1=[4], name="y")
mix_mpl(x)
x.plot(filepath="FuzzyNumber_plot.png")
Examples¶
Three-point bending¶
Simply supported beam with central load¶
What is the maximum deflection of a simple supported beam with central load, if there is an uncertainty of only 1% for all input parameter? The input parameter are load P, beam length L, beam width W, beam height H and young’s modulus E.

Three point bending test [wikipedia.org]
Code¶
import phuzzy as ph
number_of_alpha_levels = 31
# load P
P0 = 5000. # N
dP = 0.01 * P0 # N
P = ph.Triangle(alpha0=[P0 - dP, P0 + dP], alpha1=[P0], name="P", number_of_alpha_levels=number_of_alpha_levels)
# dimensions L, W, H
W0 = 50 # mm
H0 = 100 # mm
L0 = 2000 # mm
dW = 0.01 * W0 # mm
dH = 0.01 * H0 # mm
dL = 0.01 * L0 # mm
L = ph.Triangle(alpha0=[L0 - dL, L0 + dL], alpha1=[L0], name="L", number_of_alpha_levels=number_of_alpha_levels)
W = ph.Triangle(alpha0=[W0 - dW, W0 + dW], alpha1=[W0], name="W", number_of_alpha_levels=number_of_alpha_levels)
H = ph.Triangle(alpha0=[H0 - dH, H0 + dH], alpha1=[H0], name="H", number_of_alpha_levels=number_of_alpha_levels)
# material
E0 = 30000. # N/mm2
dE = 0.1 * E0 # N/mm2
E = ph.TruncNorm(alpha0=[E0 - dE, E0 + dE], alpha1=[E0], name="E", number_of_alpha_levels=number_of_alpha_levels)
I0 = W0 * H0 ** 3 / 12.
w0 = P0 * L0 ** 3 / (48 * E0 * I0)
print("I0 = {:.4g} mm^4".format(I0))
# I0 = 4.167e+06 mm^4
print("w0 = {:.4g} mm".format(w0))
# w0 = 6.667 mm
I = W * H** 3 / 12.
I.name = "I"
w = P * L ** 3 / (48 * E * I)
w.name = r"P L^3 / (48 EI)"
print("I = {} mm^4".format(I))
# I = FuzzyNumber(W*H^3/12.0:[[4002483.375, 4335850.041666667], [4166666.6666666665, 4166666.6666666665]]) mm^4
print("w = {} mm".format(w))
# w = FuzzyNumber(P*L^3/E*48*W*H^3/12.0:[[5.594629603627992, 8.024370049019725], [6.666666666666667, 6.666666666666667]]) mm
w_mean = w.mean()
dw_l = w_mean - w.min()
dw_r = w.max() - w_mean
print("w = {:.4g} mm (- {:.4g}|+ {:.4g})".format(w_mean, dw_l, dw_r))
# w = 6.703 mm (- 1.109|+ 1.321)
print("w = {:.4g} mm [{:.4g},{:.4g}]".format(w_mean, w.min(), w.max()))
# w = 6.703 mm [5.595,8.024]
Parameter¶
phuzzy package¶
-
class
phuzzy.
Analysis
(**kwargs)[source]¶ Bases:
object
-
__dict__
= dict_proxy({'add_designvar': <function add_designvar>, '__module__': 'phuzzy', '__repr__': <function __str__>, '__dict__': <attribute '__dict__' of 'Analysis' objects>, '__weakref__': <attribute '__weakref__' of 'Analysis' objects>, 'designvars': <property object>, '__str__': <function __str__>, 'add_designvars': <function add_designvars>, '__init__': <function __init__>, '__doc__': None})¶
-
__module__
= 'phuzzy'¶
-
__repr__
()¶ x.__str__() <==> str(x)
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_designvar
(designvar)[source]¶ add design variable to doe
Parameters: designvar – design variable Returns: None
-
add_designvars
(designvars)[source]¶ add design variables to doe
Parameters: designvars – list of design variables Returns: None
-
designvars
¶ returns all design variables of doe
Returns: dict of designvars
-
phuzzy.shapes package¶
-
class
phuzzy.shapes.
FuzzyNumber
(**kwargs)[source]¶ Bases:
object
convex fuzzy number
-
__abs__
()[source]¶ apply abs operator to a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__add__
(other)[source]¶ adds a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__dict__
= dict_proxy({'cdf': <function cdf>, 'ppf': <function ppf>, 'get_shape': <function get_shape>, '__str__': <function __str__>, 'export_csv': <function export_csv>, '__rsub__': <function __rsub__>, '__rdiv__': <function __rdiv__>, '__rmul__': <function __rmul__>, '__lt__': <function __lt__>, '__weakref__': <attribute '__weakref__' of 'FuzzyNumber' objects>, 'make_convex': <function make_convex>, '__rpow__': <function __rpow__>, 'convert_df': <function convert_df>, 'get_01': <property object>, '_get_df': <function _get_df>, '__abs__': <function __abs__>, 'defuzzification_centroid2': <function defuzzification_centroid2>, 'from_data': <classmethod object>, '__doc__': 'convex fuzzy number', '__sub__': <function __sub__>, 'df': <property object>, '_set_df': <function _set_df>, 'defuzzification': <function defuzzification>, 'defuzzification_centroid': <function defuzzification_centroid>, 'from_results': <classmethod object>, '__pow__': <function __pow__>, '__gt__': <function __gt__>, 'copy': <function copy>, '__eq__': <function __eq__>, 'from_str': <classmethod object>, 'has_zero': <function has_zero>, 'defuzzification_alpha_one': <function defuzzification_alpha_one>, '__hash__': None, '_get_cls': <staticmethod object>, 'mean': <function mean>, 'discretize': <function discretize>, '__module__': 'phuzzy.shapes', '__radd__': <function __radd__>, 'rvs': <function rvs>, '__dict__': <attribute '__dict__' of 'FuzzyNumber' objects>, '__truediv__': <function __truediv__>, 'defuzzification_mean': <function defuzzification_mean>, '_get_number_of_alpha_levels': <function _get_number_of_alpha_levels>, '__init__': <function __init__>, 'alpha0': <property object>, 'alpha1': <property object>, '__contains__': <function __contains__>, '_disretize_range': <function _disretize_range>, 'defuzzification_p50': <function defuzzification_p50>, 'abs': <function abs>, '__neg__': <function __neg__>, '__ne__': <function __ne__>, 'get_alpha_from_value': <function get_alpha_from_value>, 'import_csv': <function import_csv>, 'max': <function max>, '_unify': <function _unify>, 'update': <function update>, '__add__': <function __add__>, 'pdf': <function pdf>, 'alpha': <function alpha>, 'min': <function min>, 'number_of_alpha_levels': <property object>, 'to_str': <function to_str>, '__div__': <function __truediv__>, '__mul__': <function __mul__>, 'get_01_str': <property object>, '__repr__': <function __repr__>, '_set_number_of_alpha_levels': <function _set_number_of_alpha_levels>})¶
-
__div__
(other)¶ divide by a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__hash__
= None¶
-
__module__
= 'phuzzy.shapes'¶
-
__mul__
(other)[source]¶ multiply with a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__neg__
()[source]¶ apply unary neg operator to a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__pow__
(other)[source]¶ apply power of a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__rpow__
(other)[source]¶ apply exponent of a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__sub__
(other)[source]¶ substract a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__truediv__
(other)[source]¶ divide by a fuzzy number
Parameters: other – phuzzy.FuzzyNumber Returns: fuzzy number
-
__weakref__
¶ list of weak references to the object (if defined)
-
alpha0
¶ row for alpha=0
-
alpha1
¶ row for alpha=1
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
df
¶ number of alpha levels
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
export_csv
(filepath=None)[source]¶ export alpha levels to csv
Parameters: filepath – csv file path Returns:
-
classmethod
from_data
(**kwargs)[source]¶ instantiate fuzzy number from attributes
Parameters: kwargs – Return type: phuzzy.FuzzyNumber or derived object Returns: fuzzy number
-
classmethod
from_results
(df_res, name=None, number_of_alpha_levels=11)[source]¶ create FuzzyNumber from DataFrame(“alpha”, “res”)
Parameters: df – DataFrame with columns=[“alpha”, “res”] Returns: FuzzyNumber
-
get_01
¶ get alpha=0 and alpha=1 values
Returns: [[a0_l, a0_r], [a1_l, a1_r]]
-
get_01_str
¶ get alpha=0 and alpha=1 values
Returns: [[a0_l, a0_r], [a1_l, a1_r]]
-
get_alpha_from_value
(x)[source]¶ get alpha values from given x values
Parameters: x – x values Returns: alpha values
-
import_csv
(fh)[source]¶ load alpha levels from csv
Parameters: fh – csv file path or file handle Returns: alpha level dataframe
-
number_of_alpha_levels
¶ number of alpha levels
-
ppf
(x, **kwargs)[source]¶ Percent point function (inverse of cdf-percentiles).
Parameters: - x – x values
- n – number of integration points
Returns: y
-
-
class
phuzzy.shapes.
Trapezoid
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
-
class
phuzzy.shapes.
Triangle
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
-
class
phuzzy.shapes.
Uniform
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
triange fuzzy number
-
__module__
= 'phuzzy.shapes'¶
-
cdf
(x, **kwargs)[source]¶ Cumulative distribution function
Parameters: - x – x values
- n – number of integration points
Returns: y
-
phuzzy.shapes.superellipse module¶
superelliptic fuzzy number
Superellipse(alpha0=[-1, 2], alpha1=None, m=1, n=.5, number_of_alpha_levels=15)
-
class
phuzzy.shapes.superellipse.
Superellipse
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
superelliptic fuzzy number
-
__init__
(**kwargs)[source]¶ superelliptic fuzzy number
Parameters: kwargs – Superellipse(alpha0=[1, 2], alpha1=None, m=2, n=None, number_of_alpha_levels=17)
-
__module__
= 'phuzzy.shapes.superellipse'¶
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
phuzzy.shapes.truncnorm module¶
Normal distibuted membership function
TruncNorm(alpha0=[1, 3], alpha1=None, number_of_alpha_levels=15)
TruncGenNorm(alpha0=[1, 4], alpha1=None, number_of_alpha_levels=15, beta=5)
-
class
phuzzy.shapes.truncnorm.
TruncGenNorm
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
Truncated generalized normal distibuted membership function
-
__init__
(**kwargs)[source]¶ create a TruncNorm object
Parameters: kwargs – TruncGenNorm(alpha0=[1, 3], alpha1=None, number_of_alpha_levels=17, beta=3)
-
__module__
= 'phuzzy.shapes.truncnorm'¶
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
distr
¶
-
loc
¶
-
mean
¶
-
scale
¶
-
std
¶
-
-
class
phuzzy.shapes.truncnorm.
TruncNorm
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
Normal distibuted membership function
-
__init__
(**kwargs)[source]¶ create a TruncNorm object
Parameters: kwargs – TruncNorm(alpha0=[1, 3], alpha1=None, number_of_alpha_levels=17)
-
__module__
= 'phuzzy.shapes.truncnorm'¶
-
discretize
(alpha0, alpha1, alpha_levels)[source]¶ discretize shape function
Parameters: - alpha0 – range at alpha=0
- alpha1 – range at alpha=1
- alpha_levels – number of alpha levels
Returns: None
-
distr
¶ calculate truncated normal distribution
Returns: distribution object
-
loc
¶ mean value
Return type: float Returns: mean value aka location
-
mean
¶ mean value
Return type: float Returns: mean value aka location
-
scale
¶ standard deviation
Return type: float Returns: standard deviation
-
std
¶ standard deviation
Return type: float Returns: standard deviation
-
phuzzy.mpl module¶
-
class
phuzzy.mpl.
FuzzyNumber
(**kwargs)[source]¶ Bases:
phuzzy.shapes.FuzzyNumber
,phuzzy.mpl.MPL_Mixin
Uniform fuzzy number with matplotlib mixin
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
MPL_Mixin
[source]¶ -
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
Superellipse
(**kwargs)[source]¶ Bases:
phuzzy.shapes.superellipse.Superellipse
,phuzzy.mpl.MPL_Mixin
Superellipse fuzzy number with matplotlib mixin
-
__init__
(**kwargs)[source]¶ superelliptic fuzzy number
Parameters: kwargs – Superellipse(alpha0=[1, 2], alpha1=None, m=2, n=None, number_of_alpha_levels=17)
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
Trapezoid
(**kwargs)[source]¶ Bases:
phuzzy.shapes.Trapezoid
,phuzzy.mpl.MPL_Mixin
Trapezoid fuzzy number with matplotlib mixin
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
Triangle
(**kwargs)[source]¶ Bases:
phuzzy.shapes.Triangle
,phuzzy.mpl.MPL_Mixin
Triangle fuzzy number with matplotlib mixin
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
TruncGenNorm
(**kwargs)[source]¶ Bases:
phuzzy.shapes.truncnorm.TruncGenNorm
,phuzzy.mpl.MPL_Mixin
Truncates general normal fuzzy number with matplotlib mixin
-
__init__
(**kwargs)[source]¶ create a TruncNorm object
Parameters: kwargs – TruncGenNorm(alpha0=[1, 3], alpha1=None, number_of_alpha_levels=17, beta=3)
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
TruncNorm
(**kwargs)[source]¶ Bases:
phuzzy.shapes.truncnorm.TruncNorm
,phuzzy.mpl.MPL_Mixin
TruncNorm fuzzy number with matplotlib mixin
-
__init__
(**kwargs)[source]¶ create a TruncNorm object
Parameters: kwargs – TruncNorm(alpha0=[1, 3], alpha1=None, number_of_alpha_levels=17)
-
__module__
= 'phuzzy.mpl'¶
-
-
class
phuzzy.mpl.
Uniform
(**kwargs)[source]¶ Bases:
phuzzy.shapes.Uniform
,phuzzy.mpl.MPL_Mixin
Uniform fuzzy number with matplotlib mixin
-
__module__
= 'phuzzy.mpl'¶
-
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
Types of Contributions¶
Report Bugs¶
Report bugs at https://github.com/lepy/phuzzy/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your local setup that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Fix Bugs¶
Look through the GitHub issues for bugs. Anything tagged with “bug” and “help wanted” is open to whoever wants to implement it.
Implement Features¶
Look through the GitHub issues for features. Anything tagged with “enhancement” and “help wanted” is open to whoever wants to implement it.
Write Documentation¶
phuzzy could always use more documentation, whether as part of the official phuzzy docs, in docstrings, or even on the web in blog posts, articles, and such.
Submit Feedback¶
The best way to send feedback is to file an issue at https://github.com/lepy/phuzzy/issues.
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
- Remember that this is a volunteer-driven project, and that contributions are welcome :)
Get Started!¶
Ready to contribute? Here’s how to set up phuzzy for local development.
Fork the phuzzy repo on GitHub.
Clone your fork locally:
$ git clone git@github.com:your_name_here/phuzzy.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:
$ mkvirtualenv phuzzy $ cd phuzzy/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
When you’re done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:
$ flake8 phuzzy tests $ python setup.py test or py.test $ tox
To get flake8 and tox, just pip install them into your virtualenv.
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a pull request through the GitHub website.
Pull Request Guidelines¶
Before you submit a pull request, check that it meets these guidelines:
- The pull request should include tests.
- If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst.
- The pull request should work for Python 2.7, 3.4, 3.5 and 3.6, and for PyPy. Check https://travis-ci.org/lepy/phuzzy/pull_requests and make sure that the tests pass for all supported Python versions.
Deploying¶
A reminder for the maintainers on how to deploy. Make sure all your changes are committed (including an entry in HISTORY.rst). Then run:
$ git push
$ git push --tags
Travis will then deploy to PyPI if tests pass.
History¶
0.4.0 (2018-04-13)¶
- First release on PyPI.
0.5.0 (2018-04-16)¶
- rename FuzzyNumber.df.columns = [“alpha”, “l”, “r”]
- add operators __add__
- add operators __sub__
- add operators __mul__
- add operators __div__
0.6.0 (2018-04-19)¶
- add operators __radd__, __rsub__, __rmul__, __rdiv__, __truediv__
- add operators __neg__, __abs__, __min__, __max__, __mean__
- add operators __lt__, __gt__, __eq__, __contain__
0.7.0 (2018-04-24)¶
- add plots
- add approximated function evaluation
lsdyna