feat: #989 - [M4-P7] Jupytext Migration: Dynamics/Coagulation Charge (2 notebooks)#1005
Conversation
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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...".
| # ## 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. |
|
|
||
| Examples: | ||
| >>> builder = par.dynamics.ChargedCoagulationBuilder() | ||
| >>> builder.set_distribution_type("discrete").set_charge_kernel(...) |
There was a problem hiding this comment.
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.
| >>> builder.set_distribution_type("discrete").set_charge_kernel(...) | |
| >>> builder.set_distribution_type("discrete").set_charged_kernel_strategy(...) |
Target Branch:
mainFixes #989 | Workflow:
8d4a38b7Summary
Converts the two charged coagulation tutorials to Jupytext
py:percentscripts, aligns their headers with the M4-P6 template, and syncs the generated.pyfiles back to their.ipynbcounterparts. 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.pyfile.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 viapython3 .opencode/tool/run_notebook.py .../Coagulation_with_Charge_objects.ipynb.docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.ipynb- Execution validated viapython3 .opencode/tool/run_notebook.py .../Coagulation_with_Charge_functional.ipynb.How It Works
Each notebook is now paired with a
py:percentfile that carries the canonical M4-P6 Jupytext header, keeping markdown, code, and execution order intact. After conversion, the.pyfiles are linted (ruff check --fix→ruff format→ruff check), synced back to the.ipynbfiles, 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
particulaAPI.Testing
python3 .opencode/tool/run_notebook.py docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_objects.ipynbpython3 .opencode/tool/run_notebook.py docs/Examples/Dynamics/Coagulation/Charge/Coagulation_with_Charge_functional.ipynb