added a bunch of helper scripts
This commit is contained in:
parent
f72408cd88
commit
a24aeeffe7
6 changed files with 347 additions and 0 deletions
|
@ -27,6 +27,9 @@ def main():
|
|||
# Group data by chain
|
||||
chain_groups = df.groupby('chain')
|
||||
|
||||
# Prepare list to collect summary data for CSV export
|
||||
summary_data = []
|
||||
|
||||
# For each chain, create a figure with five subplots for boxplots (mean, std, min, max, count)
|
||||
for chain_name, chain_data in chain_groups:
|
||||
fig, axs = plt.subplots(1, 5, figsize=(18, 6), constrained_layout=True)
|
||||
|
@ -38,6 +41,17 @@ def main():
|
|||
plot_data = chain_data[['mean', 'std', 'min', 'max', 'count']].copy()
|
||||
plot_data.columns = ['Mean', 'Std', 'Min', 'Max', 'Count']
|
||||
|
||||
# Calculate summary statistics for CSV export
|
||||
chain_summary = {
|
||||
'chain': chain_name,
|
||||
'mean_count': plot_data['Count'].mean(),
|
||||
'mean_mean': plot_data['Mean'].mean(),
|
||||
'mean_std': plot_data['Std'].mean(),
|
||||
'mean_min': plot_data['Min'].mean(),
|
||||
'mean_max': plot_data['Max'].mean()
|
||||
}
|
||||
summary_data.append(chain_summary)
|
||||
|
||||
# Make all plots have the same color palette
|
||||
palette = sns.color_palette("husl", 4)
|
||||
# Add a distinct color for the 'Count' plot, as it is a different metric
|
||||
|
@ -114,7 +128,13 @@ def main():
|
|||
print(f"\nSummary for chain: {chain_name}")
|
||||
print(summary[['mean', 'std', 'min', 'max', 'count']])
|
||||
|
||||
# Create and save the summary CSV
|
||||
summary_df = pd.DataFrame(summary_data)
|
||||
summary_csv_file = args.input.replace('.csv', '_summary.csv')
|
||||
summary_df.to_csv(summary_csv_file, index=False)
|
||||
|
||||
print(f"\nAnalysis complete. Plots saved with base name: {args.input.replace('.csv', '_chain_*_analysis.png')}")
|
||||
print(f"Summary CSV saved as: {summary_csv_file}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue