You've already forked etude_lego_jurassic_world
Ajoute la richesse chromatique par set
This commit is contained in:
28
scripts/compute_color_richness.py
Normal file
28
scripts/compute_color_richness.py
Normal 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()
|
||||
26
scripts/plot_color_richness.py
Normal file
26
scripts/plot_color_richness.py
Normal 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()
|
||||
Reference in New Issue
Block a user