CUQIpy 1.4.0.post0.dev101__tar.gz → 1.4.0.post0.dev116__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 (132) hide show
  1. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/CUQIpy.egg-info/PKG-INFO +1 -1
  2. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/CUQIpy.egg-info/SOURCES.txt +1 -0
  3. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/PKG-INFO +1 -1
  4. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/_version.py +3 -3
  5. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/config.py +6 -0
  6. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/problem/_problem.py +2 -2
  7. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_sampler.py +19 -4
  8. cuqipy-1.4.0.post0.dev116/tests/test_config.py +13 -0
  9. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/CUQIpy.egg-info/dependency_links.txt +0 -0
  10. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/CUQIpy.egg-info/requires.txt +0 -0
  11. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/CUQIpy.egg-info/top_level.txt +0 -0
  12. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/LICENSE +0 -0
  13. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/README.md +0 -0
  14. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/__init__.py +0 -0
  15. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/_messages.py +0 -0
  16. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/algebra/__init__.py +0 -0
  17. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/algebra/_abstract_syntax_tree.py +0 -0
  18. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/algebra/_ordered_set.py +0 -0
  19. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/algebra/_random_variable.py +0 -0
  20. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/array/__init__.py +0 -0
  21. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/array/_array.py +0 -0
  22. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/__init__.py +0 -0
  23. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/_data.py +0 -0
  24. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/astronaut.npz +0 -0
  25. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/camera.npz +0 -0
  26. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/cat.npz +0 -0
  27. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/cookie.png +0 -0
  28. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/data/satellite.mat +0 -0
  29. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/density/__init__.py +0 -0
  30. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/density/_density.py +0 -0
  31. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/diagnostics.py +0 -0
  32. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/__init__.py +0 -0
  33. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_beta.py +0 -0
  34. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_cauchy.py +0 -0
  35. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_cmrf.py +0 -0
  36. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_custom.py +0 -0
  37. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_distribution.py +0 -0
  38. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_gamma.py +0 -0
  39. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_gaussian.py +0 -0
  40. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_gmrf.py +0 -0
  41. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_inverse_gamma.py +0 -0
  42. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_joint_distribution.py +0 -0
  43. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_laplace.py +0 -0
  44. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_lmrf.py +0 -0
  45. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_lognormal.py +0 -0
  46. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_modified_half_normal.py +0 -0
  47. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_normal.py +0 -0
  48. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_posterior.py +0 -0
  49. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_smoothed_laplace.py +0 -0
  50. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_truncated_normal.py +0 -0
  51. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/distribution/_uniform.py +0 -0
  52. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/experimental/__init__.py +0 -0
  53. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/experimental/_recommender.py +0 -0
  54. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/geometry/__init__.py +0 -0
  55. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/geometry/_geometry.py +0 -0
  56. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/geometry/_product_geometry.py +0 -0
  57. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/implicitprior/__init__.py +0 -0
  58. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/implicitprior/_regularized_gaussian.py +0 -0
  59. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/implicitprior/_regularized_gmrf.py +0 -0
  60. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/implicitprior/_regularized_unbounded_uniform.py +0 -0
  61. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/implicitprior/_restorator.py +0 -0
  62. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/__init__.py +0 -0
  63. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/__init__.py +0 -0
  64. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_conjugate.py +0 -0
  65. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_conjugate_approx.py +0 -0
  66. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_cwmh.py +0 -0
  67. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_gibbs.py +0 -0
  68. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_hmc.py +0 -0
  69. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_langevin_algorithm.py +0 -0
  70. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_laplace_approximation.py +0 -0
  71. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_mh.py +0 -0
  72. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_pcn.py +0 -0
  73. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_rto.py +0 -0
  74. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/legacy/sampler/_sampler.py +0 -0
  75. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/likelihood/__init__.py +0 -0
  76. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/likelihood/_likelihood.py +0 -0
  77. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/model/__init__.py +0 -0
  78. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/model/_model.py +0 -0
  79. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/operator/__init__.py +0 -0
  80. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/operator/_operator.py +0 -0
  81. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/pde/__init__.py +0 -0
  82. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/pde/_observation_map.py +0 -0
  83. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/pde/_pde.py +0 -0
  84. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/problem/__init__.py +0 -0
  85. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/__init__.py +0 -0
  86. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_conjugate.py +0 -0
  87. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_conjugate_approx.py +0 -0
  88. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_cwmh.py +0 -0
  89. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_direct.py +0 -0
  90. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_gibbs.py +0 -0
  91. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_hmc.py +0 -0
  92. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_langevin_algorithm.py +0 -0
  93. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_laplace_approximation.py +0 -0
  94. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_mh.py +0 -0
  95. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_pcn.py +0 -0
  96. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/sampler/_rto.py +0 -0
  97. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/samples/__init__.py +0 -0
  98. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/samples/_samples.py +0 -0
  99. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/solver/__init__.py +0 -0
  100. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/solver/_solver.py +0 -0
  101. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/testproblem/__init__.py +0 -0
  102. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/testproblem/_testproblem.py +0 -0
  103. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/utilities/__init__.py +0 -0
  104. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/utilities/_get_python_variable_name.py +0 -0
  105. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/cuqi/utilities/_utilities.py +0 -0
  106. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/pyproject.toml +0 -0
  107. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/requirements.txt +0 -0
  108. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/setup.cfg +0 -0
  109. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/setup.py +0 -0
  110. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_abstract_distribution_density.py +0 -0
  111. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_algebra.py +0 -0
  112. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_bayesian_inversion.py +0 -0
  113. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_density.py +0 -0
  114. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_distribution.py +0 -0
  115. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_distributions_shape.py +0 -0
  116. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_geometry.py +0 -0
  117. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_implicit_priors.py +0 -0
  118. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_joint_distribution.py +0 -0
  119. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_legacy_sampler.py +0 -0
  120. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_likelihood.py +0 -0
  121. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_model.py +0 -0
  122. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_mrfs.py +0 -0
  123. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_pde.py +0 -0
  124. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_posterior.py +0 -0
  125. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_problem.py +0 -0
  126. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_product_geometry.py +0 -0
  127. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_random_variable.py +0 -0
  128. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_samples.py +0 -0
  129. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_solver.py +0 -0
  130. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_testproblem.py +0 -0
  131. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_utilities.py +0 -0
  132. {cuqipy-1.4.0.post0.dev101 → cuqipy-1.4.0.post0.dev116}/tests/test_z_mcmc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CUQIpy
3
- Version: 1.4.0.post0.dev101
3
+ Version: 1.4.0.post0.dev116
4
4
  Summary: Computational Uncertainty Quantification for Inverse problems in Python
5
5
  Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
6
6
  License: Apache License
@@ -107,6 +107,7 @@ cuqi/utilities/_utilities.py
107
107
  tests/test_abstract_distribution_density.py
108
108
  tests/test_algebra.py
109
109
  tests/test_bayesian_inversion.py
110
+ tests/test_config.py
110
111
  tests/test_density.py
111
112
  tests/test_distribution.py
112
113
  tests/test_distributions_shape.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: CUQIpy
3
- Version: 1.4.0.post0.dev101
3
+ Version: 1.4.0.post0.dev116
4
4
  Summary: Computational Uncertainty Quantification for Inverse problems in Python
5
5
  Maintainer-email: "Nicolai A. B. Riis" <nabr@dtu.dk>, "Jakob S. Jørgensen" <jakj@dtu.dk>, "Amal M. Alghamdi" <amaal@dtu.dk>, Chao Zhang <chaz@dtu.dk>
6
6
  License: Apache License
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2025-11-27T07:17:19+0100",
11
+ "date": "2025-12-04T09:30:08+0100",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "439c46b8411ea3990f38b3f2f66025ad0868034c",
15
- "version": "1.4.0.post0.dev101"
14
+ "full-revisionid": "a37a0584e43394251680ac4288e8df89f5ebb023",
15
+ "version": "1.4.0.post0.dev116"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -12,3 +12,9 @@ MAX_STACK_SEARCH_DEPTH = 1000
12
12
 
13
13
  MIN_DIM_SPARSE = 75
14
14
  """ Minimum dimension to start storing Nd-arrays as sparse for N>2. The minimum dimension is defined as MIN_DIM_SPARSE^N. """
15
+
16
+ PROGRESS_BAR_DYNAMIC_UPDATE = True
17
+ """ If True, progress bars are updated frequently (dynamic updates).
18
+ If False, progress bars are minimal/static (only shown at start and end),
19
+ which is useful, for example, when building documentation or the Jupyter book (CUQI-Book)
20
+ """
@@ -330,9 +330,9 @@ class BayesianProblem(object):
330
330
  print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
331
331
  print("")
332
332
 
333
- if not legacy:
333
+ if legacy:
334
334
  print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
335
- print("!!! Using samplers from cuqi.sampler !!!")
335
+ print("!! Using legacy samplers from cuqi.legacy.sampler !!")
336
336
  print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
337
337
  print("")
338
338
 
@@ -5,6 +5,7 @@ import pickle as pkl
5
5
  import warnings
6
6
  import cuqi
7
7
  from cuqi.samples import Samples
8
+ from cuqi import config
8
9
 
9
10
  try:
10
11
  from tqdm import tqdm
@@ -228,6 +229,7 @@ class Sampler(ABC):
228
229
  batch_handler = _BatchHandler(batch_size, sample_path)
229
230
 
230
231
  # Draw samples
232
+ acc_rate = 0.0
231
233
  pbar = tqdm(range(Ns), "Sample: ")
232
234
  for idx in pbar:
233
235
 
@@ -239,8 +241,10 @@ class Sampler(ABC):
239
241
  if (Nt > 0) and (idx % Nt == 0):
240
242
  self._samples.append(self.current_point)
241
243
 
242
- # display acc rate at progress bar
243
- pbar.set_postfix_str(f"acc rate: {np.mean(self._acc[-1-idx:]):.2%}")
244
+ # Display acc rate at progress bar
245
+ acc_rate = np.mean(self._acc[-1-idx:])
246
+ if config.PROGRESS_BAR_DYNAMIC_UPDATE:
247
+ pbar.set_postfix_str(f"acc rate: {acc_rate:.2%}")
244
248
 
245
249
  # Add sample to batch
246
250
  if batch_size > 0:
@@ -248,6 +252,10 @@ class Sampler(ABC):
248
252
 
249
253
  # Call callback function if specified
250
254
  self._call_callback(idx, Ns)
255
+
256
+ # Finalize progress bar printing
257
+ if not config.PROGRESS_BAR_DYNAMIC_UPDATE:
258
+ print(f"Sampling acceptance rate: {acc_rate:.2%}\n")
251
259
 
252
260
  return self
253
261
 
@@ -273,6 +281,7 @@ class Sampler(ABC):
273
281
  tune_interval = max(int(tune_freq * Nb), 1)
274
282
 
275
283
  # Draw warmup samples with tuning
284
+ acc_rate = 0.0
276
285
  pbar = tqdm(range(Nb), "Warmup: ")
277
286
  for idx in pbar:
278
287
 
@@ -288,12 +297,18 @@ class Sampler(ABC):
288
297
  if (Nt > 0) and (idx % Nt == 0):
289
298
  self._samples.append(self.current_point)
290
299
 
291
- # display acc rate at progress bar
292
- pbar.set_postfix_str(f"acc rate: {np.mean(self._acc[-1-idx:]):.2%}")
300
+ # Display acc rate at progress bar
301
+ acc_rate = np.mean(self._acc[-1-idx:])
302
+ if config.PROGRESS_BAR_DYNAMIC_UPDATE:
303
+ pbar.set_postfix_str(f"acc rate: {acc_rate:.2%}")
293
304
 
294
305
  # Call callback function if specified
295
306
  self._call_callback(idx, Nb)
296
307
 
308
+ # Finalize progress bar printing
309
+ if not config.PROGRESS_BAR_DYNAMIC_UPDATE:
310
+ print(f"Warmup acceptance rate: {acc_rate:.2%}\n")
311
+
297
312
  return self
298
313
 
299
314
  def get_state(self) -> dict:
@@ -0,0 +1,13 @@
1
+ import cuqi
2
+
3
+ def test_progress_bar_update_frequently_default():
4
+ """Config exposes PROGRESS_BAR_DYNAMIC_UPDATE and it is a boolean."""
5
+ assert hasattr(cuqi, "config")
6
+ assert isinstance(cuqi.config.PROGRESS_BAR_DYNAMIC_UPDATE, bool)
7
+
8
+ def test_progress_bar_update_frequently_toggle(monkeypatch):
9
+ """Can toggle PROGRESS_BAR_DYNAMIC_UPDATE via monkeypatch."""
10
+ original = cuqi.config.PROGRESS_BAR_DYNAMIC_UPDATE
11
+ monkeypatch.setattr(cuqi.config, "PROGRESS_BAR_DYNAMIC_UPDATE", not original, raising=True)
12
+ assert cuqi.config.PROGRESS_BAR_DYNAMIC_UPDATE == (not original)
13
+ # monkeypatch will restore the original value after the test