Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Oct 17, 2021
1 parent 80ef58a commit 7aed5d8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion benfordslaw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = 'Erdogan Tasksen'
__email__ = 'erdogant@gmail.com'
__version__ = '1.0.3'
__version__ = '1.0.4'

# module level doc-string
__doc__ = """
Expand Down
5 changes: 4 additions & 1 deletion benfordslaw/benfordslaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def fit(self, X):

# Compute Pvalues
if self.method=='chi2':
tstats, Praw = chisquare(counts_emp, f_exp=counts_exp)
try:
tstats, Praw = chisquare(counts_emp, f_exp=counts_exp)
except:
raise Exception('The relative tolerance of the chisquare test is not reached. Try using another method such as "method=ks". This is not a bug but a feature: "https://github.com/scipy/scipy/issues/13362" ')
elif self.method=='ks':
tstats, Praw = ks_2samp(counts_emp, counts_exp)
else:
Expand Down
5 changes: 3 additions & 2 deletions benfordslaw/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
# %%
import numpy as np
from benfordslaw import benfordslaw
bl = benfordslaw(alpha=0.05)
bl = benfordslaw(alpha=0.05, method='chi2')
x = np.linspace(0,1000,1001)
x = np.append(x,[1,1,1,1,1,1,])
x = np.append(x,[1,1,1,1,1,1])
isben2 = bl.fit(x)

print(f"isben2 {isben2}")
print(f"P_significant: {isben2['P_significant']}")
if not isben2['P_significant']:
Expand Down
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sphinx_rtd_theme
rst2pdf
sphinx
pytest
git+git://github.com/SuperKogito/sphinxcontrib-pdfembed

0 comments on commit 7aed5d8

Please sign in to comment.