You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
13 KiB

"""
Generate placeholder images for manual creation tasks
(FEMM screenshots, photos, complex diagrams)
"""
from PIL import Image, ImageDraw, ImageFont
import os
# Configuration
PLACEHOLDER_COLOR = (240, 240, 250) # Light blue-gray
TEXT_COLOR = (60, 60, 60)
BORDER_COLOR = (100, 100, 200)
FONT_SIZE = 14
def create_placeholder(filepath, title, description, size=(1000, 800), tool="Manual Creation Required"):
"""Create a placeholder image with descriptive text"""
# Ensure directory exists
os.makedirs(os.path.dirname(filepath), exist_ok=True)
# Create image
img = Image.new('RGB', size, PLACEHOLDER_COLOR)
draw = ImageDraw.Draw(img)
# Draw border
border_width = 10
draw.rectangle([border_width, border_width, size[0]-border_width, size[1]-border_width],
outline=BORDER_COLOR, width=border_width)
# Try to use a default font, fallback to default if not available
try:
font_title = ImageFont.truetype("arial.ttf", FONT_SIZE + 4)
font_text = ImageFont.truetype("arial.ttf", FONT_SIZE)
except:
font_title = ImageFont.load_default()
font_text = ImageFont.load_default()
# Draw title
title_text = f"PLACEHOLDER: {title}"
title_bbox = draw.textbbox((0, 0), title_text, font=font_title)
title_width = title_bbox[2] - title_bbox[0]
title_x = (size[0] - title_width) // 2
draw.text((title_x, 50), title_text, fill=TEXT_COLOR, font=font_title)
# Draw tool requirement
tool_y = 100
tool_bbox = draw.textbbox((0, 0), tool, font=font_text)
tool_width = tool_bbox[2] - tool_bbox[0]
tool_x = (size[0] - tool_width) // 2
draw.text((tool_x, tool_y), tool, fill=(150, 50, 50), font=font_text)
# Draw description (word-wrapped)
desc_y = 150
margin = 80
max_width = size[0] - 2 * margin
# Simple word wrapping
words = description.split()
lines = []
current_line = []
for word in words:
test_line = ' '.join(current_line + [word])
test_bbox = draw.textbbox((0, 0), test_line, font=font_text)
test_width = test_bbox[2] - test_bbox[0]
if test_width <= max_width:
current_line.append(word)
else:
if current_line:
lines.append(' '.join(current_line))
current_line = [word]
if current_line:
lines.append(' '.join(current_line))
# Draw lines
for i, line in enumerate(lines):
draw.text((margin, desc_y + i * 25), line, fill=TEXT_COLOR, font=font_text)
# Save
img.save(filepath)
print(f"[OK] Created placeholder: {filepath}")
# ============================================================================
# FEMM Screenshots
# ============================================================================
create_placeholder(
'lessons/01-fundamentals/assets/field-lines-capacitances.png',
'Electric Field Lines Visualization',
'FEMM electrostatic simulation required. Show side-by-side: (Left) C_mut field lines between topload and spark, (Right) C_sh field lines from spark to ground. Use different colors (blue for C_mut, red for C_sh). Label dimensions and include typical values: C_mut ~ 8 pF, C_sh ~ 6 pF for 3-foot spark. Size: 1200x600 px.',
size=(1200, 600),
tool="FEMM Electrostatic Analysis"
)
create_placeholder(
'lessons/03-spark-physics/assets/electric-field-enhancement.png',
'Field Enhancement at Spark Tip',
'FEMM field plot showing field enhancement factor. Side-by-side: (Left) Smooth topload with no spark showing E_average, (Right) With spark tip showing E_tip with enhancement factor kappa = 2-5. Use color gradient for field magnitude. Include scale bar and annotations for enhancement factor. Size: 1400x700 px.',
size=(1400, 700),
tool="FEMM Electrostatic Analysis"
)
create_placeholder(
'lessons/03-spark-physics/assets/femm-field-plot-example.png',
'Complete FEMM Field Solution',
'Full FEMM electrostatic simulation output. Toroid topload at 350 kV with 2-meter spark extending downward. Color-coded field magnitude (rainbow scale) with equipotential lines overlaid. Ground plane at bottom. Annotate field values at key points. Show E_propagation threshold line (~0.5 MV/m). Size: 800x1200 px.',
size=(800, 1200),
tool="FEMM Electrostatic Analysis"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/femm-geometry-setup-lumped.png',
'FEMM Geometry Setup for Lumped Model',
'FEMM geometry window screenshot showing axisymmetric setup. Show toroidal topload cross-section, single cylindrical spark segment, ground plane, and outer boundary. Label materials (air, perfect conductor), dimensions, and boundary conditions. Mesh should be visible but not too dense. Size: 800x1000 px.',
size=(800, 1000),
tool="FEMM Geometry Setup Screenshot"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/femm-geometry-setup-distributed.png',
'FEMM Geometry Setup for Distributed Model',
'FEMM axisymmetric view with multiple segments. Show toroid topload and 10 cylindrical segments stacked vertically. Each segment clearly labeled (1-10). Ground plane and outer boundary visible. Show segment numbering and equal length segments. Materials and boundaries labeled. Size: 800x1200 px.',
size=(800, 1200),
tool="FEMM Geometry Setup Screenshot"
)
# ============================================================================
# High-Speed Photography
# ============================================================================
create_placeholder(
'lessons/03-spark-physics/assets/streamers-vs-leaders-photos.png',
'Streamers vs Leaders High-Speed Photography',
'High-speed photos comparing spark morphology. Top: Burst mode showing purple/blue highly branched streamers. Bottom: QCW mode showing white/orange thick straight leaders. Same scale for comparison. Annotate: branch density, channel diameter, color differences, straightness. Include camera settings and coil parameters. Size: 1200x1000 px.',
size=(1200, 1000),
tool="High-Speed Photography"
)
create_placeholder(
'lessons/03-spark-physics/assets/spark-channel-persistence-sequence.png',
'Spark Channel Cooling Time-Lapse',
'Time-lapse sequence showing spark channel cooling over time. 5-6 frames: t=0ms (bright, hot), t=1ms (visible), t=5ms (fading), t=20ms (nearly gone), t=100ms (dissipated for streamer OR still visible for leader). Use false color for temperature. Label time and temperature. Show two tracks: thin streamer vs thick leader. Size: 1500x600 px.',
size=(1500, 600),
tool="High-Speed Photography + Time-Lapse"
)
create_placeholder(
'lessons/03-spark-physics/assets/streamer-to-leader-transition-sequence.png',
'Streamer-to-Leader Transition Mechanism',
'Six-panel sequential diagram showing evolution: 1) Initial streamers (thin, branched, purple), 2) Current flowing (heat accumulation), 3) Channel heating (color shift to blue-white), 4) Leader forms at base (thick, bright), 5) Leader propagates (tip launches new streamers), 6) Full leader with streamer corona. Arrows showing progression. Temperature scale (1000K to 20000K). Time scale (microseconds to milliseconds). Size: 1500x1000 px.',
size=(1500, 1000),
tool="High-Speed Photography / Illustration"
)
# ============================================================================
# Complex Diagrams (Manual Illustration)
# ============================================================================
create_placeholder(
'lessons/02-optimization/assets/hungry-streamer-feedback-loop.png',
'Hungry Streamer Feedback Loop Diagram',
'Circular feedback loop diagram with 6 steps: 1) More power leads to Joule heating (I^2 R), 2) Higher temperature causes thermal ionization, 3) Increased n_e increases conductivity, 4) Lower R moves closer to R_opt, 5) Better matching extracts more power, 6) Loop back to step 1. Use arrows showing flow. Add constraint boxes: R_min, R_max, source limits. Show equilibrium point: R_actual approximately equal to R_opt_power. Color code: Power (red), Temperature (orange), Conductivity (blue). Size: 1000x1000 px.',
size=(1000, 1000),
tool="Diagram Illustration Tool (Inkscape / Draw.io)"
)
create_placeholder(
'lessons/02-optimization/assets/thevenin-measurement-setup.png',
'Thevenin Measurement Procedure Diagrams',
'Two diagrams showing measurement procedures. Top: Z_th measurement with primary drive OFF, 1V AC test source at topload, current measurement arrow, labels for "Measure I_test" and "Z_th = 1V / I_test". Bottom: V_th measurement with primary drive ON, no load (open circuit at topload), voltage measurement, labels for "No spark load" and "Measure V_th". Size: 1000x1000 px.',
size=(1000, 1000),
tool="Circuit Diagram Tool (See CIRCUIT-SPECIFICATIONS.md)"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/maxwell-matrix-extraction.png',
'Maxwell Matrix Extraction Process',
'Diagram showing FEMM capacitance matrix (2x2) output with arrows showing extraction formulas: C_mut = |C_12| = |C_21|, C_sh = C_22 + C_12. Include sign convention explanation. Show example values. Add visual representation of what each capacitance means (field lines). Size: 1000x700 px.',
size=(1000, 700),
tool="Diagram Illustration Tool"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/partial-capacitance-transformation.png',
'Maxwell to Partial Capacitance Transformation',
'Two matrices side-by-side with transformation arrows. Left: Maxwell matrix (with negative off-diagonals), Right: Partial capacitance matrix (all positive). Show transformation formulas. Use 3x3 example for clarity. Add physical interpretation. Note: "All SPICE capacitors must be positive". Size: 1400x700 px.',
size=(1400, 700),
tool="Diagram Illustration Tool"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/lumped-model-validation-checks.png',
'Validation Procedure Flowchart',
'Decision tree flowchart: 1) Check matrix symmetry (Pass/Fail), 2) Check C_sh vs empirical rule (Within factor 2?), 3) Mesh convergence (Refine and recheck), 4) Boundary distance (Far enough?), 5) Calculate R_opt (Physical range?). Color code: Green (pass), Yellow (warning), Red (fail). Include typical pass criteria. Size: 800x1000 px.',
size=(800, 1000),
tool="Flowchart Tool (Draw.io / Lucidchart)"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/iterative-optimization-convergence.png',
'Resistance Optimization Convergence Plot',
'Convergence plot showing resistance values over iterations. X-axis: Iteration number (0 to 5), Y-axis: Resistance (log scale, kOhm to MOhm). Multiple curves for each segment (10 total). Show convergence: Base segments (fast, 1-2 iterations), Mid segments (moderate, 2-3 iterations), Tip segments (slow, 3-4 iterations). Horizontal lines for convergence criteria (+/-1%). Color gradient by position (base to tip). Size: 1200x800 px.',
size=(1200, 800),
tool="Advanced Plotting (Consider matplotlib animation)"
)
create_placeholder(
'lessons/04-advanced-modeling/assets/spice-implementation-methods.png',
'SPICE Implementation Methods Comparison',
'Three circuit diagrams side-by-side showing different SPICE implementations: 1) Partial capacitance (all positive capacitors to ground), 2) Controlled sources (VCCS implementing C_ij dV/dt), 3) Nearest-neighbor (simplified with only adjacent couplings). Label pros/cons: Partial (accurate, complex transformation), Controlled (direct, requires behavioral sources), Nearest-neighbor (simple, approximate). Show 3-node example for each. Size: 1500x600 px.',
size=(1500, 600),
tool="Circuit Diagram Tool"
)
create_placeholder(
'lessons/01-fundamentals/assets/impedance-matching-concept.png',
'Impedance Matching: Ideal vs Constrained',
'Conceptual diagram comparing two scenarios. Left: Ideal matching where load impedance can be anywhere (full circle on complex plane), conjugate match achievable, mark -45 degree target. Right: Constrained matching where load impedance confined to sector (Tesla coil reality), highlight phi_Z_min boundary. Mark R_opt_power and R_opt_phase locations. Show -45 degree target outside feasible region. Use complex plane visualization. Size: 1200x600 px.',
size=(1200, 600),
tool="Diagram Illustration Tool"
)
print("\n" + "="*60)
print("PLACEHOLDER GENERATION COMPLETE")
print("="*60)
print(f"\nCreated 15 placeholder images for manual creation:")
print(f" - FEMM screenshots: 5 images")
print(f" - High-speed photography: 3 images")
print(f" - Complex diagrams: 7 images")
print("\nThese placeholders indicate images that require:")
print(" - Professional FEMM electrostatic simulations")
print(" - High-speed photography of actual Tesla coil sparks")
print(" - Manual illustration with diagram tools")
print("\nTotal course image status:")
print(" - Generated (matplotlib): 22 images")
print(" - Placeholders created: 15 images")
print(" - Circuit specifications: 7 circuits (see CIRCUIT-SPECIFICATIONS.md)")
print(" - TOTAL: 44 images (2 optional images not yet specified)")
print("="*60 + "\n")