Skip to content

Commit 45283d2

Browse files
committed
drop un-used var calculation
1 parent 616b84c commit 45283d2

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

flasc/analysis/expected_power_analysis_utilities.py

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def _bin_and_group_dataframe_expected_power(
7575
# # Compute the mean and standard deviation of each of test_cols
7676
.agg(
7777
[pl.mean(c).alias(f"{c}_mean") for c in test_cols]
78-
+ [pl.var(c).alias(f"{c}_var") for c in test_cols]
7978
+ [pl.count(c).alias(f"{c}_count") for c in test_cols]
8079
+ [pl.len().alias("count")]
8180
)

tests/expected_power_analysis_test.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,6 @@ def test_bin_and_group_dataframe_expected_power():
166166
df_["pow_001_mean"].to_numpy(), np.array([15.0, 25.0, 15.0, np.nan, 10.0, 10.0])
167167
)
168168

169-
with pl.Config(tbl_cols=-1):
170-
print(df_)
171-
172-
np.testing.assert_array_equal(
173-
df_["pow_000_var"].to_numpy(), np.array([50.0, 0.0, np.nan, 0.0, np.nan, 0.0])
174-
)
175169
np.testing.assert_array_equal(df_["pow_000_count"].to_numpy(), np.array([2, 2, 1, 2, 1, 2]))
176170
np.testing.assert_array_equal(df_["pow_001_count"].to_numpy(), np.array([2, 2, 2, 0, 1, 2]))
177171

@@ -217,8 +211,6 @@ def test_synchronize_nulls():
217211
"df_name": ["hypothetical"],
218212
"pow_000_mean": [np.nan],
219213
"pow_001_mean": [np.nan],
220-
"pow_000_var": [np.nan],
221-
"pow_001_var": [np.nan],
222214
"pow_000_count": [1],
223215
"pow_001_count": [1],
224216
"count": [1],
@@ -429,14 +421,10 @@ def test_cov_against_var():
429421
bin_cols_with_df_name=["wd_bin", "ws_bin", "df_name"],
430422
)
431423

432-
df_bin = _bin_and_group_dataframe_expected_power(
433-
df_=test_df,
434-
test_cols=["pow_000"],
435-
)
424+
# Manually compute the variance of the pow_000 column
425+
man_var = test_df["pow_000"].var()
436426

437-
np.testing.assert_almost_equal(
438-
df_cov["cov_pow_000_pow_000"].to_numpy(), df_bin["pow_000_var"].to_numpy()
439-
)
427+
np.testing.assert_almost_equal(df_cov["cov_pow_000_pow_000"].to_numpy(), man_var)
440428

441429

442430
def test_fill_cov_with_var_dont_fill_all():

0 commit comments

Comments
 (0)