Closed sbenthall closed 4 years ago
This is with dolo 4.9.9/master
.
Inquiring upstream at to dolo
project:
https://github.com/EconForge/dolo/issues/170
This one is a consequence of trying to hack the internals... (I remember I suggested it to Chris so I can't blame anybody).
Lines 181 and 182 are modifying the primary data model is imported from. By default field model.data
is a ruamel.yaml structure which is directly imported from the yaml file. When you do model.domain
you are actually reading this structure using dolang's method eval_data
. And this one doesn't know how to deal correctly with list structures, which is what causes the error.
If you do model_dolo.data['domain']['m'].__class__
, the answer is CommentedSed
and you are changing this type when you do model_dolo.data['domain']['m'] = [0,'max_m']
. A quick fix is to replace the latter with model_dolo.data['domain']['m'][:] = [0,'max_m']
which modifies inplace the elements of the list.
A better fix is to not rely on list manipulation. Instead, define a parameter max_m in the calibration section. And define the domain to be [0,max_m]
. do all of that in the yaml file, and if you want to change the calibration use model_dolo.set_calibration(max_m=500)
. that way you are not relying on undocumented internals.
Still, an issue should be created against dolang so that eval_data
either knows how to deal with vanilla lists/dicts or raises an error that it doesn't know how to handle the type.
Error in BufferStock python code.
I'm getting this error both when running:
$ ipython BufferStock.py
and when runnign
$ jupytext --to notebook BufferStock.py
and then opening the notebook with Jupyter.In cell 5,
# Set a maximum value of the market resources ratio m for use in both models