Skip to content

Replace look-ahead reads of optional drydep inputs with explicit spec lines - #237

Merged
jcurtis2 merged 1 commit into
masterfrom
drydep_use_defaults
Dec 2, 2026
Merged

jcurtis2 merged 1 commit into
masterfrom
drydep_use_defaults

Conversation

@jcurtis2

Copy link
Copy Markdown
Collaborator

Summary

Two spec-file readers decide whether an optional line is present by reading the next line and then rewinding with spec_file_unread_line:

  • spec_file_read_scenario: optional drydep_params after loss_function drydep
  • spec_file_read_run_sect: optional do_aero_dilution

This PR replaces both look-aheads with explicit spec lines. The input format is then strictly sequential again, the same as other optional inputs such as do_fractal or do_coagulation, where a flag decides what follows.

Motivation

PyPartMC reads PartMC inputs from Python dicts by key, so there is no "next line" to look at. Supporting the look-ahead meant emulating line order from dict key order, potentially a complicated solution on that end.

Changes

  • When loss_function is drydep, the next line must be drydep_use_defaults (logical). If it is no, it must be followed by drydep_params <file>.
  • In sectional runs, do_aero_dilution is required when loss_function is drydep and is not read otherwise; dilution is then always applied.
  • Updated the docs and spec files
  • spec_file_unread_line is no longer called and removed.

Input format change

Spec files with loss_function drydep need the new line:

loss_function drydep
drydep_use_defaults no            # yes: use defaults, no: read drydep_params
drydep_params drydep_params.dat

Sectional drydep specs must include do_aero_dilution.

Testing

  • scenarios/7_drydep modal run: with drydep_use_defaults no the parameter file is read (final N = 2.52e9 m^-3); with yes the defaults are used (1.69e9 m^-3).
  • Sectional edge cases: a drydep run without do_aero_dilution, and a loss_function none run that includes it, both fail at the right line; a none run without it works.
  • PyPartMC built against this branch with its look-ahead emulation removed: full test suite passes. The PyPartMC change will follow once this is merged and the submodule is bumped.

@jcurtis2 jcurtis2 self-assigned this Nov 20, 2026
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.53%. Comparing base (0158758) to head (de8d642).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #237      +/-   ##
==========================================
+ Coverage   78.48%   78.53%   +0.05%     
==========================================
  Files          56       56              
  Lines        9815     9801      -14     
==========================================
- Hits         7703     7697       -6     
+ Misses       2112     2104       -8     

☔ View full report in Codecov by Harness.
📢 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.

@slayoo

slayoo commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

thank you, @jcurtis2 & @mwest1066

@slayoo

slayoo commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

@jcurtis2, after routing the partmc submodule to this branch, the PyPartMC PR 560 compiles OK!
During tests, there are expected failures:

tests/test_loss_rate.py::TestLossRate::test_loss_rate[loss_function_params2] PASSED
WARN: provided data is missing the "drydep_use_defaults" entry
terminate called without an active exception

@jcurtis2
jcurtis2 merged commit 8669e9c into master Dec 2, 2026
11 checks passed
@jcurtis2
jcurtis2 deleted the drydep_use_defaults branch December 2, 2026 20:18
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.

3 participants