Skip to content

Commit

Permalink
Merge 775b877 into ec7600e
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmorrow committed Jul 17, 2018
2 parents ec7600e + 775b877 commit 8f51916
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 13 deletions.
Binary file modified docs/img/sci_analysis_main_39_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/sci_analysis_main_43_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/img/sci_analysis_main_45_0.png
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 docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Now, sci-analysis should be ready to use. Try the following code:
```python
np.random.seed(987654321)
data = st.norm.rvs(size=1000)
analyze(data)
analyze(xdata=data)
```


Expand Down
8 changes: 4 additions & 4 deletions docs/sci_analysis_main.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sci_analysis.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: sci-analysis
Version: 2.1.1rc2
Version: 2.1.1
Summary: An easy to use and powerful python-based data exploration and analysis tool
Home-page: https://github.com/cmmorrow/sci-analysis
Author: chris morrow
Expand Down
1 change: 1 addition & 0 deletions sci_analysis.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ sci_analysis/graphs/vector.py
sci_analysis/preferences/__init__.py
sci_analysis/preferences/preferences.py
sci_analysis/test/__init__.py
sci_analysis/test/base.py
sci_analysis/test/test_analyze.py
sci_analysis/test/test_anova.py
sci_analysis/test/test_cat_statistics.py
Expand Down
18 changes: 12 additions & 6 deletions sci_analysis/graphs/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,12 @@ def calc_fit(self):
"""
x = self._data.data
y = self._data.other
p = polyfit(x, y, 1, full=True)
fit = polyval(p[0], x)
return (x.min(), x.max()), (fit.min(), fit.max())
p = polyfit(x, y, 1)
fit = polyval(p, x)
if p[0] > 0:
return (x.min(), x.max()), (fit.min(), fit.max())
else:
return (x.min(), x.max()), (fit.max(), fit.min())

def draw(self):
"""
Expand Down Expand Up @@ -462,9 +465,12 @@ def calc_fit(x, y):
fit_coordinates : list
A list of the min and max fit points.
"""
p = polyfit(x, y, 1, full=True)
fit = polyval(p[0], x)
return (x.min(), x.max()), (fit.min(), fit.max())
p = polyfit(x, y, 1)
fit = polyval(p, x)
if p[0] > 0:
return (x.min(), x.max()), (fit.min(), fit.max())
else:
return (x.min(), x.max()), (fit.max(), fit.min())

def draw(self):
"""
Expand Down
13 changes: 13 additions & 0 deletions sci_analysis/test/test_graph_groupscatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,19 @@ def test_26_scatter_three_groups_long_group_names(self):
self.assertTrue(GraphGroupScatter(input_array['a'], input_array['b'], groups=input_array['c'],
save_to='{}test_group_scatter_26'.format(self.save_path)))

def test_27_scatter_two_groups_negative_corr(self):
np.random.seed(987654321)
input_1_x = st.norm.rvs(size=100)
input_1_y = [x + st.norm.rvs(0, 0.5, size=1)[0] for x in input_1_x]
input_2_x = st.norm.rvs(size=100)
input_2_y = [2 - (x / 2) + st.norm.rvs(0, 0.2, size=1)[0] for x in input_2_x]
grp = [1] * 100 + [2] * 100
cs_x = np.concatenate((input_1_x, input_2_x))
cs_y = np.concatenate((input_1_y, input_2_y))
input_array = pd.DataFrame({'a': cs_x, 'b': cs_y, 'c': grp})
self.assertTrue(GraphGroupScatter(input_array['a'], input_array['b'], groups=input_array['c'],
save_to='{}test_group_scatter_27'.format(self.save_path)))


if __name__ == '__main__':
unittest.main()
7 changes: 7 additions & 0 deletions sci_analysis/test/test_graph_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ def test_131_scatter_empty_vector(self):
vector = Vector()
self.assertRaises(NoDataError, lambda: GraphScatter(vector))

def test_132_negative_corr(self):
"""Generate a scatter plot with correlating data"""
np.random.seed(987654321)
input_x_array = st.weibull_min.rvs(2, size=2000)
input_y_array = np.array([3 - x + st.norm.rvs(0, 0.5, size=1) for x in input_x_array])
self.assertTrue(GraphScatter(input_x_array, input_y_array, save_to='{}test_scatter_132'.format(self.save_path)))


if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='sci_analysis',
version='2.1.1',
version='2.1.2',
description='An easy to use and powerful python-based data exploration and analysis tool',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 8f51916

Please sign in to comment.