scitex 2.3.0__py3-none-any.whl → 2.4.0__py3-none-any.whl

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 (99) hide show
  1. scitex/ai/classification/reporters/reporter_utils/_Plotter.py +1 -1
  2. scitex/ai/plt/__init__.py +2 -2
  3. scitex/ai/plt/{_plot_conf_mat.py → _stx_conf_mat.py} +3 -3
  4. scitex/config/PriorityConfig.py +195 -0
  5. scitex/config/__init__.py +24 -0
  6. scitex/io/_save.py +125 -34
  7. scitex/io/_save_modules/_image.py +37 -20
  8. scitex/plt/__init__.py +470 -17
  9. scitex/plt/_subplots/_AxisWrapper.py +98 -50
  10. scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin.py +254 -124
  11. scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin.py +49 -8
  12. scitex/plt/_subplots/_SubplotsWrapper.py +76 -91
  13. scitex/plt/_subplots/_export_as_csv.py +127 -58
  14. scitex/plt/_subplots/_export_as_csv_formatters/__init__.py +25 -16
  15. scitex/plt/_subplots/_export_as_csv_formatters/_format_contourf.py +54 -0
  16. scitex/plt/_subplots/_export_as_csv_formatters/_format_hexbin.py +41 -0
  17. scitex/plt/_subplots/_export_as_csv_formatters/_format_hist2d.py +41 -0
  18. scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py +59 -47
  19. scitex/plt/_subplots/_export_as_csv_formatters/_format_matshow.py +42 -0
  20. scitex/plt/_subplots/_export_as_csv_formatters/_format_pie.py +42 -0
  21. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot.py +72 -35
  22. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_box.py +1 -1
  23. scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_kde.py +2 -2
  24. scitex/plt/_subplots/_export_as_csv_formatters/_format_quiver.py +53 -0
  25. scitex/plt/_subplots/_export_as_csv_formatters/_format_stem.py +42 -0
  26. scitex/plt/_subplots/_export_as_csv_formatters/_format_step.py +42 -0
  27. scitex/plt/_subplots/_export_as_csv_formatters/_format_streamplot.py +48 -0
  28. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_conf_mat.py → _format_stx_conf_mat.py} +2 -2
  29. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_ecdf.py → _format_stx_ecdf.py} +2 -2
  30. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_fillv.py → _format_stx_fillv.py} +2 -2
  31. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_heatmap.py → _format_stx_heatmap.py} +2 -2
  32. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_image.py → _format_stx_image.py} +2 -2
  33. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_joyplot.py → _format_stx_joyplot.py} +2 -2
  34. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_line.py → _format_stx_line.py} +3 -3
  35. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_ci.py → _format_stx_mean_ci.py} +2 -2
  36. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_std.py → _format_stx_mean_std.py} +2 -2
  37. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_median_iqr.py → _format_stx_median_iqr.py} +2 -2
  38. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_raster.py → _format_stx_raster.py} +2 -2
  39. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_rectangle.py → _format_stx_rectangle.py} +1 -1
  40. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_scatter_hist.py → _format_stx_scatter_hist.py} +2 -2
  41. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_shaded_line.py → _format_stx_shaded_line.py} +2 -2
  42. scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_violin.py → _format_stx_violin.py} +2 -2
  43. scitex/plt/_subplots/_export_as_csv_formatters/verify_formatters.py +23 -23
  44. scitex/plt/ax/__init__.py +16 -15
  45. scitex/plt/ax/_plot/__init__.py +30 -30
  46. scitex/plt/ax/_plot/_add_fitted_line.py +65 -11
  47. scitex/plt/ax/_plot/_plot_statistical_shaded_line.py +104 -76
  48. scitex/plt/ax/_plot/{_plot_conf_mat.py → _stx_conf_mat.py} +10 -10
  49. scitex/plt/ax/_plot/_stx_ecdf.py +109 -0
  50. scitex/plt/ax/_plot/{_plot_fillv.py → _stx_fillv.py} +7 -7
  51. scitex/plt/ax/_plot/_stx_heatmap.py +366 -0
  52. scitex/plt/ax/_plot/{_plot_image.py → _stx_image.py} +1 -1
  53. scitex/plt/ax/_plot/_stx_joyplot.py +113 -0
  54. scitex/plt/ax/_plot/{_plot_raster.py → _stx_raster.py} +37 -25
  55. scitex/plt/ax/_plot/{_plot_rectangle.py → _stx_rectangle.py} +10 -9
  56. scitex/plt/ax/_plot/{_plot_scatter_hist.py → _stx_scatter_hist.py} +1 -1
  57. scitex/plt/ax/_plot/_stx_shaded_line.py +215 -0
  58. scitex/plt/ax/_plot/{_plot_violin.py → _stx_violin.py} +13 -6
  59. scitex/plt/ax/_style/__init__.py +3 -0
  60. scitex/plt/ax/_style/_style_barplot.py +13 -2
  61. scitex/plt/ax/_style/_style_boxplot.py +78 -32
  62. scitex/plt/ax/_style/_style_errorbar.py +17 -3
  63. scitex/plt/ax/_style/_style_scatter.py +17 -3
  64. scitex/plt/ax/_style/_style_violinplot.py +109 -0
  65. scitex/plt/color/_vizualize_colors.py +3 -3
  66. scitex/plt/styles/SCITEX_STYLE.yaml +104 -0
  67. scitex/plt/styles/__init__.py +57 -0
  68. scitex/plt/styles/_plot_defaults.py +209 -0
  69. scitex/plt/styles/_plot_postprocess.py +518 -0
  70. scitex/plt/styles/_style_loader.py +268 -0
  71. scitex/plt/styles/presets.py +208 -0
  72. scitex/plt/utils/_collect_figure_metadata.py +160 -18
  73. scitex/plt/utils/_colorbar.py +72 -10
  74. scitex/plt/utils/_configure_mpl.py +108 -52
  75. scitex/plt/utils/_crop.py +21 -7
  76. scitex/plt/utils/_figure_mm.py +21 -7
  77. scitex/stats/__init__.py +13 -1
  78. scitex/stats/_schema.py +578 -0
  79. scitex/stats/tests/__init__.py +13 -0
  80. scitex/stats/tests/correlation/__init__.py +13 -0
  81. scitex/stats/tests/correlation/_test_pearson.py +262 -0
  82. scitex/vis/__init__.py +6 -0
  83. scitex/vis/editor/__init__.py +23 -0
  84. scitex/vis/editor/_defaults.py +205 -0
  85. scitex/vis/editor/_edit.py +342 -0
  86. scitex/vis/editor/_mpl_editor.py +231 -0
  87. scitex/vis/editor/_tkinter_editor.py +466 -0
  88. scitex/vis/editor/_web_editor.py +1440 -0
  89. scitex/vis/model/plot_types.py +15 -15
  90. {scitex-2.3.0.dist-info → scitex-2.4.0.dist-info}/METADATA +2 -1
  91. {scitex-2.3.0.dist-info → scitex-2.4.0.dist-info}/RECORD +94 -67
  92. {scitex-2.3.0.dist-info → scitex-2.4.0.dist-info}/WHEEL +1 -1
  93. scitex/plt/ax/_plot/_plot_ecdf.py +0 -84
  94. scitex/plt/ax/_plot/_plot_heatmap.py +0 -277
  95. scitex/plt/ax/_plot/_plot_joyplot.py +0 -77
  96. scitex/plt/ax/_plot/_plot_shaded_line.py +0 -142
  97. scitex/plt/presets.py +0 -224
  98. {scitex-2.3.0.dist-info → scitex-2.4.0.dist-info}/entry_points.txt +0 -0
  99. {scitex-2.3.0.dist-info → scitex-2.4.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
  # -*- coding: utf-8 -*-
3
- # Timestamp: "2025-05-01 17:11:28 (ywatanabe)"
4
- # File: /home/ywatanabe/proj/scitex_repo/src/scitex/plt/_subplots/_AxisWrapper.py
3
+ # Timestamp: "2025-12-01 10:00:00 (ywatanabe)"
4
+ # File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_AxisWrapper.py
5
5
  # ----------------------------------------
6
6
  import os
7
7
 
@@ -21,6 +21,7 @@ from ._AxisWrapperMixins import (
21
21
  TrackingMixin,
22
22
  UnitAwareMixin,
23
23
  )
24
+ from scitex.plt.styles import apply_plot_defaults, apply_plot_postprocess
24
25
 
25
26
 
26
27
  class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMixin, UnitAwareMixin):
@@ -51,6 +52,7 @@ class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMi
51
52
  self.track = track
52
53
  self.id = 0
53
54
  self._counter_part = matplotlib.axes.Axes
55
+ self._tracking_depth = 0 # Depth counter to prevent tracking internal calls
54
56
 
55
57
  # Initialize unit awareness
56
58
  UnitAwareMixin.__init__(self)
@@ -93,57 +95,103 @@ class AxisWrapper(MatplotlibPlotMixin, SeabornMixin, AdjustmentMixin, TrackingMi
93
95
  if callable(orig_attr):
94
96
 
95
97
  @wraps(orig_attr)
96
- def wrapper(*args, **kwargs):
98
+ def wrapper(*args, __method_name__=name, **kwargs):
97
99
  id_value = kwargs.pop("id", None)
98
100
  track_override = kwargs.pop("track", None)
99
101
 
100
- # Call the original matplotlib method
101
- result = orig_attr(*args, **kwargs)
102
-
103
- # Determine if tracking should occur
104
- should_track = (
105
- track_override if track_override is not None else self.track
106
- )
107
-
108
- # Track the method call if tracking enabled
109
- # Expanded list of matplotlib plotting methods to track
110
- tracking_methods = {
111
- # Basic plots
112
- 'plot', 'scatter', 'bar', 'barh', 'hist', 'boxplot', 'violinplot',
113
- # Line plots
114
- 'fill_between', 'fill_betweenx', 'errorbar', 'step', 'stem',
115
- # Statistical plots
116
- 'hist2d', 'hexbin', 'pie',
117
- # Contour plots
118
- 'contour', 'contourf', 'tricontour', 'tricontourf',
119
- # Image plots
120
- 'imshow', 'matshow', 'spy',
121
- # Quiver plots
122
- 'quiver', 'streamplot',
123
- # 3D-related (if axes3d)
124
- 'plot3D', 'scatter3D', 'bar3d', 'plot_surface', 'plot_wireframe',
125
- # Text and annotations (data-containing)
126
- 'annotate', 'text'
127
- }
128
- if should_track and name in tracking_methods:
129
- # Use the _track method from TrackingMixin
130
- # If no id provided, it will auto-generate one
131
- try:
132
- # Convert args to tracked_dict for consistency with other tracking
133
- tracked_dict = {"args": args}
134
- self._track(
135
- should_track, id_value, name, tracked_dict, kwargs
136
- )
137
- except AttributeError:
138
- warnings.warn(
139
- f"Tracking setup incomplete for AxisWrapper ({name}).",
140
- UserWarning,
141
- stacklevel=2,
142
- )
143
- except Exception as e:
144
- # Silently continue if tracking fails to not break plotting
145
- pass
146
- return result # Return the result of the original call
102
+ # Increment tracking depth to detect internal calls
103
+ # Internal calls (depth > 1) won't be tracked
104
+ self._tracking_depth += 1
105
+ is_top_level_call = (self._tracking_depth == 1)
106
+
107
+ try:
108
+ # Apply pre-processing defaults from styles module
109
+ apply_plot_defaults(__method_name__, kwargs, id_value, self._axes_mpl)
110
+
111
+ # Pop scitex-specific kwargs before calling matplotlib
112
+ # These are handled in post-processing
113
+ scitex_kwargs = {}
114
+ if __method_name__ == 'violinplot':
115
+ scitex_kwargs['boxplot'] = kwargs.pop('boxplot', True)
116
+
117
+ # Call the original matplotlib method
118
+ result = orig_attr(*args, **kwargs)
119
+
120
+ # Store the scitex id on the result for later retrieval
121
+ # This is used by _collect_figure_metadata to map traces to CSV columns
122
+ if id_value is not None:
123
+ if isinstance(result, list):
124
+ # plot() returns list of Line2D objects
125
+ for item in result:
126
+ item._scitex_id = id_value
127
+ elif hasattr(result, '__iter__') and not isinstance(result, str):
128
+ # Other containers (e.g., bar containers)
129
+ try:
130
+ for item in result:
131
+ item._scitex_id = id_value
132
+ except (TypeError, AttributeError):
133
+ pass
134
+ else:
135
+ # Single object
136
+ try:
137
+ result._scitex_id = id_value
138
+ except AttributeError:
139
+ pass
140
+
141
+ # Restore scitex kwargs for post-processing
142
+ kwargs.update(scitex_kwargs)
143
+
144
+ # Apply post-processing styling from styles module
145
+ apply_plot_postprocess(__method_name__, result, self._axes_mpl, kwargs, args)
146
+
147
+ # Determine if tracking should occur
148
+ # Only track top-level calls (depth == 1), not internal matplotlib calls
149
+ should_track = (
150
+ track_override if track_override is not None else self.track
151
+ ) and is_top_level_call
152
+
153
+ # Track the method call if tracking enabled
154
+ # Expanded list of matplotlib plotting methods to track
155
+ tracking_methods = {
156
+ # Basic plots
157
+ 'plot', 'scatter', 'bar', 'barh', 'hist', 'boxplot', 'violinplot',
158
+ # Line plots
159
+ 'fill_between', 'fill_betweenx', 'errorbar', 'step', 'stem',
160
+ # Statistical plots
161
+ 'hist2d', 'hexbin', 'pie',
162
+ # Contour plots
163
+ 'contour', 'contourf', 'tricontour', 'tricontourf',
164
+ # Image plots
165
+ 'imshow', 'matshow', 'spy',
166
+ # Quiver plots
167
+ 'quiver', 'streamplot',
168
+ # 3D-related (if axes3d)
169
+ 'plot3D', 'scatter3D', 'bar3d', 'plot_surface', 'plot_wireframe',
170
+ # Text and annotations (data-containing)
171
+ 'annotate', 'text'
172
+ }
173
+ if should_track and __method_name__ in tracking_methods:
174
+ # Use the _track method from TrackingMixin
175
+ # If no id provided, it will auto-generate one
176
+ try:
177
+ # Convert args to tracked_dict for consistency with other tracking
178
+ tracked_dict = {"args": args}
179
+ self._track(
180
+ should_track, id_value, __method_name__, tracked_dict, kwargs
181
+ )
182
+ except AttributeError:
183
+ warnings.warn(
184
+ f"Tracking setup incomplete for AxisWrapper ({__method_name__}).",
185
+ UserWarning,
186
+ stacklevel=2,
187
+ )
188
+ except Exception as e:
189
+ # Silently continue if tracking fails to not break plotting
190
+ pass
191
+ return result # Return the result of the original call
192
+ finally:
193
+ # Always decrement depth, even if exception occurs
194
+ self._tracking_depth -= 1
147
195
 
148
196
  return wrapper
149
197
  else: