Skip to content

Commit cd9dfa9

Browse files
committed
Run through all the tests after merging into dev
1 parent 685d21f commit cd9dfa9

6 files changed

Lines changed: 107 additions & 953 deletions

File tree

dabest/_classes.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2608,11 +2608,11 @@ def plot(self, color_col=None,
26082608

26092609
raw_marker_size=6, es_marker_size=9,
26102610

2611-
swarm_label=None, contrast_label=None,
2612-
swarm_ylim=None, contrast_ylim=None,
2611+
swarm_label=None, barchart_label=None, contrast_label=None, delta2_label=None,
2612+
swarm_ylim=None, barchart_ylim=None, contrast_ylim=None, delta2_ylim=None,
26132613

26142614
custom_palette=None, swarm_desat=0.5, halfviolin_desat=1,
2615-
halfviolin_alpha=0.8,
2615+
halfviolin_alpha=0.8,
26162616

26172617
#bar plot
26182618
bar_label=None, bar_desat=0.5, bar_width = 0.5,bar_ylim = None,
@@ -2637,6 +2637,7 @@ def plot(self, color_col=None,
26372637
reflines_kwargs=None,
26382638
group_summary_kwargs=None,
26392639
legend_kwargs=None):
2640+
26402641
"""
26412642
Creates an estimation plot for the effect size of interest.
26422643

dabest/tests/test_03_plotting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
two_groups_unpaired = load(df, idx=("Control 1", "Test 1"))
2626

2727
two_groups_paired = load(df, idx=("Control 1", "Test 1"),
28-
paired=True, id_col="ID")
28+
paired="baseline", id_col="ID")
2929

3030
multi_2group = load(df, idx=(("Control 1", "Test 1",),
3131
("Control 2", "Test 2"))
@@ -34,7 +34,7 @@
3434
multi_2group_paired = load(df,
3535
idx=(("Control 1", "Test 1"),
3636
("Control 2", "Test 2")),
37-
paired=True, id_col="ID")
37+
paired="baseline", id_col="ID")
3838

3939
shared_control = load(df, idx=("Control 1", "Test 1",
4040
"Test 2", "Test 3",
@@ -137,7 +137,7 @@ def test_11_inset_plots():
137137
iris_dabest3 = load(data=iris_melt[iris_melt.species=="setosa"],
138138
x="metric", y="value",
139139
idx=("sepal_length", "sepal_width"),
140-
paired=True, id_col="index")
140+
paired="baseline", id_col="index")
141141

142142

143143

@@ -356,4 +356,4 @@ def test_99_style_sheets():
356356
# Perform this test last so we don't have to reset the plot style.
357357
plt.style.use("dark_background")
358358

359-
return multi_2group.mean_diff.plot();
359+
return multi_2group.mean_diff.plot();

dabest/tests/test_10_proportion_plot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
two_groups_unpaired = load(df, idx=("Control 1", "Test 1"))
1414

1515
two_groups_paired = load(df, idx=("Control 1", "Test 1"),
16-
paired=True, id_col="ID")
16+
paired="baseline", id_col="ID")
1717

1818
multi_2group = load(df, idx=(("Control 1", "Test 1",),
1919
("Control 2", "Test 2"))
@@ -22,7 +22,7 @@
2222
multi_2group_paired = load(df,
2323
idx=(("Control 1", "Test 1"),
2424
("Control 2", "Test 2")),
25-
paired=True, id_col="ID")
25+
paired="baseline", id_col="ID")
2626

2727
shared_control = load(df, idx=("Control 1", "Test 1",
2828
"Test 2", "Test 3",

dabest/tests/test_99_confint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_paired_mean_diff_ci():
2424

2525

2626
ex_bp = load(data=exercise_bp, idx=("before", "after"),
27-
paired=True, id_col="subject_id")
27+
paired="baseline", id_col="subject_id")
2828
paired_mean_diff = ex_bp.mean_diff.results
2929

3030
assert pytest.approx(3.875) == paired_mean_diff.bca_low[0]

dabest/tests/utils.py

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,101 @@ def create_demo_dataset(seed=9999, N=20):
3939
return df
4040

4141

42+
43+
def create_demo_dataset_rm(seed=9999, N=20):
44+
45+
import numpy as np
46+
import pandas as pd
47+
from scipy.stats import norm # Used in generation of populations.
48+
49+
np.random.seed(9999) # Fix the seed so the results are replicable.
50+
# pop_size = 10000 # Size of each population.
51+
52+
# Create samples
53+
timepoint0 = norm.rvs(loc=3, scale=0.4, size=N)
54+
timepoint1 = norm.rvs(loc=3.5, scale=0.75, size=N)
55+
timepoint2 = norm.rvs(loc=3.25, scale=0.4, size=N)
56+
timepoint3 = norm.rvs(loc=3.5, scale=0.5, size=N)
57+
timepoint4 = norm.rvs(loc=2.5, scale=0.6, size=N)
58+
timepoint5 = norm.rvs(loc=3, scale=0.75, size=N)
59+
timepoint6 = norm.rvs(loc=3.5, scale=0.75, size=N)
60+
timepoint7 = norm.rvs(loc=3.25, scale=0.4, size=N)
61+
timepoint8 = norm.rvs(loc=3.25, scale=0.4, size=N)
62+
63+
64+
# Add a `gender` column for coloring the data.
65+
grp1 = np.repeat('Group 1', N/2).tolist()
66+
grp2 = np.repeat('Group 2', N/2).tolist()
67+
grp = grp1 + grp2
68+
69+
# Add an `id` column for paired data plotting.
70+
id_col = pd.Series(range(1, N+1))
71+
72+
# Combine samples and gender into a DataFrame.
73+
df = pd.DataFrame({'Time Point 0' : timepoint0,
74+
'Time Point 1' : timepoint1,
75+
'Time Point 2' : timepoint2,
76+
'Time Point 3' : timepoint3,
77+
'Time Point 4' : timepoint4,
78+
'Time Point 5' : timepoint5,
79+
'Time Point 6' : timepoint6,
80+
'Time Point 7' : timepoint7,
81+
'Time Point 8' : timepoint8,
82+
'Group' : grp,
83+
'ID' : id_col
84+
})
85+
86+
return df
87+
88+
89+
def create_demo_dataset_delta(seed=9999, N=20):
90+
91+
import numpy as np
92+
import pandas as pd
93+
from scipy.stats import norm # Used in generation of populations.
94+
95+
np.random.seed(seed) # Fix the seed so the results are replicable.
96+
# pop_size = 10000 # Size of each population.
97+
98+
from scipy.stats import norm # Used in generation of populations.
99+
100+
# Create samples
101+
y = norm.rvs(loc=3, scale=0.4, size=N*2)
102+
103+
# Add experiment column
104+
e1 = np.repeat('Control', N).tolist()
105+
e2 = np.repeat('Test', N).tolist()
106+
experiment = e1 + e2
107+
108+
# Add a `Light` column as the first variable
109+
light = []
110+
for i in range(N):
111+
light.append('L1')
112+
light.append('L2')
113+
114+
# Add a `genotype` column as the second variable
115+
g1 = np.repeat('G1', N/2).tolist()
116+
g2 = np.repeat('G2', N/2).tolist()
117+
g3 = np.repeat('G3', N).tolist()
118+
genotype = g1 + g2 + g3
119+
120+
# Add an `id` column for paired data plotting.
121+
id_col = []
122+
for i in range(N):
123+
id_col.append(i)
124+
id_col.append(i)
125+
126+
# Combine samples and gender into a DataFrame.
127+
df = pd.DataFrame({'ID' : id_col,
128+
'Light' : light,
129+
'Genotype' : genotype,
130+
'Experiment': experiment,
131+
'Y' : y
132+
})
133+
134+
return df
135+
136+
42137
def create_demo_prop_dataset(seed=9999, N=40):
43138
import numpy as np
44139
import pandas as pd
@@ -135,4 +230,4 @@ def get_swarm_yspans(coll, round_result=False, decimals=12):
135230
# df["idcol"] = pd.Series(range(1, n+1))
136231
# df.columns = [str(c) for c in df.columns]
137232
#
138-
# return random_seed, max_mean_diff, df
233+
# return random_seed, max_mean_diff, df

0 commit comments

Comments
 (0)