aboutsummaryrefslogtreecommitdiffstats
path: root/scenes/v16_bayes.py
diff options
context:
space:
mode:
authorElvis Claros Castro <elvis@claros.ar>2026-09-26 20:50:41 -0300
committerElvis Claros Castro <elvis@claros.ar>2026-09-26 20:50:41 -0300
commitfafaebb051907a848a9406f9da19669c81a83a3b (patch)
treec30ea26e6b549e5523af2bae5c39569e9a946b12 /scenes/v16_bayes.py
parent59355909f2de9236af8168a26c70bcf6caa3b285 (diff)
download100cia-videos-main.tar.gz
100cia-videos-main.zip
Translate code, comments and logs to English; English README; configurable paths and env varsHEADmain
Identifiers, docstrings, comments and console messages are now in English. Narration, subtitles and on-screen text stay in Spanish (they are the video content). The Blender <-> Godot physics protocol uses English keys and body prefixes chosen to keep the original creation order, so cached simulations and renders stay bit-identical. The old Spanish environment variable names are still accepted.
Diffstat (limited to 'scenes/v16_bayes.py')
-rw-r--r--scenes/v16_bayes.py154
1 files changed, 77 insertions, 77 deletions
diff --git a/scenes/v16_bayes.py b/scenes/v16_bayes.py
index 311dd01..be6ffdc 100644
--- a/scenes/v16_bayes.py
+++ b/scenes/v16_bayes.py
@@ -6,11 +6,11 @@ from tiktok import *
COLS, ROWS = 25, 40
PX, PY = 0.27, 0.175
-GY = 1.65 # centro vertical de la grilla
+GY = 1.65 # vertical centre of the grid
RAD = 0.062
-APAGADO = "#2B3A5C"
-ENFERMA = 437 # fila 17, columna 12 (queda centrada)
-FALSOS = [63, 147, 232, 318, 389, 476, 551, 668, 742, 861]
+DIMMED = "#2B3A5C"
+SICK = 437 # row 17, column 12 (ends up centred)
+FALSE_POS = [63, 147, 232, 318, 389, 476, 551, 668, 742, 861]
def pos(i):
@@ -24,137 +24,137 @@ class Bayes(TikTok):
def construct(self):
self.prepare()
- chip = self.chip("Probabilidad", CELESTE)
+ chip = self.chip("Probabilidad", C_SKY)
- # --- la tarjeta del test ---------------------------------------------
- marco = RoundedRectangle(corner_radius=0.32, width=6.4, height=3.4, stroke_width=5,
- stroke_color=CELESTE, fill_color="#121C33",
+ # --- the test card ---------------------------------------------------
+ frame_box = RoundedRectangle(corner_radius=0.32, width=6.4, height=3.4, stroke_width=5,
+ stroke_color=C_SKY, fill_color="#121C33",
fill_opacity=1).move_to(UP * 3.5)
- et = Text("TEST", font=FONT, font_size=40, weight=BOLD, color=GRIS)
- num = Text("99%", font=FONT, font_size=118, weight=BOLD, color=AMBAR)
- pie = Text("de precisión", font=FONT, font_size=38, weight=BOLD, color=WHITE)
- VGroup(et, num, pie).arrange(DOWN, buff=0.18).move_to(marco)
- tarjeta = VGroup(marco, et, num, pie)
+ et = Text("TEST", font=FONT, font_size=40, weight=BOLD, color=C_GRAY)
+ num = Text("99%", font=FONT, font_size=118, weight=BOLD, color=AMBER)
+ footer = Text("de precisión", font=FONT, font_size=38, weight=BOLD, color=WHITE)
+ VGroup(et, num, footer).arrange(DOWN, buff=0.18).move_to(frame_box)
+ card = VGroup(frame_box, et, num, footer)
with self.beat(0) as b:
b.play(FadeIn(chip, shift=DOWN * 0.3), run_time=0.4)
- b.play(GrowFromCenter(tarjeta), run_time=0.8)
- b.play(Flash(num, color=AMBAR, line_length=0.35, num_lines=14,
+ b.play(GrowFromCenter(card), run_time=0.8)
+ b.play(Flash(num, color=AMBER, line_length=0.35, num_lines=14,
flash_radius=1.7), run_time=0.9)
- sello = VGroup(
+ stamp = VGroup(
RoundedRectangle(corner_radius=0.18, width=4.7, height=1.25, stroke_width=8,
- stroke_color=ROSA, fill_color="#2A0E18", fill_opacity=0.94),
- Text("POSITIVO", font=FONT, font_size=60, weight=BOLD, color=ROSA))
- sello.rotate(-0.09).move_to(marco.get_bottom() + DOWN * 0.05)
+ stroke_color=C_PINK, fill_color="#2A0E18", fill_opacity=0.94),
+ Text("POSITIVO", font=FONT, font_size=60, weight=BOLD, color=C_PINK))
+ stamp.rotate(-0.09).move_to(frame_box.get_bottom() + DOWN * 0.05)
with self.beat(1) as b:
- b.play(FadeIn(sello, scale=2.4), run_time=0.55)
- b.play(Wiggle(sello, scale_value=1.07), run_time=1.0)
+ b.play(FadeIn(stamp, scale=2.4), run_time=0.55)
+ b.play(Wiggle(stamp, scale_value=1.07), run_time=1.0)
- preg = Text("La mayoría contesta:", font=FONT, font_size=40,
- weight=BOLD, color=GRIS).move_to(UP * 0.45)
- mal = Text("99%", font=FONT, font_size=106, weight=BOLD, color=GRIS)
- mal.next_to(preg, DOWN, buff=0.28)
+ question = Text("La mayoría contesta:", font=FONT, font_size=40,
+ weight=BOLD, color=C_GRAY).move_to(UP * 0.45)
+ wrong = Text("99%", font=FONT, font_size=106, weight=BOLD, color=C_GRAY)
+ wrong.next_to(question, DOWN, buff=0.28)
with self.beat(2) as b:
- b.play(FadeIn(preg, shift=UP * 0.2), run_time=0.5)
- b.play(FadeIn(mal, scale=0.7), run_time=0.7)
+ b.play(FadeIn(question, shift=UP * 0.2), run_time=0.5)
+ b.play(FadeIn(wrong, scale=0.7), run_time=0.7)
- tacha = Line(mal.get_left() + LEFT * 0.28, mal.get_right() + RIGHT * 0.28,
- stroke_width=11, color=ROSA)
- bien = Text("9%", font=FONT, font_size=150, weight=BOLD,
- color=VERDE).move_to(DOWN * 2.05)
+ strike = Line(wrong.get_left() + LEFT * 0.28, wrong.get_right() + RIGHT * 0.28,
+ stroke_width=11, color=C_PINK)
+ right_ok = Text("9%", font=FONT, font_size=150, weight=BOLD,
+ color=C_GREEN).move_to(DOWN * 2.05)
with self.beat(3) as b:
- b.play(Create(tacha), run_time=0.45)
- b.play(FadeIn(bien, scale=0.6), run_time=0.7)
- b.play(Flash(bien, color=VERDE, flash_radius=1.7, num_lines=16), run_time=0.9)
+ b.play(Create(strike), run_time=0.45)
+ b.play(FadeIn(right_ok, scale=0.6), run_time=0.7)
+ b.play(Flash(right_ok, color=C_GREEN, flash_radius=1.7, num_lines=16), run_time=0.9)
# --- las mil personas -------------------------------------------------
- puntos = VGroup(*[Dot(radius=RAD, color=APAGADO, fill_opacity=1).move_to(pos(i))
+ point_list = VGroup(*[Dot(radius=RAD, color=DIMMED, fill_opacity=1).move_to(pos(i))
for i in range(COLS * ROWS)])
- rotulo = Text("1.000 personas", font=FONT, font_size=40, weight=BOLD,
+ caption = Text("1.000 personas", font=FONT, font_size=40, weight=BOLD,
color=WHITE).move_to(UP * 5.55)
with self.beat(4) as b:
- b.play(FadeOut(VGroup(tarjeta, sello, preg, mal, tacha, bien)), run_time=0.5)
- b.play(FadeIn(puntos, lag_ratio=0), FadeIn(rotulo, shift=DOWN * 0.2),
+ b.play(FadeOut(VGroup(card, stamp, question, wrong, strike, right_ok)), run_time=0.5)
+ b.play(FadeIn(point_list, lag_ratio=0), FadeIn(caption, shift=DOWN * 0.2),
run_time=1.1)
- enf = puntos[ENFERMA]
- anillo = Circle(radius=0.30, stroke_width=6, color=ROSA).move_to(pos(ENFERMA))
- cajita = RoundedRectangle(corner_radius=0.14, width=2.45, height=0.7, stroke_width=0,
+ sick = point_list[SICK]
+ ring = Circle(radius=0.30, stroke_width=6, color=C_PINK).move_to(pos(SICK))
+ small_box = RoundedRectangle(corner_radius=0.14, width=2.45, height=0.7, stroke_width=0,
fill_color="#0B0F1A", fill_opacity=0.92)
- txt = Text("1 enferma", font=FONT, font_size=34, weight=BOLD, color=ROSA)
- etiq = VGroup(cajita, txt).move_to(pos(ENFERMA) + RIGHT * 1.95)
- guia = Line(anillo.get_right(), etiq.get_left(), stroke_width=4, color=ROSA)
+ txt = Text("1 enferma", font=FONT, font_size=34, weight=BOLD, color=C_PINK)
+ etiq = VGroup(small_box, txt).move_to(pos(SICK) + RIGHT * 1.95)
+ guide = Line(ring.get_right(), etiq.get_left(), stroke_width=4, color=C_PINK)
with self.beat(5) as b:
- b.play(enf.animate.set_color(ROSA).scale(2.2), run_time=0.5)
- b.play(Create(anillo), run_time=0.4)
- b.play(Create(guia), FadeIn(etiq), run_time=0.5)
-
- # --- el barrido del test ----------------------------------------------
- barrido = Line(LEFT * 3.6, RIGHT * 3.6, stroke_width=6, color=CELESTE)
- barrido.move_to([0, pos(0)[1] + 0.22, 0])
- ley1 = VGroup(Dot(radius=0.12, color=ROSA),
+ b.play(sick.animate.set_color(C_PINK).scale(2.2), run_time=0.5)
+ b.play(Create(ring), run_time=0.4)
+ b.play(Create(guide), FadeIn(etiq), run_time=0.5)
+
+ # --- the test sweep ---------------------------------------------------
+ sweep = Line(LEFT * 3.6, RIGHT * 3.6, stroke_width=6, color=C_SKY)
+ sweep.move_to([0, pos(0)[1] + 0.22, 0])
+ ley1 = VGroup(Dot(radius=0.12, color=C_PINK),
Text("1 positivo verdadero", font=FONT, font_size=36,
weight=BOLD, color=WHITE)).arrange(RIGHT, buff=0.26)
ley1.move_to(DOWN * 2.15)
with self.beat(6) as b:
- b.play(FadeIn(barrido), run_time=0.25)
- b.play(barrido.animate.move_to([0, pos(COLS * ROWS - 1)[1] - 0.22, 0]),
+ b.play(FadeIn(sweep), run_time=0.25)
+ b.play(sweep.animate.move_to([0, pos(COLS * ROWS - 1)[1] - 0.22, 0]),
run_time=max(0.9, b.floor - 1.5), rate_func=linear)
- b.play(FadeOut(barrido),
- Flash(anillo, color=VERDE, flash_radius=0.65, num_lines=12),
+ b.play(FadeOut(sweep),
+ Flash(ring, color=C_GREEN, flash_radius=0.65, num_lines=12),
run_time=0.5)
b.add(ley1)
- # --- los falsos positivos ---------------------------------------------
- falsos = VGroup(*[puntos[i] for i in FALSOS])
+ # --- the false positives ----------------------------------------------
+ false_pos = VGroup(*[point_list[i] for i in FALSE_POS])
with self.beat(7) as b:
- b.play(LaggedStart(*[p.animate.set_color(AMBAR).scale(2.2) for p in falsos],
+ b.play(LaggedStart(*[p.animate.set_color(AMBER).scale(2.2) for p in false_pos],
lag_ratio=0.2), run_time=max(1.3, b.floor - 0.7))
- ley2 = VGroup(Dot(radius=0.12, color=AMBAR),
+ ley2 = VGroup(Dot(radius=0.12, color=AMBER),
Text("10 falsos positivos", font=FONT, font_size=36,
weight=BOLD, color=WHITE)).arrange(RIGHT, buff=0.26)
ley2.move_to(DOWN * 2.78)
with self.beat(8) as b:
b.play(FadeIn(ley2, shift=UP * 0.2), run_time=0.45)
- b.play(*[Indicate(p, color=AMBAR, scale_factor=1.7) for p in falsos],
+ b.play(*[Indicate(p, color=AMBER, scale_factor=1.7) for p in false_pos],
run_time=1.1)
- # --- los once positivos, en fila --------------------------------------
- marcados = set(FALSOS) | {ENFERMA}
- resto = VGroup(*[p for j, p in enumerate(puntos) if j not in marcados])
- elegidos = [puntos[ENFERMA]] + [puntos[i] for i in FALSOS]
- cuenta = Text("11 positivos", font=FONT, font_size=52, weight=BOLD,
+ # --- the eleven positives, in a row -----------------------------------
+ marked = set(FALSE_POS) | {SICK}
+ remainder = VGroup(*[p for j, p in enumerate(point_list) if j not in marked])
+ chosen = [point_list[SICK]] + [point_list[i] for i in FALSE_POS]
+ count = Text("11 positivos", font=FONT, font_size=52, weight=BOLD,
color=WHITE).move_to(UP * 2.2)
frac = Text("1 de 11 = 9%", font=FONT, font_size=90, weight=BOLD,
- color=VERDE).move_to(UP * 0.7)
+ color=C_GREEN).move_to(UP * 0.7)
with self.beat(9) as b:
- b.play(resto.animate.set_opacity(0.12),
- FadeOut(VGroup(anillo, guia, etiq, rotulo, ley1, ley2)), run_time=0.5)
+ b.play(remainder.animate.set_opacity(0.12),
+ FadeOut(VGroup(ring, guide, etiq, caption, ley1, ley2)), run_time=0.5)
b.play(*[p.animate.move_to([(k - 5) * 0.62, 3.35, 0]).scale(2.4)
- for k, p in enumerate(elegidos)], run_time=0.9)
- b.play(FadeIn(cuenta, shift=UP * 0.2), run_time=0.4)
+ for k, p in enumerate(chosen)], run_time=0.9)
+ b.play(FadeIn(count, shift=UP * 0.2), run_time=0.4)
b.play(FadeIn(frac, scale=0.7), run_time=0.6)
- cierre = VGroup(
- Text("Si la enfermedad es rara,", font=FONT, font_size=42, weight=BOLD, color=GRIS),
+ closing = VGroup(
+ Text("Si la enfermedad es rara,", font=FONT, font_size=42, weight=BOLD, color=C_GRAY),
Text("un positivo suelto", font=FONT, font_size=50, weight=BOLD, color=WHITE),
- Text("casi siempre es falso", font=FONT, font_size=50, weight=BOLD, color=AMBAR),
+ Text("casi siempre es falso", font=FONT, font_size=50, weight=BOLD, color=AMBER),
).arrange(DOWN, buff=0.32).move_to(DOWN * 1.75)
with self.beat(10) as b:
- b.play(FadeOut(resto), run_time=0.4)
- b.play(FadeIn(cierre, shift=UP * 0.25), run_time=0.8)
- b.play(Flash(frac, color=VERDE, flash_radius=2.2, num_lines=18), run_time=0.9)
+ b.play(FadeOut(remainder), run_time=0.4)
+ b.play(FadeIn(closing, shift=UP * 0.25), run_time=0.8)
+ b.play(Flash(frac, color=C_GREEN, flash_radius=2.2, num_lines=18), run_time=0.9)
self.finish()