|
|
import json |
|
|
import numpy as np |
|
|
import copy |
|
|
|
|
|
|
|
|
stats_file = "../meta/stats.json" |
|
|
with open(stats_file, 'r') as f: |
|
|
stats = json.load(f) |
|
|
|
|
|
print("Fixing stats.json file...") |
|
|
|
|
|
|
|
|
fixed_stats = copy.deepcopy(stats) |
|
|
|
|
|
|
|
|
for key in fixed_stats: |
|
|
if "std" in fixed_stats[key] and fixed_stats[key]["std"] is None: |
|
|
|
|
|
if "mean" in fixed_stats[key]: |
|
|
mean = fixed_stats[key]["mean"] |
|
|
if isinstance(mean, list): |
|
|
|
|
|
fixed_stats[key]["std"] = [1.0] * len(mean) |
|
|
else: |
|
|
|
|
|
fixed_stats[key]["std"] = [1.0] |
|
|
else: |
|
|
|
|
|
fixed_stats[key]["std"] = [1.0] |
|
|
|
|
|
print(f"Fixed {key}.std: None → {fixed_stats[key]['std']}") |
|
|
|
|
|
|
|
|
output_file = "../meta/stats_fixed.json" |
|
|
with open(output_file, 'w') as f: |
|
|
json.dump(fixed_stats, f, indent=2) |
|
|
|
|
|
print(f"\nFIXED! New stats file saved to: {output_file}") |
|
|
print("\nTo use this fixed file:") |
|
|
print("1. Rename the original file as a backup: mv ../meta/stats.json ../meta/stats.json.bak") |
|
|
print("2. Replace with fixed version: mv ../meta/stats_fixed.json ../meta/stats.json") |