econ-ark / DistributionOfWealthMPC

The Distribution of Wealth and the Marginal Propensity to Consume
2 stars 8 forks source link

Refactor execution code #2

Closed sbenthall closed 1 year ago

sbenthall commented 3 years ago

The current code uses a somewhat convoluted method of setting global variables before running the main() method of the cstwMPC_main.py` script.

It would be worth looking at this to try to encapsulate it a little more. It would, among other things, make error messages from within the main code more legible.

llorracc commented 1 year ago

@sbenthall, this definitely seems worth doing. I think of this and the BufferStockTheory REMARK as the "marquee" illustrations of how to use HARK to make reproducible code, and if they can be substantially improved to make them better templates for other people, that would be worth doing.

sbenthall commented 1 year ago

It will be much easier to do this now that there is an automated test to make sure refactoring doesn't introduce errors!

First, let's work in #4 and update to 0.13.0 after the next HARK release.

llorracc commented 1 year ago

OK, sounds good.

sbenthall commented 1 year ago

Linking to the current REMARK standard here for reference: https://github.com/econ-ark/REMARK/blob/master/STANDARD.md

So for scoping this refactor:

The main problem is that current __main__ execution code, as well as the model code, depends on options being defined in global scope, which means the values aren't passed in anywhere but rather are being set through Python execution. And the execution code is contorted to make this work, at the expense of being extremely brittle.