You've already forked etude_lego_jurassic_world
Ajoute l’étape 28 des palettes perceptuelles
This commit is contained in:
30
scripts/plot_set_color_swatches_perceptual.py
Normal file
30
scripts/plot_set_color_swatches_perceptual.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Trace les palettes perceptuelles (top 5) par set hors minifigs."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from lib.plots.set_color_swatches_perceptual import plot_set_color_swatches_perceptual
|
||||
from lib.rebrickable.set_color_swatches_perceptual import (
|
||||
build_perceptual_swatches,
|
||||
load_colors_by_set,
|
||||
load_sets_enriched,
|
||||
write_perceptual_swatches,
|
||||
)
|
||||
|
||||
|
||||
COLORS_BY_SET_PATH = Path("data/intermediate/colors_by_set.csv")
|
||||
SETS_ENRICHED_PATH = Path("data/intermediate/sets_enriched.csv")
|
||||
SWATCHES_PATH = Path("data/intermediate/set_color_swatches_perceptual.csv")
|
||||
DESTINATION_PATH = Path("figures/step28/set_color_swatches_perceptual.png")
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Construit et trace les palettes perceptuelles par set."""
|
||||
colors_rows = load_colors_by_set(COLORS_BY_SET_PATH)
|
||||
sets_lookup = load_sets_enriched(SETS_ENRICHED_PATH)
|
||||
swatches = build_perceptual_swatches(colors_rows, sets_lookup, top_n=5)
|
||||
write_perceptual_swatches(SWATCHES_PATH, swatches)
|
||||
plot_set_color_swatches_perceptual(SWATCHES_PATH, DESTINATION_PATH)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user