Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop eq #178

Merged
merged 9 commits into from
Dec 3, 2024
Merged

Develop eq #178

merged 9 commits into from
Dec 3, 2024

Conversation

rburghol
Copy link
Contributor

@rburghol rburghol commented Oct 2, 2024

This contains a number of cosmetic/formatting changes (ruff) as well as enhancements to operational model that underlies special actions:

  • Removes reliance on implicit global variable state defined on the base ModelObject class in favor of passing state in as an argument during object creation. (makes the code read more sensibly, as well as avoiding implicit globals, this is something that @austinorr and I discussed and ultimately held our nose on during last revision, but now is fixed)
    • Explicitly defines object containers for RCHRES segments on state during state_om_model_root_object() instead of relying on old implicit global state property
    • Updated previous operational model primitives to use state as create arguments (om_model_object,py, om_model_linkage.py, om_special_action.py, om_simtimer.py)
  • Adds generic Equation object to operational model, which will underly next set of special actions (UVQUAN, UVNAME ...) as well as serving to add an operational element that can be used for a more robust operational framework that is not limited in ways that special actions are.
    • Simple arithmetic expressions with unlimited number of operands are supported (+, -, /, *)
    • Power operation e.g. x ^ y
    • Parentheses for execution hierarchy are fully supported
    • Any variable that is present in state_ix is available for use in equations.
    • Added tests/test10eq to verify execution of simple equation with +. This uses a json file with 3 equation objects that replicate the special action changes to SEDTRN from tests/test10specl, and in my desktop analysis the Equation approach replicated SPECL to 7 significant digits.
    • Note: @timcera I need help figuring out how to get a package, pyparsing, to install during testing. I have previously added things to environment.yml but that was unsuccessful this time around. Any tips would be appreciated.
      • Update: I got it to install by adding pyparsing to dependencies in pyporoject.toml, but not sure if I went about it correctly, please advise.
  • Added basic timeseries retrieval and population from h5 into state/ts_ix. Tests forthcoming in future PR.

@PaulDudaRESPEC @timcera

@timcera
Copy link
Contributor

timcera commented Oct 4, 2024

The "pyparsing" entry in pyproject.toml is all that is needed to work for both pip and conda packages.

@rburghol
Copy link
Contributor Author

rburghol commented Oct 4, 2024

@timcera thanks a bunch for the advice/review!

@PaulDudaRESPEC
Copy link
Member

This looks great, @rburghol . Only (very minor) concern is that we might have lost a little of the auto-formatting that @timcera added.... I guess this will be a test to see if the merge picks up the formatting discrepancies.

@PaulDudaRESPEC PaulDudaRESPEC merged commit e99feb6 into respec:develop Dec 3, 2024
11 checks passed
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