Skip to content

Conversation

@rburghol
Copy link
Contributor

@rburghol rburghol commented Jan 9, 2026

This PR includes an overhaul to the model state system, leveraging a new object-oriented version of state, which accomplishes the following:

  • It streamlines the number of arguments passed to functions, so now, the arg state takes the place of state_ix, dict_ix, ts_ix, ...
  • Declarations of the base containers for state attributes is moved outside of the function, living directly in the state.py file, which allows these to be cached, resulting in a huge improvement in performance (recent branches had seen start-up time double due to less optimal numba caching).
  • An example of using dynamic equations has been added in tests/testcbp/HSP2results/ to test a 500 equation addon simulation (Use: cp PL3_5250_0001.json.manyeq PL3_5250_0001.json to test).
  • Some cleanup of arguments in function like hydr() and sedtrn() to eliminate the argument io_manager as this is no longer used (I think this has been due for a while, I don't think it is due to any changes that I recall making to the code but it seems like a cleaner approach)

@rburghol
Copy link
Contributor Author

rburghol commented Jan 9, 2026

Hey @PaulDudaRESPEC sorry in advance for the spam as I work out some last minute kinks revealed in the Git testing routines.

@rburghol
Copy link
Contributor Author

rburghol commented Jan 9, 2026

OK - @PaulDudaRESPEC the running part is good, but there is a trouble with the tests, which I cannot tell if the values are not matching up? (my desktop tests have revealed the same values, but I can revisit if needed see Table 1).

  • It looks more procedural, the error apears as: FAILED tests/test_regression.py::test_case[test10specl] - KeyError: '/STATE/timer'
    • I can confirm the entry /STATE/timer should be and IS in the in-memory simulation, is it saying that it needs to be in the hdf5?
  • When I run manually with pytest -k test10specl according to the instructions (loosely following!) it appears to pass? (see pytest below)
  • I realize now that the tests I am looking at likely stem from test_regression.py, rather than pytest. A more detailed excerpt is below as test_regression.py, and the full report is here: https://github.com/respec/HSPsquared/actions/runs/20860244981/job/59937734415?pr=202

test_regression.py

2026-01-09 17:39:07.65   Processing started for file /home/runner/work/HSPsquared/HSPsquared/tests/test10specl/HSPFresults/test10specl.h5; saveall=True
STATE initializing contexts.
=========================== short test summary info ============================
FAILED tests/test_regression.py::test_case[test10specl] - KeyError: '/STATE/timer'
=================== 1 failed, 3 passed in 190.44s (0:03:10) ====================
/opt/hostedtoolcache/Python/3.11.14/x64/lib/python3.11/site-packages/tables/file.py:130: UnclosedFileWarning: Closing remaining open file: /home/runner/work/HSPsquared/HSPsquared/tests/test10specl/HSPFresults/test10specl.h5
  warnings.warn(UnclosedFileWarning(msg))
Error: Process completed with exit code 1.

pytest

pytest -k test10specl
============================================== test session starts ==============================================
platform linux -- Python 3.9.5, pytest-8.4.2, pluggy-1.6.0
rootdir: /opt/model/HSPsquared
configfile: pyproject.toml
plugins: xdist-3.8.0, cov-7.0.0
collected 4 items / 3 deselected / 1 selected

tests/test_regression.py


.                                                                                [100%]

================================== 1 passed, 3 deselected in 148.34s (0:02:28) ==================================

Table 1

HSP2 no specl HSPF no specl HSPF w/specl HSP2 w/specl HSP2 w/EQ
167.012 167.013 167.035 167.033 167.033
180.398 180.397 227.732 227.636 227.636
212.764 212.763 307.26 307.219 307.219
223.543 223.541 365.287 365.215 365.215
229.247 244.982 418.175 418.135 418.135

@rburghol rburghol mentioned this pull request Jan 10, 2026
2 tasks
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.

1 participant