3.0.0
enekomartinmartinez
released this
23 May 08:27
·
267 commits
to master
since this release
New Features
-
The new Abstract Model Representation translation and building workflow will allow to add new output languages in the future.
-
Added new properties to the pysd.py_backend.model.Macro to make more accessible some information: namespace, subscripts, dependencies, modules, doc.
-
Cleaner Python models:
- _namespace and _dependencies dictionaries have been removed from the file.
- Variables original names, dependencies metadata now are given through pysd.py_backend.components.Component.add() decorator, instead of having them in the docstring.
Merging of variable equations is now done using the coordinates to a pre-allocated array, instead of using the magic function pysd.py_backend.utils.xrmerge(). - Arranging and subseting arrays are now done inplace instead of using the magic function pysd.py_backend.utils.rearrange().
Breaking changes
- Set the argument flatten_output from run() to True by default. Previously it was set to False by default.
- Move the docstring of the model to a property, doc. Thus, it is not callable anymore.
- Allow the function pysd.py_backend.functions.pulse() to also perform the operations performed by pysd.py_backend.functions.pulse_train() and pysd.py_backend.functions.pulse_magnitude().
- Change first argument of pysd.py_backend.functions.active_initial(), now it is the stage of the model and not the time.
- Simplify the function pysd.py_backend.utils.rearrange() orienting it to perform simple rearrange cases for user interaction.
- Move pysd.py_backend.statefuls.Model and pysd.py_backend.statefuls.Macro to pysd.py_backend.model.Model and pysd.py_backend.model.Macro, respectively.
- Manage all kinds of lookups with the pysd.py_backend.lookups.Lookups class.
- Include a second optional argument to lookups functions to set the final coordinates when a subscripted variable is passed as an argument.
Deprecations
- Remove pysd.py_backend.utils.xrmerge(), pysd.py_backend.functions.pulse_train(), pysd.py_backend.functions.pulse_magnitude(), pysd.py_backend.functions.lookup(), pysd.py_backend.functions.lookup_discrete(), pysd.py_backend.functions.lookup_extrapolation(), pysd.py_backend.functions.logical_and(), pysd.py_backend.functions.logical_or(), pysd.py_backend.functions.bounded_normal(), pysd.py_backend.functions.log().
- Remove old translation and building files (pysd.translation).
Bug fixes
- Generate the documentation of the model when loading it to avoid lossing information when replacing a variable value (issue #310, PR #312).
- Make random functions return arrays of the same shape as the variable, to avoid repeating values over a dimension (issue #309, PR #312).
- Fix bug when Vensim’s :MACRO: definition is not at the top of the model file (issue #306, PR #312).
- Make builder identify the subscripts using a main range and subrange to allow using subscripts as numeric values as Vensim does (issue #296, issue #301, PR #312).
- Fix bug of missmatching of functions and lookups names (issue #116, PR #312).
- Parse Xmile models case insensitively and ignoring the new lines characters (issue #203, issue #253, PR #312).
- Add support for Vensim’s :EXCEPT: keyword (issue #168, issue #253, PR #312).
- Add spport for Xmile’s FORCST and SAFEDIV functions (issue #154, PR #312).
- Add subscripts support for Xmile (issue #289, PR #312).
- Fix numeric error bug when using return_timestamps and time step with non-integer values.
Documentation
- Review the whole documentation, refract it, and describe the new features.
Performance
- The variables defined in several equations are now assigned to a pre-allocated array instead of using pysd.py_backend.utils.xrmerge().
- The arranging and subseting of arrays is now done inplace instead of using the magic function pysd.py_backend.utils.rearrange().
- The grammars for Parsimonious are only compiled once per translation.
Internal Changes
- The translation and the building of models has been totally modified to use the Abstract Model Representation.