Skip to content

Migrate docs/literate ScenarioResult plot recipe into CellularSheavesPlots extension#59

Draft
Copilot wants to merge 3 commits into
jpf/plot_refactorfrom
copilot/migrate-docs-literate-examples
Draft

Migrate docs/literate ScenarioResult plot recipe into CellularSheavesPlots extension#59
Copilot wants to merge 3 commits into
jpf/plot_refactorfrom
copilot/migrate-docs-literate-examples

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Centralizes custom plotting logic into the CellularSheavesPlots weak-dependency extension rather than defining it inline in literate examples. All literate files that call using Plots already trigger the extension automatically via Julia's weak-dependency mechanism — no further changes needed there.

Changes

  • ext/CellularSheavesPlots.jl: Imports ScenarioResult from CellularSheaves.ControlSheaves.MultiAgentTracking and adds the @recipe for ScenarioResult (two-panel y(t)/z(t) figure). Uses sr.y_col/sr.z_col stored on the struct in place of the inline IDX_Y/IDX_Z constants.

  • docs/literate/control/multi_quadrotor_target_tracking.jl: Removes the inline ## Plot Recipe section. Adds a comment at the using Plots call noting that the extension provides the recipe.

# Before: recipe defined inline in the literate file
@recipe function f(sr::ScenarioResult)
    ...
    sr.times, getindex.(traj_j, IDX_Y)   # relied on locally-scoped constant
end

# After: recipe lives in ext/CellularSheavesPlots.jl; extension loads on `using Plots`
sr.times, getindex.(traj_j, sr.y_col)    # uses struct field instead

Other literate files (nullspace.jl, trajectory_sheaf.jl, sheaf_laplacian_benchmarks.jl, control examples) use only standard plot/plot!/spy calls with no custom types or recipes, so they require no changes.

Original prompt

Let's migrate all the /docs/literate examples to use the new package extension and make sure the docs build still succeeds.

[Chronological Review: The conversation began with a request to discuss a refactoring plan for the plotting code in the CellularSheaves.jl project. The user aimed to centralize plotting logic into a new extension called CellularSheavesPlots. The user then provided several attachments, including documentation and scripts related to plotting. The user specified that certain plots in the plotter and figure generation scripts should remain unchanged during the initial refactor phase. The user requested an updated plan reflecting these constraints and initiated the implementation in the cloud. The conversation progressed to migrating documentation examples to utilize the new package extension while ensuring the documentation builds successfully.]

[Intent Mapping:

  • "Let's look at this refactoring plan and discuss how to improve the code base..." - User wants to centralize plotting logic.
  • "the plots in #file:plotter.jl and #file:generate_figures.jl... should not be changed..." - User specifies which plots to exclude from changes.
  • "Can you update the plan to reflect that?" - User requests an updated refactoring plan.
  • "show me the updated plan" - User asks to see the revised plan.
  • "Start implementation in the cloud" - User initiates the implementation phase.
  • "continue with a stash" - User indicates to proceed with a stash operation.
  • "Let's migrate all the /docs/literate examples to use the new package extension..." - User wants to ensure documentation examples are updated and functional.]

[Technical Inventory:

  • Core Technology: Julia programming language.
  • Framework/Library: Plots.jl for plotting.
  • Architectural Pattern: Refactoring to create a new extension for centralized plotting.
  • Environment Detail: The project is hosted on GitHub, and the user is working on documentation and examples related to the CellularSheaves.jl package.]

[Code Archaeology:

  • File: 001_plotting_refactor_plan.md: Outlines the plan for refactoring plotting logic into the CellularSheavesPlots extension.
  • File: single_integrator_target_tracking.md: Contains examples of plots that need to be updated.
  • File: acc26_experiments.jl: Generates pre-computed CSV data for documentation.
  • File: generate_figures.jl: Script for generating figures, which should remain unchanged.
  • File: plotter.jl: Contains plotting logic that should not be altered in the initial phase.]

[Progress Assessment:

  • Completed Tasks: Initial refactoring plan created and shared.
  • Partially Complete Work: User is in the process of updating the plan and migrating documentation examples to the new extension.
  • Validated Outcomes: No specific features confirmed working yet as the migration is still in progress.]

[Context Validation: All critical information for continuation is captured, including the need to update the refactoring plan and migrate documentation examples while ensuring the build succeeds.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to "show me the updated plan" and "Start implementation in the cloud."
  • Tool Results Summary: No specific tool results were returned as the focus was on planning and migration.
  • Pre-Summary State: The agent was actively working on updating the refactoring plan and preparing for implementation in the cloud.
  • Operation Context: These commands were executed to align the project with the user's goal of centralizing plotting logic while maintaining existing functionality in certain scripts.]
1. Conversation Overview: - Primary Objectives: User aims to centralize plotting logic into the CellularSheavesPlots extension, while ensuring certain existing plots remain unchanged during the initial phase. - Session Context: The conversation flowed from discussing the refactoring plan to specifying which plots to exclude from changes, requesting an updated plan, and initiating implementation in the cloud. - User Intent Evolution: The user started with a broad goal of refactoring, then narrowed focus to specific files and their roles in the project, culminating in a request to migrate documentation examples.
  1. Technical Foundation:
  • Core Technology: Julia programming language.
  • Framework/Library: Plots.jl for plotting.
  • Architectural Pattern: Refactoring to create a new extension for centralized plotting.
  • Environment Detail: The project is hosted on GitHub, with a focus on documentation and examples related to the CellularSheaves.jl package.
  1. Codebase Status:
  • File: 001_plotting_refactor_plan.md:
    • Purpose: Outlines the plan for refactoring plotting logic.
    • Current State: Initial plan created; awaiting updates based on user feedback.
  • File: single_integrator_target_tracking.md:
    • Purpose: Contains examples of plots that need to be updated.
    • Current State: Pe...

Created from VS Code.

jpfairbanks and others added 2 commits May 28, 2026 08:28
* Add documentation for single integrator target tracking using TrackingDSL

* Refactor Multi-Agent Tracking Module and Introduce Quadratic Cost Utilities

- Split the MultiAgentTracking.jl file into multiple files for better organization:
  - Targets.jl: Contains the BobbingTarget struct and trajectory generation function.
  - TrackingProblems.jl: Defines TrackingEdge and TrackingProblem structs along with sheaf construction and trajectory extraction functions.
  - ScenarioResults.jl: Defines the ScenarioResult struct and its display methods.
  - QuadraticCosts.jl: Introduces utilities for building and solving quadratic control costs on the tracking sheaf.

- Implemented build_control_cost_matrix to create a global quadratic cost matrix for agent controls.
- Added solve_quadratic_on_basis to optimize control inputs while respecting Laplacian constraints.
- Updated run_scenario to incorporate optional quadratic cost handling.
- Added unit tests for quadratic cost utilities to ensure correctness of cost matrix construction and optimization.

* Add Quadratic Costs module and update documentation

* Update documentation for single-integrator target tracking and configure makedocs for production

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix QuadraticCosts test imports, docstring, docs pages, and image paths

* Update module path for QuadraticCosts in documentation

* correct residual for the optimal trajectory

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.02%. Comparing base (3dc8466) to head (4e524dc).

Files with missing lines Patch % Lines
ext/CellularSheavesPlots.jl 0.00% 45 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
- Coverage   78.46%   77.02%   -1.45%     
==========================================
  Files          29       29              
  Lines        2392     2437      +45     
==========================================
  Hits         1877     1877              
- Misses        515      560      +45     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI changed the title [WIP] Migrate /docs/literate examples to new package extension Migrate docs/literate ScenarioResult plot recipe into CellularSheavesPlots extension May 28, 2026
Copilot AI requested a review from jpfairbanks May 28, 2026 14:04
@jpfairbanks jpfairbanks changed the base branch from main to jpf/plot_refactor May 28, 2026 14:22
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.

2 participants