1

Ajoute la richesse chromatique par set

This commit is contained in:
2025-12-02 16:59:59 +01:00
parent 231a9af28d
commit c2bf12e3fe
12 changed files with 592 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
"""Calcule la richesse chromatique par set et par année."""
from pathlib import Path
from lib.rebrickable.color_richness import (
build_richness_by_set,
build_richness_by_year,
write_richness_by_set,
write_richness_by_year,
)
COLORS_BY_SET_PATH = Path("data/intermediate/colors_by_set.csv")
SETS_ENRICHED_PATH = Path("data/intermediate/sets_enriched.csv")
RICHNESS_BY_SET_PATH = Path("data/intermediate/color_richness_by_set.csv")
RICHNESS_BY_YEAR_PATH = Path("data/intermediate/color_richness_by_year.csv")
def main() -> None:
"""Construit les CSV de richesse chromatique."""
richness_by_set = build_richness_by_set(COLORS_BY_SET_PATH, SETS_ENRICHED_PATH)
richness_by_year = build_richness_by_year(richness_by_set)
write_richness_by_set(RICHNESS_BY_SET_PATH, richness_by_set)
write_richness_by_year(RICHNESS_BY_YEAR_PATH, richness_by_year)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,26 @@
"""Trace les graphiques de richesse chromatique par set."""
from pathlib import Path
from lib.plots.color_richness import (
plot_concentration_scatter,
plot_richness_boxplot,
plot_richness_top_sets,
)
RICHNESS_PATH = Path("data/intermediate/color_richness_by_set.csv")
BOXPLOT_DESTINATION = Path("figures/step28/color_richness_boxplot.png")
TOP_DESTINATION = Path("figures/step28/color_richness_top_sets.png")
CONCENTRATION_DESTINATION = Path("figures/step28/color_concentration_scatter.png")
def main() -> None:
"""Génère les visuels de richesse chromatique."""
plot_richness_boxplot(RICHNESS_PATH, BOXPLOT_DESTINATION)
plot_richness_top_sets(RICHNESS_PATH, TOP_DESTINATION)
plot_concentration_scatter(RICHNESS_PATH, CONCENTRATION_DESTINATION)
if __name__ == "__main__":
main()