Conversation
To make LyoPRONTO an installable package, we need a pyproject.toml. Since there have been a few improvements, I will publish a release and call it 1.1.
1) Add a test suite with comprehensive coverage * Run documentation notebooks as part of test suite, using papermill 2) Fix some problems uncovered by that test suite * Using fraction vs % in drying completion * Have calc_knownRp end when ramps end, per old API * Have calc_knownRp provide interpolated values at all time points, if dt!=None, per old API * Eliminate some infinite loops in design space calculation * Rework time handling for freezing 3) Use pyproject.toml for everything possible 4) Build docs for PRs, but don't deploy because I couldn't get Actions runner correct permissions 5) Format the test suite with ruff 6) Introduce a RampInterpolation class, which is currently only used in freezing, testing, and calc_knownRp but could apply everywhere 7) Emit proper warnings, not just print to stdout 8) Add a dev section to docs ---- All commits: * Add testing-related files from SECQUOIA fork * Missed a file * Have tests use pyproject.toml, not requirements.txt * add pandas as dev dep * fix tests: replace math.exp with np.exp * fix: calc_knownRp uses percent rather than 0-1 * clean whitespace * fix: Handle edge case in design space * Move helper func to separate module under tests * Fix tests for unknownRp * Note that edge case needs treatment * cleanup * Include pytest settings in pyproject.toml * Fully move all tests to percent dried, not fraction * Further test cleanup * Ignore some local things * Standardize calc_unknownRp tests * Fix a bug in design space, uncovered by tests * DRY the tests out a bit * Eliminate one cause of infinite loops in design space * fix: give an initial guess in acceptable range * Make a start on handling cases where optimization fails for Pch * Get all tests passing, skip those that address problems which don't exist yet * dry out Tsh a little bit * Get all opt_Pch tests passing * Get some Tsh tests passing * Get joint optimization tests passing * Remove separate "coverage" tests * Complete line coverage of opt_Pch * Unify Pch_Tsh optimization, with complete coverage * default ramp rate of no ramp, if not supplied * Add Tmax parameter to assert_physically_reasonable_output * Tweak path handling * Include results from web API in repo, for test comparisons * Add coverage defaults to testing * Rename for clarity, delete duplicate tests * Consolidate calc_unknownRp into one file * Make unknownRp give useful warnings, test those warnings * lint * Add warnings for design space, consolidate tests,, get complete test coverage * Consolidate * Consolidate and clarify knownRp tests * clarify deps * Get a proper regression test passing on calc_knownRp by taking dt and max time into account more carefully * Work on increasing coverage * Remove redundant test * Make path to test data have one source of truth * Standardize a magic number * Test failures * Add one more testing utility function * Fix and clean up freezing, clean up tests, add tests to reach 100% coverage * Make example scripts with plots part of the test suite * Add tests which execute notebooks; rework CI to run papermill within pytest, rather than from papermill command line * Fix compat bound * fix: don't have notebooks run together with "PR tests" * Separate out notebook dependencies from docs building dependencies * Import papermill inside notebook tests * Try out writing PR version of docs again * try again pr docs * one more thing to try * move permissions? * Give up on PR versions of docs from Actions * Clean up unused config * Make one category of dev deps, not two * Remove unused testing script * Delete obsolete test * Modify equations being solved to account for varying shelf temperature during crystallization * Add reference test for freezing * Add new reference data for opt_Pch * Point to correct file * Test reference case for opt_Pch * Give opt_pch reference case its own inputs setup * Take some of Copilot's review suggestions * Linting * Ruff formatting. Lots of whitespace noise, all single quotes to double quotes * Get *a* reference test working for opt_Pch * unnecessary imports * Relax tolerance * Help diagnose CI failure * Bite the bullet and add a time interpolator for Tshelf and Pchamber * Make RampInterpolator conform to existing API for dt_setpt, with kwarg for changing to other interpretation * Add more consistency checks to optimization tests, use some np.testing utilities * Fix freezing reference to be closer to original interpretation * Get one last test passing * ruff format on tests * Remove unused sections from pyproject.toml * Make some dev docs, shuffle things into there from README, etc. * Add some extra helpers for RampInterpolator, use in calc_knownRp
This PR syncs SECQUOIA/LyoPRONTO main with the upstream LyoHUB/LyoPRONTO repository. Key changes from upstream: - lyopronto/functions.py: RampInterpolator class, improved lumped_cap_Tpr functions - lyopronto/calc_*.py: Better error handling, PCHIP interpolation - lyopronto/opt_*.py: Improved optimizer robustness - tests/: Comprehensive test suite from upstream - CI: Updated workflow configurations This establishes a clean foundation for adding Pyomo integration.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Specific changes and improvements, beyond the overall main script restructuring: 1. Replace hyphens with spaces in "Design Space Generator" 2. Replace "Y" and "N" with True and False 3. Introduce YAML format for storing input data 4. Bisection search for fitting best Kv 5. Improve correctness of design space plots 6. Fix a bug with multiple ramps in freezing simulation --- All commit messages: * Make plot functions much more terse by passing kwargs and fetching a couple defaults * Further plot recipe cleanup, add two more * Refactor the main script to call functions defined in lyopronto package * kwarg name fix * fix * Move data load to main script, not helper function, to emphasize user changing it * Switch to bisection search for best Kv, not iteration over array * Format with ruff * Rename "config" to "inputs" * Make ruamel.yaml an outright dependency * Change some defaults * Improve clarity of tests, add docs stub for design space * Overhaul the design space plots, including fixing some correctness bugs * Minor cleanup * Move high-level API from __init__ to its own module, make available from wildcard import * Record temp data filename in inputs, but not the full arrays * Add some tests that run YAML inputs through the full main script * Fix possible bug due to unclear code in crystallization time bracketing * fix filename casing so tests find them * Cleanup in design space plots * Test high-level functionality for all modes * Check in most recent version of docs notebooks * Update the main script for clarity * Minor cleanups, prompted in part by Copilot * Focus main tests on IO logic, etc., not on correctness * Add a little function documentation. * Get rid of alternate (hyphenated) spelling for design space * Unnecessary assignments * Use context manager for file opening, as recommended by Copilot * Take some more Copilot suggestions * Catch and fix another bug in freezing, for multiple ramps
There was a problem hiding this comment.
Pull request overview
This PR syncs SECQUOIA/LyoPRONTO with upstream LyoHUB/LyoPRONTO, bringing in upstream physics/solver changes (notably ramp handling and smoother output interpolation), expanded tests + reference data, and updated CI/docs tooling to establish a clean baseline before Pyomo integration.
Changes:
- Adds/updates ramped setpoint handling and smoother output interpolation (PCHIP) in core simulation utilities.
- Updates multiple simulators/optimizers/freezing/design-space logic and normalizes messaging via warnings.
- Imports upstream test suite, notebook-based doc smoke tests, reference data, and CI/doc build configuration updates.
Reviewed changes
Copilot reviewed 35 out of 42 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
tests/utils.py |
Adds shared test validators for physical reasonableness and completion checks. |
tests/test_opt_Tsh.py |
Updates opt_Tsh tests to use shared validators and adds edge cases/reference comparisons. |
tests/test_opt_Pch_Tsh.py |
Updates joint-optimizer tests and adds comparative validation vs single-variable optimizers. |
tests/test_opt_Pch.py |
Refactors pressure-optimizer tests with shared consistency checks and additional scenarios. |
tests/test_freezing.py |
Replaces/expands freezing tests to cover ramping, edge cases, and reference comparisons. |
tests/test_example_scripts.py |
Switches smoke tests from legacy scripts to notebook execution via papermill markers. |
tests/test_design_space.py |
Refactors design-space tests with fixtures and expands edge-case coverage. |
tests/test_calc_unknownRp.py |
Refactors unknown-Rp tests with fixtures, warnings assertions, and broader schedules. |
tests/test_calc_knownRp.py |
Adds comprehensive known-Rp integration/regression tests and reference comparisons. |
tests/conftest.py |
Standardizes fixtures and adds repo/test-data path fixtures used across suite. |
test_data/reference_design_space.csv |
Normalizes reference CSV formatting (line endings/structure). |
pyproject.toml |
Updates dependency groups (dev/docs), switches tooling to Ruff, configures pytest/coverage/markers, updates URLs. |
mkdocs.yml |
Adds contributor/dev documentation page to the docs nav. |
lyopronto/plot_styling.py |
Updates plot label to “Percent Dried” to match output semantics. |
lyopronto/opt_Tsh.py |
Improves warning behavior and ramp-rate handling for pressure schedule. |
lyopronto/opt_Pch_Tsh.py |
Minor refactor of objective function definition and cleanup imports. |
lyopronto/opt_Pch.py |
Improves bounds/initialization and adds optimization failure handling; updates output semantics. |
lyopronto/functions.py |
Adds RampInterpolator, improves freezing helpers, changes drying output to use percent dried, and uses PCHIP interpolation in fill_output(). |
lyopronto/freezing.py |
Refactors freezing to use RampInterpolator, improves warning behavior, and updates lumped-cap usage. |
lyopronto/design_space.py |
Adds feasibility checks/warnings, refactors solving, and improves edge-case handling. |
lyopronto/calc_unknownRp.py |
Improves warnings, normalizes units/comments, and adjusts output semantics. |
lyopronto/calc_knownRp.py |
Switches to ramp interpolators for schedules, adds feasibility checks, and updates solver horizon logic. |
docs/index.md |
Removes “documentation setup links” from landing page (moved to dev docs). |
docs/how-to-guides.md |
Updates guidance to point to notebook-based examples. |
docs/explanation.md |
Documents that dt_setpt includes ramp time. |
docs/dev.md |
Adds contributor-focused docs for testing, docs build/deploy, and linting. |
__init__.py |
Removes unused imports and keeps package re-export minimal. |
README.md |
Updates/shortens README content and removes old badges/sections. |
.gitignore |
Adds ignores for conda environment file and local IDE settings. |
.github/workflows/tests.yml |
Moves CI installs to pyproject-based installs and caches on pyproject.toml. |
.github/workflows/slow-tests.yml |
Same as tests workflow: pyproject-based installs and caching. |
.github/workflows/rundocs.yml |
Refactors notebook CI to install from pyproject and run non-notebook tests with coverage output. |
.github/workflows/pr-tests.yml |
Updates PR test behavior to skip notebook tests and use pyproject-based installs. |
.github/workflows/docs.yml |
Updates docs build/deploy flow using docs extra dependencies and pushes gh-pages. |
…tion - Delete tests/test_helpers.py: incompatible with upstream (checked fraction 0-1 but upstream code outputs percent 0-100) - Fix tests/test_calculators.py: switch to utils.py, update fraction-based assertions to percent-based (>= 0.99 → >= 99.0, <= 1.01 → <= 101.0), fix np.trapz → np.trapezoid for numpy 2.x - Fix tests/test_calc_unknownRp_coverage.py: use local helper without Tsub <= Tsh check (unknown Rp can have transient edge cases) - Fix tests/test_opt_Pch_coverage.py: switch to utils.py, update assertions - Fix tests/test_opt_Pch_Tsh_coverage.py: switch to utils.py, keep >= 0.99 for completion check (opt_Pch_Tsh returns fraction, not percent) - Fix tests/test_coverage_gaps.py: accept NaN in design space output for single-timestep completion edge case (design_space.dry sets NaN by design) - Add small_vial fixture to tests/conftest.py Fixes: missing 'small_vial' fixture (ERROR), dried fraction <= 1.0 assertions failing against percent output (5 FAILs), NaN assertion (1 FAIL)
Source code fixes: - opt_Pch_Tsh.py, opt_Tsh.py: Remove /100.0 from percent_dried output to be consistent with opt_Pch.py and calc_knownRp.py (all now output percent 0-100, not fraction 0-1) - calc_knownRp.py: Convert Pch_t(0) to mTorr in early-return path - functions.py: Fix fill_output shape mismatch by indexing [0] on exact time matches CI fix: - pr-tests.yml: Fix draft check comparing to 'true' string explicitly Test fixes (addressing Copilot review comments): - test_calc_knownRp.py: Fix test ordering (set cSolid before running sim) - test_opt_Pch.py, test_opt_Pch_Tsh.py: hasattr on dict -> 'max' in dict - test_opt_Tsh.py: hasattr -> 'in' for dict, multiply Pch_check by Torr_to_mTorr for unit consistency - test_freezing.py: Fix tautological assertion (compare to shelf temp) - test_opt_Pch.py: Add tolerance for cross-version float precision - test_opt_Pch_Tsh.py: Add 10% tolerance for optimizer bound adherence - test_optimizer.py: Update fraction->percent expectations for opt_Tsh - test_web_interface.py: Update fraction->percent expectations - test_opt_Pch_Tsh_coverage.py: Update fraction->percent assertion All 216 tests passing, 2 skipped.
Add MathJax (KaTeX didn't work in local testing)
New upstream changes: - Refactor main script: new high_level.py module, YAML-based inputs, test_main.py (LyoHUB#9) - Bump version from 1.0.0 to 1.1.0 - Add MathJax to docs (LyoHUB#15) - Fix crystallization_time_FUN brentq bracket (0, 100) instead of (t0, t0+100) - Rename config -> inputs throughout calc_knownRp.py and functions.py
- Add ruamel.yaml to environment.yml (new upstream core dependency) - Add pytest-mock to environment.yml (needed for upstream test_main tests) - Register 'main' pytest marker in pytest.ini (matches pyproject.toml)
contextlib.chdir was added in Python 3.11, but pyproject.toml declares requires-python >= 3.8. Replace with a local os.chdir-based context manager that works on all supported Python versions.
This was referenced Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR syncs SECQUOIA/LyoPRONTO main with the upstream LyoHUB/LyoPRONTO repository.
Key Changes from Upstream
Physics Improvements
lyopronto/functions.py: AddedRampInterpolatorclass for shelf temperature rampinglumped_cap_Tpr_abstract,lumped_cap_Tpr_ice,lumped_cap_Tpr_solfunctionscrystallization_time_FUNwithTsh_funcparameter for dynamic shelf temperaturefill_output()now uses PCHIP interpolation for smoother resultsOptimizer Robustness
lyopronto/opt_Pch.py: Improved error handling and boundslyopronto/opt_Tsh.py: Warning imports, ramp_rate handlinglyopronto/opt_Pch_Tsh.py: Code formatting improvementsTest Suite
CI/CD
Why This PR?
This establishes a clean foundation synced with upstream before adding Pyomo integration in subsequent PRs.
Part of Pyomo Integration Series
This is PR 0 of 8 in the Pyomo integration series: