ModelFlowIb 2.90__tar.gz → 2.92__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. {modelflowib-2.90 → modelflowib-2.92}/PKG-INFO +1 -1
  2. {modelflowib-2.90 → modelflowib-2.92}/modelclass.py +6 -3
  3. {modelflowib-2.90 → modelflowib-2.92}/modelconstruct_estimation.py +3 -3
  4. {modelflowib-2.90 → modelflowib-2.92}/modelflowib.egg-info/PKG-INFO +1 -1
  5. {modelflowib-2.90 → modelflowib-2.92}/modelsolver_ng.py +29 -0
  6. {modelflowib-2.90 → modelflowib-2.92}/pyproject.toml +1 -1
  7. {modelflowib-2.90 → modelflowib-2.92}/README.md +0 -0
  8. {modelflowib-2.90 → modelflowib-2.92}/license.md +0 -0
  9. {modelflowib-2.90 → modelflowib-2.92}/modelBLfunk.py +0 -0
  10. {modelflowib-2.90 → modelflowib-2.92}/model_Excel.py +0 -0
  11. {modelflowib-2.90 → modelflowib-2.92}/model_cvx.py +0 -0
  12. {modelflowib-2.90 → modelflowib-2.92}/model_dynare.py +0 -0
  13. {modelflowib-2.90 → modelflowib-2.92}/model_financial_stability.py +0 -0
  14. {modelflowib-2.90 → modelflowib-2.92}/model_latex.py +0 -0
  15. {modelflowib-2.90 → modelflowib-2.92}/model_latex_class.py +0 -0
  16. {modelflowib-2.90 → modelflowib-2.92}/model_parquet_mixin.py +0 -0
  17. {modelflowib-2.90 → modelflowib-2.92}/modelcausality.py +0 -0
  18. {modelflowib-2.90 → modelflowib-2.92}/modelconstruct.py +0 -0
  19. {modelflowib-2.90 → modelflowib-2.92}/modeldash.py +0 -0
  20. {modelflowib-2.90 → modelflowib-2.92}/modeldashboot.py +0 -0
  21. {modelflowib-2.90 → modelflowib-2.92}/modeldashsidebar.py +0 -0
  22. {modelflowib-2.90 → modelflowib-2.92}/modeldekom.py +0 -0
  23. {modelflowib-2.90 → modelflowib-2.92}/modeldiff.py +0 -0
  24. {modelflowib-2.90 → modelflowib-2.92}/modeldisplay.py +0 -0
  25. {modelflowib-2.90 → modelflowib-2.92}/modelestimation.py +0 -0
  26. {modelflowib-2.90 → modelflowib-2.92}/modelestimator_new.py +0 -0
  27. {modelflowib-2.90 → modelflowib-2.92}/modelflowib.egg-info/SOURCES.txt +0 -0
  28. {modelflowib-2.90 → modelflowib-2.92}/modelflowib.egg-info/dependency_links.txt +0 -0
  29. {modelflowib-2.90 → modelflowib-2.92}/modelflowib.egg-info/requires.txt +0 -0
  30. {modelflowib-2.90 → modelflowib-2.92}/modelflowib.egg-info/top_level.txt +0 -0
  31. {modelflowib-2.90 → modelflowib-2.92}/modelgrab.py +0 -0
  32. {modelflowib-2.90 → modelflowib-2.92}/modelgrabexcel.py +0 -0
  33. {modelflowib-2.90 → modelflowib-2.92}/modelgrabgdx.py +0 -0
  34. {modelflowib-2.90 → modelflowib-2.92}/modelgrabgekkobank.py +0 -0
  35. {modelflowib-2.90 → modelflowib-2.92}/modelgrabwf2.py +0 -0
  36. {modelflowib-2.90 → modelflowib-2.92}/modelhelp.py +0 -0
  37. {modelflowib-2.90 → modelflowib-2.92}/modelhtml.py +0 -0
  38. {modelflowib-2.90 → modelflowib-2.92}/modelinput_shiny.py +0 -0
  39. {modelflowib-2.90 → modelflowib-2.92}/modelinvert.py +0 -0
  40. {modelflowib-2.90 → modelflowib-2.92}/modeljupyter.py +0 -0
  41. {modelflowib-2.90 → modelflowib-2.92}/modeljupytermagic.py +0 -0
  42. {modelflowib-2.90 → modelflowib-2.92}/modelmacrograb.py +0 -0
  43. {modelflowib-2.90 → modelflowib-2.92}/modelmanipulation.py +0 -0
  44. {modelflowib-2.90 → modelflowib-2.92}/modelmf.py +0 -0
  45. {modelflowib-2.90 → modelflowib-2.92}/modelnet.py +0 -0
  46. {modelflowib-2.90 → modelflowib-2.92}/modelnewton.py +0 -0
  47. {modelflowib-2.90 → modelflowib-2.92}/modelnormalize.py +0 -0
  48. {modelflowib-2.90 → modelflowib-2.92}/modelpattern.py +0 -0
  49. {modelflowib-2.90 → modelflowib-2.92}/modelreport.py +0 -0
  50. {modelflowib-2.90 → modelflowib-2.92}/modeluserfunk.py +0 -0
  51. {modelflowib-2.90 → modelflowib-2.92}/modelvis.py +0 -0
  52. {modelflowib-2.90 → modelflowib-2.92}/modelwidget.py +0 -0
  53. {modelflowib-2.90 → modelflowib-2.92}/modelwidget_core.py +0 -0
  54. {modelflowib-2.90 → modelflowib-2.92}/modelwidget_input.py +0 -0
  55. {modelflowib-2.90 → modelflowib-2.92}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modelflowib
3
- Version: 2.90
3
+ Version: 2.92
4
4
  Summary: A tool to solve and manage dynamic economic and financial models
5
5
  Author-email: Ib Hansen <Ib.Hansen.Iv@gmail.com>
6
6
  License-Expression: MIT
@@ -2105,13 +2105,16 @@ class Model_help_Mixin():
2105
2105
  if nofit and v.endswith('_FITTED'): continue
2106
2106
  check = self.get_values(v,pct=True).T
2107
2107
  check.columns = ['Before check','After calculation','Difference','Pct']
2108
- if (check.Difference.abs() >= tol).any():
2108
+ # NaN >= tol is False, so a calculated NaN has to be caught separately
2109
+ isnan = check['After calculation'].isna()
2110
+ if (check.Difference.abs() >= tol).any() or isnan.any():
2109
2111
  err=err+1
2110
2112
  maxdiff = check.Difference.abs().max()
2111
2113
  maxpct = check.Pct.abs().max()
2114
+ nantext = f' NaN in {isnan.sum()} periods from {check.index[isnan][0]}' if isnan.any() else ''
2112
2115
  if err==1 :
2113
- print('\nVariable with residuals above threshold')
2114
- print(f"{v:{self.maxnavlen}}, Max difference:{maxdiff:15.8f} Max Pct {maxpct:15.10f}% It is number {i:5} in the solveorder and error number {err}")
2116
+ print('\nVariable with residuals above threshold or NaN result')
2117
+ print(f"{v:{self.maxnavlen}}, Max difference:{maxdiff:15.8f} Max Pct {maxpct:15.10f}% It is number {i:5} in the solveorder and error number {err}{nantext}")
2115
2118
  if showall:
2116
2119
  print(f'{self.allvar[v]["frml"]}')
2117
2120
  print(f'{self.var_description[v]}')
@@ -598,14 +598,14 @@ def eviews_to_modelflow(stmt: str, behavioral_opts: str = '<>') -> str:
598
598
 
599
599
  ``@IDENTITY`` equations get ``<>``, all other equations get
600
600
  ``behavioral_opts`` (for instance ``'<STOC>'``). EViews functions are
601
- translated with :meth:`modelgrabwf2.GrabWf2Model.trans_eviews`
601
+ translated with :meth:`modelgrabwf2.GrabWfModel.trans_eviews`
602
602
  (``D(`` -> ``DIFF(``, ``@PC`` -> ``PCT_GROWTH``, ``^`` -> ``**`` ...).
603
603
  """
604
- from modelgrabwf2 import GrabWf2Model
604
+ from modelgrabwf2 import GrabWfModel
605
605
 
606
606
  m = re.match(r'\s*@IDENTITY\s+(.*)', stmt, flags=re.IGNORECASE | re.DOTALL)
607
607
  opts, body = ('<>', m.group(1)) if m else (behavioral_opts, stmt)
608
- return f'{opts} {GrabWf2Model.trans_eviews(body).strip()}'
608
+ return f'{opts} {GrabWfModel.trans_eviews(body).strip()}'
609
609
 
610
610
 
611
611
  # type_input presets for Makemodel; explicit eq_start/eq_end/comment_start/transform win
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: modelflowib
3
- Version: 2.90
3
+ Version: 2.92
4
4
  Summary: A tool to solve and manage dynamic economic and financial models
5
5
  Author-email: Ib Hansen <Ib.Hansen.Iv@gmail.com>
6
6
  License-Expression: MIT
@@ -3876,3 +3876,32 @@ class Solver_ng_Mixin:
3876
3876
  if databank is None:
3877
3877
  databank = self.basedf
3878
3878
  return NewtonStackFbminSolver(self)(databank, *args, **kwargs)
3879
+
3880
+ def stack_info(self):
3881
+ """Print the size of the last stacked Newton system (``newtonstack_ng``):
3882
+ the periods solved together, the pro/core/epi split, the stacked
3883
+ Jacobian and the nonzeros of its LU factorization. Call it after a
3884
+ solve."""
3885
+ diff = getattr(self, "ng_newton_diff_stack", None)
3886
+ jac = getattr(diff, "stacked", None)
3887
+ if jac is None:
3888
+ raise Exception("No stacked Newton system yet: solve with newtonstack_ng first")
3889
+ per = getattr(self, "ng_old_stack_periode", self.current_per)
3890
+ n, nunknown = jac.shape[0], len(diff.endovar)
3891
+ print(f"Periods solved together : {len(per)} ({per[0]} to {per[-1]})")
3892
+ print(f"Endogenous variables : {len(self.endogene)}")
3893
+ if getattr(self, "ng_newton_diff_stack_key", "full") != "full":
3894
+ s = self.ng_stack_split_struct
3895
+ print(f" core / prolog / epilog : {len(s['core'])} / {len(s['pro'])} / {len(s['epi'])}")
3896
+ print(f"Newton unknowns per period : {nunknown}")
3897
+ print(f"Stacked Jacobian : {n:,} x {n:,} = {n * n:,} elements")
3898
+ print(f" nonzero : {jac.nnz:,} ({jac.nnz / n / n:.4%}), {jac.nnz / n:.1f} per row")
3899
+ # get_solvestacked keeps the SuperLU solve method; its object holds L and U
3900
+ lu = getattr(getattr(diff, "solvestacked", None), "__self__", None)
3901
+ if hasattr(lu, "L"):
3902
+ fill = lu.L.nnz + lu.U.nnz
3903
+ print(f"LU factorization (SuperLU {getattr(diff, 'permc_spec', None) or 'NATURAL'})")
3904
+ print(f" nonzero in L + U : {fill:,} ({fill / jac.nnz:.1f} times the Jacobian)")
3905
+ print(f" memory, about : {fill * 12 / 1e6:,.1f} MB")
3906
+ else:
3907
+ print("LU factorization : nonzeros not available (factorizer='umfpack')")
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "modelflowib" # PyPI distribution name
7
- version = "2.90" # OVERWRITTEN at build time from MF_VERSION
7
+ version = "2.92" # OVERWRITTEN at build time from MF_VERSION
8
8
  # (set_pyproject_version.py / make_pip.py -v)
9
9
  description = "A tool to solve and manage dynamic economic and financial models"
10
10
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes