plothist 1.2.5__tar.gz → 1.2.6__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 (146) hide show
  1. {plothist-1.2.5 → plothist-1.2.6}/PKG-INFO +2 -1
  2. {plothist-1.2.5 → plothist-1.2.6}/docs/conf.py +2 -2
  3. {plothist-1.2.5 → plothist-1.2.6}/pyproject.toml +1 -0
  4. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/__init__.py +1 -1
  5. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/scripts/install_latin_modern_fonts.py +17 -91
  6. {plothist-1.2.5 → plothist-1.2.6}/.github/ISSUE_TEMPLATE/user-story.md +0 -0
  7. {plothist-1.2.5 → plothist-1.2.6}/.github/workflows/python-package.yml +0 -0
  8. {plothist-1.2.5 → plothist-1.2.6}/.gitignore +0 -0
  9. {plothist-1.2.5 → plothist-1.2.6}/.pre-commit-config.yaml +0 -0
  10. {plothist-1.2.5 → plothist-1.2.6}/.readthedocs.yaml +0 -0
  11. {plothist-1.2.5 → plothist-1.2.6}/AUTHORS.md +0 -0
  12. {plothist-1.2.5 → plothist-1.2.6}/CITATION.cff +0 -0
  13. {plothist-1.2.5 → plothist-1.2.6}/LICENSE +0 -0
  14. {plothist-1.2.5 → plothist-1.2.6}/README.rst +0 -0
  15. {plothist-1.2.5 → plothist-1.2.6}/docs/advanced/model_examples.rst +0 -0
  16. {plothist-1.2.5 → plothist-1.2.6}/docs/advanced/other_advanced.rst +0 -0
  17. {plothist-1.2.5 → plothist-1.2.6}/docs/basics/1d_func.rst +0 -0
  18. {plothist-1.2.5 → plothist-1.2.6}/docs/basics/1d_hist.rst +0 -0
  19. {plothist-1.2.5 → plothist-1.2.6}/docs/basics/2d_hist.rst +0 -0
  20. {plothist-1.2.5 → plothist-1.2.6}/docs/basics/variable_registry.rst +0 -0
  21. {plothist-1.2.5 → plothist-1.2.6}/docs/documentation/documentation.rst +0 -0
  22. {plothist-1.2.5 → plothist-1.2.6}/docs/documentation/statistics.rst +0 -0
  23. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_func/1d_fct.py +0 -0
  24. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_func/1d_fct_stacked.py +0 -0
  25. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_func/README.rst +0 -0
  26. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_asymmetry.py +0 -0
  27. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_difference.py +0 -0
  28. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_efficiency.py +0 -0
  29. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_only_efficiency.py +0 -0
  30. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_pull.py +0 -0
  31. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_ratio.py +0 -0
  32. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_relative_difference.py +0 -0
  33. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_comparison_split_ratio.py +0 -0
  34. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_elt1.py +0 -0
  35. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_elt1_stacked.py +0 -0
  36. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_elt2.py +0 -0
  37. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_hist_simple.py +0 -0
  38. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_int_category.py +0 -0
  39. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_profile.py +0 -0
  40. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_side_by_side.py +0 -0
  41. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/1d_str_category.py +0 -0
  42. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/1d_hist/README.rst +0 -0
  43. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/2d_hist_correlations.py +0 -0
  44. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/2d_hist_simple.py +0 -0
  45. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/2d_hist_simple_discrete_colormap.py +0 -0
  46. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/2d_hist_uneven.py +0 -0
  47. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/2d_hist_with_projections.py +0 -0
  48. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/2d_hist/README.rst +0 -0
  49. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/README.rst +0 -0
  50. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/advanced/1d_comparison_advanced.py +0 -0
  51. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/advanced/1d_side_by_side_with_numbers.py +0 -0
  52. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/advanced/README.rst +0 -0
  53. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/advanced/asymmetry_comparison_advanced.py +0 -0
  54. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/advanced/model_examples_flatten2D.py +0 -0
  55. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/README.rst +0 -0
  56. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_all_comparisons.py +0 -0
  57. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_all_comparisons_no_model_unc.py +0 -0
  58. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_examples_pull.py +0 -0
  59. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_examples_pull_no_model_unc.py +0 -0
  60. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_examples_stacked.py +0 -0
  61. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_examples_stacked_unstacked.py +0 -0
  62. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_examples_unstacked.py +0 -0
  63. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_with_stacked_and_unstacked_function_components.py +0 -0
  64. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/model_with_stacked_and_unstacked_histograms_components.py +0 -0
  65. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/model_ex/ratio_data_vs_model_with_stacked_and_unstacked_function_components.py +0 -0
  66. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/utility/README.rst +0 -0
  67. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/utility/add_text_example.py +0 -0
  68. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/utility/color_palette_hists.py +0 -0
  69. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/utility/color_palette_squares.py +0 -0
  70. {plothist-1.2.5 → plothist-1.2.6}/docs/examples/utility/matplotlib_vs_plothist_style.py +0 -0
  71. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_advanced.svg +0 -0
  72. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_asymmetry.svg +0 -0
  73. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_difference.svg +0 -0
  74. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_efficiency.svg +0 -0
  75. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_only_efficiency.svg +0 -0
  76. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_pull.svg +0 -0
  77. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_ratio.svg +0 -0
  78. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_relative_difference.svg +0 -0
  79. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_comparison_split_ratio.svg +0 -0
  80. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_elt1.svg +0 -0
  81. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_elt1_stacked.svg +0 -0
  82. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_elt2.svg +0 -0
  83. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_fct.svg +0 -0
  84. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_fct_stacked.svg +0 -0
  85. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_hist_simple.svg +0 -0
  86. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_int_category.svg +0 -0
  87. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_profile.svg +0 -0
  88. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_side_by_side.svg +0 -0
  89. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_side_by_side_with_numbers.svg +0 -0
  90. {plothist-1.2.5 → plothist-1.2.6}/docs/img/1d_str_category.svg +0 -0
  91. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_correlations_0.svg +0 -0
  92. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_correlations_1.svg +0 -0
  93. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_correlations_2.svg +0 -0
  94. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_simple.svg +0 -0
  95. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_simple_discrete_colormap.svg +0 -0
  96. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_uneven.svg +0 -0
  97. {plothist-1.2.5 → plothist-1.2.6}/docs/img/2d_hist_with_projections.svg +0 -0
  98. {plothist-1.2.5 → plothist-1.2.6}/docs/img/add_text_example.svg +0 -0
  99. {plothist-1.2.5 → plothist-1.2.6}/docs/img/asymmetry_comparison_advanced.svg +0 -0
  100. {plothist-1.2.5 → plothist-1.2.6}/docs/img/matplotlib_example.svg +0 -0
  101. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_all_comparisons.svg +0 -0
  102. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_all_comparisons_no_model_unc.svg +0 -0
  103. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_flatten2D.svg +0 -0
  104. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_pull.svg +0 -0
  105. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_pull_no_model_unc.svg +0 -0
  106. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_stacked.svg +0 -0
  107. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_stacked_unstacked.svg +0 -0
  108. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_examples_unstacked.svg +0 -0
  109. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_with_stacked_and_unstacked_function_components.svg +0 -0
  110. {plothist-1.2.5 → plothist-1.2.6}/docs/img/model_with_stacked_and_unstacked_histograms_components.svg +0 -0
  111. {plothist-1.2.5 → plothist-1.2.6}/docs/img/plothist_example.svg +0 -0
  112. {plothist-1.2.5 → plothist-1.2.6}/docs/img/pyhf_example.svg +0 -0
  113. {plothist-1.2.5 → plothist-1.2.6}/docs/img/ratio_data_vs_model_with_stacked_and_unstacked_function_components.svg +0 -0
  114. {plothist-1.2.5 → plothist-1.2.6}/docs/img/savefig_comparisons.gif +0 -0
  115. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_YlGnBu_r_palette.svg +0 -0
  116. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_colorpalette_examples.svg +0 -0
  117. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_coolwarm_palette.svg +0 -0
  118. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_cubehelix.svg +0 -0
  119. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_style_cycle.svg +0 -0
  120. {plothist-1.2.5 → plothist-1.2.6}/docs/img/usage_viridis_palette.svg +0 -0
  121. {plothist-1.2.5 → plothist-1.2.6}/docs/index.rst +0 -0
  122. {plothist-1.2.5 → plothist-1.2.6}/docs/requirements.txt +0 -0
  123. {plothist-1.2.5 → plothist-1.2.6}/docs/usage/font_installation.rst +0 -0
  124. {plothist-1.2.5 → plothist-1.2.6}/docs/usage/installation.rst +0 -0
  125. {plothist-1.2.5 → plothist-1.2.6}/docs/usage/plot_fitting_results.rst +0 -0
  126. {plothist-1.2.5 → plothist-1.2.6}/docs/usage/style.rst +0 -0
  127. {plothist-1.2.5 → plothist-1.2.6}/docs/usage/utilities.rst +0 -0
  128. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/comparison.py +0 -0
  129. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/default_style.mplstyle +0 -0
  130. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/dummy_data.csv +0 -0
  131. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/get_dummy_data.py +0 -0
  132. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/histogramming.py +0 -0
  133. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/plothist_style.py +0 -0
  134. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/plotters.py +0 -0
  135. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/scripts/__init__.py +0 -0
  136. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/scripts/make_examples.py +0 -0
  137. {plothist-1.2.5 → plothist-1.2.6}/src/plothist/variable_registry.py +0 -0
  138. {plothist-1.2.5 → plothist-1.2.6}/tests/test_asymmetry.py +0 -0
  139. {plothist-1.2.5 → plothist-1.2.6}/tests/test_difference.py +0 -0
  140. {plothist-1.2.5 → plothist-1.2.6}/tests/test_efficiency.py +0 -0
  141. {plothist-1.2.5 → plothist-1.2.6}/tests/test_histogramming.py +0 -0
  142. {plothist-1.2.5 → plothist-1.2.6}/tests/test_install_fonts.py +0 -0
  143. {plothist-1.2.5 → plothist-1.2.6}/tests/test_make_examples.py +0 -0
  144. {plothist-1.2.5 → plothist-1.2.6}/tests/test_pull.py +0 -0
  145. {plothist-1.2.5 → plothist-1.2.6}/tests/test_ratio.py +0 -0
  146. {plothist-1.2.5 → plothist-1.2.6}/tests/test_variable_registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plothist
3
- Version: 1.2.5
3
+ Version: 1.2.6
4
4
  Summary: Plot histograms in a scalable way and a beautiful style.
5
5
  Author-email: Cyrille Praz <cyrraz.code@protonmail.com>, Tristan Fillinger <tristan.github@gmail.com>
6
6
  Requires-Python: >=3.7
@@ -18,6 +18,7 @@ Requires-Dist: numpy>=1.14.5
18
18
  Requires-Dist: matplotlib>=3.0
19
19
  Requires-Dist: pyyaml>=5.3.1
20
20
  Requires-Dist: scipy>=1.6.0
21
+ Requires-Dist: requests>=2.25.0
21
22
  Project-URL: Bug Tracker, https://github.com/cyrraz/plothist/issues
22
23
  Project-URL: Documentation, https://plothist.readthedocs.io/
23
24
  Project-URL: Homepage, https://github.com/cyrraz/plothist
@@ -26,9 +26,9 @@ copyright = "2023-2024, Cyrille Praz, Tristan Fillinger"
26
26
  author = "Cyrille Praz, Tristan Fillinger"
27
27
 
28
28
  # The short X.Y version
29
- version = "1.2.5"
29
+ version = "1.2.6"
30
30
  # The full version, including alpha/beta/rc tags
31
- release = "1.2.5"
31
+ release = "1.2.6"
32
32
 
33
33
 
34
34
  # -- General configuration ---------------------------------------------------
@@ -27,6 +27,7 @@ dependencies = [
27
27
  "matplotlib>=3.0",
28
28
  "pyyaml>=5.3.1",
29
29
  "scipy>=1.6.0",
30
+ "requests>=2.25.0",
30
31
  ]
31
32
 
32
33
  [project.urls]
@@ -1,6 +1,6 @@
1
1
  """Plot histograms in a scalable way and a beautiful style."""
2
2
 
3
- __version__ = "1.2.5"
3
+ __version__ = "1.2.6"
4
4
 
5
5
  from .plotters import (
6
6
  create_comparison_figure,
@@ -3,70 +3,9 @@ import os
3
3
  import platform
4
4
  from pathlib import PosixPath
5
5
  import time
6
- import re
7
6
  import matplotlib
8
-
9
-
10
- def _get_wget_version():
11
- """
12
- Get the version of wget.
13
-
14
- Returns
15
- -------
16
- tuple or str
17
- The version of wget as a tuple of integers.
18
-
19
- Raises
20
- ------
21
- RuntimeError
22
- If the version of wget could not be determined.
23
- """
24
- version_string = subprocess.check_output(
25
- ["wget", "--version"], universal_newlines=True
26
- )
27
- # Try to find the version number in the format "XX.XX.XX"
28
- version_match = re.search(r"(\d+\.\d+\.\d+)", version_string)
29
- if not version_match:
30
- # Try to find the version number in the format "XX.XX"
31
- version_match = re.search(r"(\d+\.\d+)", version_string)
32
- if version_match:
33
- version = version_match.group(1)
34
- return tuple(map(int, version.split(".")))
35
- else:
36
- raise RuntimeError("Could not determine wget version.")
37
-
38
-
39
- def _get_install_command(url, font_directory):
40
- """
41
- Get the command to install a font.
42
-
43
- Parameters
44
- ----------
45
- url : str
46
- The URL of the font.
47
- font_directory : PosixPath
48
- The directory where the font should be installed.
49
-
50
- Returns
51
- -------
52
- list
53
- The command to run in a subprocess to install the font.
54
- """
55
- return [
56
- "wget",
57
- "--retry-connrefused", # retry refused connections and similar fatal errors
58
- *(
59
- ["--retry-on-host-error"] if _get_wget_version() >= (1, 20, 0) else []
60
- ), # retry on host errors such as 404 "Not Found"
61
- "--waitretry=1", # wait 1 second before next retry
62
- "--read-timeout=20", # wait a maximum of 20 seconds in case no data is received and then try again
63
- "--timeout=15", # wait max 15 seconds before the initial connection times out
64
- "-t",
65
- "10", # retry 10 times
66
- "-P",
67
- font_directory,
68
- url,
69
- ]
7
+ import requests
8
+ from zipfile import ZipFile
70
9
 
71
10
 
72
11
  def _download_font(url, font_directory, font_name):
@@ -91,20 +30,17 @@ def _download_font(url, font_directory, font_name):
91
30
  success = False
92
31
 
93
32
  while not success and attempt < max_attempt:
94
- result = subprocess.run(
95
- _get_install_command(url, font_directory),
96
- capture_output=True,
97
- text=True,
98
- )
99
- success = result.returncode == 0
100
- if not success:
33
+ try:
34
+ r = requests.get(url)
35
+ with (font_directory / url.split("/")[-1]).open("wb") as f:
36
+ f.write(r.content)
37
+ success = True
38
+ except Exception as e:
101
39
  # Print the output to the terminal
102
- print("Try", attempt + 1, "of", max_attempt)
103
- print("STDOUT:", result.stdout)
104
- print("STDERR:", result.stderr)
40
+ print(f"Error: {e}\nTry {attempt + 1} of {max_attempt}")
105
41
  # Increment attempt counter and wait before the next attempt
106
42
  attempt += 1
107
- time.sleep(5)
43
+ time.sleep(attempt)
108
44
 
109
45
  if not success:
110
46
  raise RuntimeError(
@@ -167,26 +103,16 @@ def install_latin_modern_fonts():
167
103
  )
168
104
  print(f"Unzipping Latin Modern {lm}...")
169
105
 
170
- result = subprocess.run(
171
- [
172
- "unzip",
173
- "-o",
174
- (font_directory / f"latin-modern-{lm}.zip"),
175
- "-d",
176
- (font_directory / f"latin-modern-{lm}"),
177
- ],
178
- capture_output=True,
179
- text=True,
180
- )
181
- success = result.returncode == 0
182
- if not success:
106
+ try:
107
+ with ZipFile(font_directory / f"latin-modern-{lm}.zip", "r") as zip_ref:
108
+ zip_ref.extractall(font_directory / f"latin-modern-{lm}")
109
+ success = True
110
+ except Exception as e:
183
111
  # Print the output to the terminal
184
- print("Try", attempt + 1, "of", max_attempt)
185
- print("STDOUT:", result.stdout)
186
- print("STDERR:", result.stderr)
112
+ print(f"Error: {e}\nTry {attempt + 1} of {max_attempt}")
187
113
  # Increment attempt counter and wait before the next attempt
188
114
  attempt += 1
189
- time.sleep(1)
115
+ time.sleep(attempt)
190
116
  subprocess.run(
191
117
  ["rm", "-f", (font_directory / f"latin-modern-{lm}.zip")]
192
118
  )
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