Skip to content

Commit

Permalink
print the stuff we want
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Lane committed Dec 10, 2024
1 parent bb2eecf commit ab55205
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/jaw_centres.csv
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ n,z,x,y,crop_around_centre,age,genotype,strain
93,1621,174,198,False,36.0,wt,wt
68,1558,372,335,False,12.0,wt,wt
53,1503,233,283,False,4.0,wt,wt
186,1651,435,423,False,18.0,186,barx1
186,1651,435,423,False,18.0,wt,barx1
2,1712,325,302,False,24.0,wt,wt
52,1693,429,209,False,4.0,wt,wt
26,1566,465,169,False,18.0,het,barx1
Expand Down
12 changes: 9 additions & 3 deletions scripts/boring_scripts/training_summary_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,23 @@ def _print_info(label: str, n: list[int], fish_info: pd.DataFrame) -> None:
:param fish_info: DataFrame with fish info
"""
df_slice = fish_info[["age"]].loc[n]
df_slice = fish_info[["age", "genotype", "strain"]].loc[n]
end_str = f"{'=' * 80}\n"

print(f"Summary stats for {label} set")
if label in {"val", "test"}:
print(df_slice.to_markdown(), end=f"\n{'='*24}\n\n")
print(df_slice.to_markdown())
print(end_str)

else:
# For train set, Find average and 95% CI for age
print(f"N: {len(n)}")
print(
f"\tAverage age: {df_slice['age'].mean():.2f} mo [95% CI: {df_slice['age'].quantile([0.025, 0.975]).values}]"
f"Average age: {df_slice['age'].mean():.2f} mo [95% CI: {df_slice['age'].quantile([0.025, 0.975]).values}]"
)
print(df_slice.groupby("age").size().sort_index(ascending=True).to_markdown())
print(df_slice.groupby(["genotype", "strain"]).size().sort_values(ascending=False).to_markdown())
print(end_str)


def main():
Expand Down

0 comments on commit ab55205

Please sign in to comment.