Skip to content

docs: add professional docstrings and inline comments to all source files#7

Merged
stedrew merged 1 commit intomainfrom
docs/add-comments-and-docstrings
Mar 5, 2026
Merged

docs: add professional docstrings and inline comments to all source files#7
stedrew merged 1 commit intomainfrom
docs/add-comments-and-docstrings

Conversation

@stedrew
Copy link
Copy Markdown
Contributor

@stedrew stedrew commented Mar 5, 2026

Closes #6.

Summary

  • Added Google-style module docstrings, function/method docstrings, and targeted inline comments to all 14 Python source files
  • No logic changes — purely additive documentation
  • replay.py used as the style reference (it was the only file with partial docs); all others brought up to the same standard

What was added per file

File Key additions
agent_state.py Module docstring explaining all psychological profile params; AgentRuntimeState field docs; docstrings for all functions
belief_model.py Module docstring explaining Bayesian pipeline; threshold rationale on categorize_hazard_state; formula explanations on all functions
departure_model.py Module docstring explaining three departure clauses; inline comments on each clause with motivation
information_model.py Module docstring; docs on Gaussian noise model and keyword-vote social signal; explanation of keyword priority ordering
routing_utility.py Module docstring explaining utility formula; rationale for all hardcoded weights (0.8, 1.6, 0.6, 0.75, 8.0); penalty lookup table docs
scenarios.py Module docstring explaining three information regimes; docs on each config field and what gets stripped per regime
forecast_layer.py Module docstring; margin band threshold explanations; docs on fire growth metric derivation
metrics.py Module docstring explaining five KPIs and their calibration purpose; class docstring; docstrings on all methods
replay.py Module docstring clarifying record/replay contract and output files; expanded method docstrings
calibration.py Module docstring explaining loss formula, METRIC_SPECS weights and their rationale; docstrings on all functions
experiments.py Module docstring explaining parameter axes and output files; docstrings on grid/sweep/export functions
study_runner.py Module docstring explaining three-stage flow and output artifacts; run_study docstring
Spawn_Events.py Module docstring explaining tuple format and why the large block is commented out
Traci_GPT2.py Module docstring with full CLI/env-var reference and pipeline overview; fire dynamics section header with constant explanations; docstrings for LiveEventStream, WebDashboard, AgentOverlayManager, AgentMessagingBus, process_pending_departures, process_vehicles, active_fires, compute_edge_risk_for_fires, update_fire_shapes, _circle_polygon, and CLI helpers

Test plan

  • Verify no Python syntax errors: python -c "import ast; ast.parse(open('Traci_GPT2.py').read())" passes for all modified files
  • Confirm no logic changes via git diff main --stat (only line counts changed, no functional edits)
  • Review docstring accuracy against existing code logic in key files (belief_model.py, routing_utility.py, departure_model.py)

🤖 Generated with Claude Code

…ource files

Closes #6. Adds professional-grade Google-style docstrings, module-level
docstrings, and targeted inline comments to all 14 Python source files.

Changes per file:
- agent_state.py: module docstring explaining profile params and AGENT_STATES
  global; dataclass field docs; docstrings for all public functions.
- belief_model.py: module docstring explaining Bayesian pipeline; docstrings
  with threshold rationale for all functions.
- departure_model.py: module docstring explaining three-clause departure rule;
  inline comments on each clause.
- information_model.py: module docstring; docs explaining noise/delay model and
  keyword-vote social signal aggregation.
- routing_utility.py: module docstring explaining utility formula and weight
  rationale; docs on penalty lookup table and exposure formula components.
- scenarios.py: module docstring explaining three information regimes; docstrings
  on all filter/config functions.
- forecast_layer.py: module docstring; docs on margin band thresholds and fire
  growth computation.
- metrics.py: module docstring explaining five KPIs; class docstring; docstrings
  on all record/compute/export methods.
- replay.py: module docstring explaining record/replay contract and output files;
  docstrings on all methods.
- calibration.py: module docstring explaining loss formula and METRIC_SPECS
  weights; docstrings on all functions.
- experiments.py: module docstring explaining parameter axes and output files;
  docstrings on grid/sweep/export functions.
- study_runner.py: module docstring explaining three-stage study flow; docstring
  on run_study().
- Spawn_Events.py: module docstring explaining tuple format and active/disabled
  vehicle groups.
- Traci_GPT2.py: module docstring with full CLI/env-var reference and pipeline
  overview; section headers for fire dynamics config; docstrings for
  LiveEventStream, WebDashboard, AgentOverlayManager, AgentMessagingBus,
  process_pending_departures, process_vehicles, active_fires, compute_edge_risk_for_fires,
  update_fire_shapes, _circle_polygon, and CLI helpers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stedrew stedrew requested a review from legend5teve March 5, 2026 05:48
@stedrew stedrew merged commit c0ddf98 into main Mar 5, 2026
@stedrew stedrew deleted the docs/add-comments-and-docstrings branch March 5, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: add professional inline comments and docstrings across all source files

1 participant