Skip to content

feat: #989 - [M4-P7] Jupytext Migration: Dynamics/Coagulation Charge (2 notebooks)#1005

Merged
Gorkowski merged 2 commits intouncscode:mainfrom
Gorkowski:issue-989-adw-8d4a38b7
Jan 31, 2026
Merged

feat: #989 - [M4-P7] Jupytext Migration: Dynamics/Coagulation Charge (2 notebooks)#1005
Gorkowski merged 2 commits intouncscode:mainfrom
Gorkowski:issue-989-adw-8d4a38b7

Conversation

@Gorkowski
Copy link
Collaborator

Target Branch: main

Fixes #989 | Workflow: 8d4a38b7

Summary

Converts the two charged coagulation tutorials to Jupytext py:percent scripts, aligns their headers with the M4-P6 template, and syncs the generated .py files back to their .ipynb counterparts. The notebooks were linted, synced, executed, and verified to produce finite, non-empty plots while continuing to rely on the current API surfaces.

What Changed

New Components

  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.py - Percent-format script for the builder-pattern charged coagulation tutorial with the canonical Jupytext metadata.
  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.py - Percent-format script for the functional/factory charged coagulation tutorial with matching metadata and presentation cells.

Modified Components

  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.ipynb - Synced execution counts, outputs, and cleaner metadata after linting the paired .py file.
  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.ipynb - Synced outputs, execution metadata, and added the standard percent header after linting.
  • adw-docs/dev-plans/maintenance/M4-jupytext-full-migration.md & adw-docs/dev-plans/maintenance/index.md - Marked M4-P7 complete and added completion notes.
  • adw-docs/documentation_guide.md - Documented that the Dynamics/Coagulation charge tutorials now have Jupytext percent coverage and reminded readers to execute after syncing.
  • docs/Examples/Dynamics/index.md - Reworded the overview to mention the charge tutorials in the Jupytext coverage list.
  • docs/Examples/Notebooks/Custom_Nucleation_Single_Species.py - (Unrelated formatting change logged in the diff, appears to be a small metadata fix.)

Tests Added/Updated

  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.ipynb - Execution validated via python3 .opencode/tool/run_notebook.py .../Coagulation_with_Charge_objects.ipynb.
  • docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.ipynb - Execution validated via python3 .opencode/tool/run_notebook.py .../Coagulation_with_Charge_functional.ipynb.

How It Works

Each notebook is now paired with a py:percent file that carries the canonical M4-P6 Jupytext header, keeping markdown, code, and execution order intact. After conversion, the .py files are linted (ruff check --fixruff formatruff check), synced back to the .ipynb files, and executed to prove there are no API regressions or empty plots. The notebooks continue using the charged coagulation builder/factory flows with the Coulomb Gatti 2008 kernel and the same transport-property setup as before.

Implementation Notes

  • Why this approach: Converting to percent scripts keeps tutorials editable as plain Python while preserving rich notebook outputs after syncing.
  • API stability: No imports or signatures needed updating; existing charged coagulation helper calls remain compatible with the current particula API.
  • Documentation updates: Maintenance/index, migration plan, and documentation guides now state that the charge tutorials are part of the Jupytext coverage, and completion notes document the outcome.

Testing

  • Manual verification: python3 .opencode/tool/run_notebook.py docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.ipynb
  • Manual verification: python3 .opencode/tool/run_notebook.py docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.ipynb

Converted charged coagulation tutorials to percent format with consistent headers and updated docstrings/formatting so the notebooks match the repo standards. The nucleation guide text was refreshed to align with the updated style.

Closes uncscode#989

ADW-ID: 8d4a38b7
Align charged coagulation tutorials with Jupytext paired workflow, update kernelspecs, and refresh maintenance documentation.

- Mark M4-P7 charged coagulation migration completed in maintenance plan and index
- Document Jupytext coverage and edit/execute workflow for charged coagulation docs page
- Tighten tutorial descriptions in functional and object charged coagulation notebooks
- Standardize kernelspec display name to particula_dev312 in nucleation example
- Note paired Jupytext workflow and executed outputs on Dynamics index

Closes uncscode#989

ADW-ID: 8d4a38b7
Copilot AI review requested due to automatic review settings January 31, 2026 02:25
@Gorkowski Gorkowski added agent Created or managed by ADW automation blocked Blocked - review required before ADW can process labels Jan 31, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes Phase 7 (M4-P7) of the Jupytext full migration maintenance plan by converting two charged coagulation notebooks to Jupytext py:percent format. The notebooks demonstrate charged coagulation workflows using both builder and factory patterns with the Coulomb Gatti 2008 kernel.

Changes:

  • Converted two charged coagulation tutorials to Jupytext paired format (.py.ipynb)
  • Updated documentation to reflect Jupytext coverage for charge tutorials
  • Marked M4-P7 as completed in maintenance plan with completion notes

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.py New Jupytext percent script demonstrating builder-pattern charged coagulation with proper metadata header and docstrings
docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.py New Jupytext percent script demonstrating factory-pattern charged coagulation with matching structure
docs/Examples/Dynamics/index.md Updated to document Jupytext pairing for charge tutorials with edit instructions
adw-docs/documentation_guide.md Added charge tutorials to list of Jupytext-paired coverage examples
adw-docs/dev-plans/maintenance/M4-jupytext-full-migration.md Marked M4-P7 tasks complete and added detailed completion notes
adw-docs/dev-plans/maintenance/index.md Updated status to show P7 completion
docs/Examples/Nucleation/Notebooks/Custom_Nucleation_Single_Species.py Minor cleanup: standardized kernelspec display name, improved docstrings, fixed unused loop variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

plt.rcParams["figure.dpi"] = 110

# %% [markdown]
# ## Define the particle size distribution We build a logarithmic radius grid (1 nm to 10 μm) and the corresponding mass bins assuming unit density.
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown cell is missing a line break after the section heading. It should have a blank line between "## Define the particle size distribution" and the description "We build a logarithmic radius grid...".

Suggested change
# ## Define the particle size distribution We build a logarithmic radius grid (1 nm to 10 μm) and the corresponding mass bins assuming unit density.
# ## Define the particle size distribution
#
# We build a logarithmic radius grid (1 nm to 10 μm) and the corresponding mass bins assuming unit density.

Copilot uses AI. Check for mistakes.

Examples:
>>> builder = par.dynamics.ChargedCoagulationBuilder()
>>> builder.set_distribution_type("discrete").set_charge_kernel(...)
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring example shows set_charge_kernel(...) but the actual code at line 125 uses set_charged_kernel_strategy(kernel_strategy). The example should match the actual API method name.

Suggested change
>>> builder.set_distribution_type("discrete").set_charge_kernel(...)
>>> builder.set_distribution_type("discrete").set_charged_kernel_strategy(...)

Copilot uses AI. Check for mistakes.
@Gorkowski Gorkowski merged commit f99a589 into uncscode:main Jan 31, 2026
14 checks passed
@Gorkowski Gorkowski deleted the issue-989-adw-8d4a38b7 branch January 31, 2026 03:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Created or managed by ADW automation blocked Blocked - review required before ADW can process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M4-P7] Jupytext Migration: Dynamics/Coagulation Charge (2 notebooks)

1 participant