scitex 2.3.0__py3-none-any.whl → 2.4.1__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.
- scitex/ai/classification/reporters/reporter_utils/_Plotter.py +1 -1
- scitex/ai/plt/__init__.py +2 -2
- scitex/ai/plt/{_plot_conf_mat.py → _stx_conf_mat.py} +3 -3
- scitex/config/PriorityConfig.py +195 -0
- scitex/config/__init__.py +24 -0
- scitex/io/_save.py +125 -34
- scitex/io/_save_modules/_image.py +37 -20
- scitex/plt/__init__.py +470 -17
- scitex/plt/_subplots/_AxisWrapper.py +98 -50
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin.py +559 -124
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin.py +49 -8
- scitex/plt/_subplots/_SubplotsWrapper.py +76 -91
- scitex/plt/_subplots/_export_as_csv.py +127 -58
- scitex/plt/_subplots/_export_as_csv_formatters/__init__.py +25 -16
- scitex/plt/_subplots/_export_as_csv_formatters/_format_contourf.py +54 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_hexbin.py +41 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_hist2d.py +41 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_imshow.py +59 -47
- scitex/plt/_subplots/_export_as_csv_formatters/_format_matshow.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_pie.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot.py +72 -35
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_box.py +1 -1
- scitex/plt/_subplots/_export_as_csv_formatters/_format_plot_kde.py +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/_format_quiver.py +53 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stem.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_step.py +42 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_streamplot.py +48 -0
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_conf_mat.py → _format_stx_conf_mat.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_ecdf.py → _format_stx_ecdf.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_fillv.py → _format_stx_fillv.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_heatmap.py → _format_stx_heatmap.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_image.py → _format_stx_image.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_joyplot.py → _format_stx_joyplot.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_line.py → _format_stx_line.py} +3 -3
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_ci.py → _format_stx_mean_ci.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_std.py → _format_stx_mean_std.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_median_iqr.py → _format_stx_median_iqr.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_raster.py → _format_stx_raster.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_rectangle.py → _format_stx_rectangle.py} +1 -1
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_scatter_hist.py → _format_stx_scatter_hist.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_shaded_line.py → _format_stx_shaded_line.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_violin.py → _format_stx_violin.py} +2 -2
- scitex/plt/_subplots/_export_as_csv_formatters/verify_formatters.py +23 -23
- scitex/plt/ax/__init__.py +16 -15
- scitex/plt/ax/_plot/__init__.py +30 -30
- scitex/plt/ax/_plot/_add_fitted_line.py +65 -11
- scitex/plt/ax/_plot/_plot_statistical_shaded_line.py +104 -76
- scitex/plt/ax/_plot/{_plot_conf_mat.py → _stx_conf_mat.py} +10 -10
- scitex/plt/ax/_plot/_stx_ecdf.py +109 -0
- scitex/plt/ax/_plot/{_plot_fillv.py → _stx_fillv.py} +7 -7
- scitex/plt/ax/_plot/_stx_heatmap.py +366 -0
- scitex/plt/ax/_plot/{_plot_image.py → _stx_image.py} +1 -1
- scitex/plt/ax/_plot/_stx_joyplot.py +113 -0
- scitex/plt/ax/_plot/{_plot_raster.py → _stx_raster.py} +37 -25
- scitex/plt/ax/_plot/{_plot_rectangle.py → _stx_rectangle.py} +10 -9
- scitex/plt/ax/_plot/{_plot_scatter_hist.py → _stx_scatter_hist.py} +1 -1
- scitex/plt/ax/_plot/_stx_shaded_line.py +215 -0
- scitex/plt/ax/_plot/{_plot_violin.py → _stx_violin.py} +13 -6
- scitex/plt/ax/_style/__init__.py +3 -0
- scitex/plt/ax/_style/_style_barplot.py +13 -2
- scitex/plt/ax/_style/_style_boxplot.py +78 -32
- scitex/plt/ax/_style/_style_errorbar.py +17 -3
- scitex/plt/ax/_style/_style_scatter.py +17 -3
- scitex/plt/ax/_style/_style_violinplot.py +109 -0
- scitex/plt/color/_vizualize_colors.py +3 -3
- scitex/plt/styles/SCITEX_STYLE.yaml +104 -0
- scitex/plt/styles/__init__.py +57 -0
- scitex/plt/styles/_plot_defaults.py +209 -0
- scitex/plt/styles/_plot_postprocess.py +518 -0
- scitex/plt/styles/_style_loader.py +268 -0
- scitex/plt/styles/presets.py +208 -0
- scitex/plt/utils/_collect_figure_metadata.py +160 -18
- scitex/plt/utils/_colorbar.py +72 -10
- scitex/plt/utils/_configure_mpl.py +108 -52
- scitex/plt/utils/_crop.py +21 -7
- scitex/plt/utils/_figure_mm.py +21 -7
- scitex/stats/__init__.py +13 -1
- scitex/stats/_schema.py +578 -0
- scitex/stats/tests/__init__.py +13 -0
- scitex/stats/tests/correlation/__init__.py +13 -0
- scitex/stats/tests/correlation/_test_pearson.py +262 -0
- scitex/vis/__init__.py +6 -0
- scitex/vis/editor/__init__.py +23 -0
- scitex/vis/editor/_defaults.py +205 -0
- scitex/vis/editor/_edit.py +342 -0
- scitex/vis/editor/_mpl_editor.py +231 -0
- scitex/vis/editor/_tkinter_editor.py +466 -0
- scitex/vis/editor/_web_editor.py +1440 -0
- scitex/vis/model/plot_types.py +15 -15
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/METADATA +2 -1
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/RECORD +94 -67
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/WHEEL +1 -1
- scitex/plt/ax/_plot/_plot_ecdf.py +0 -84
- scitex/plt/ax/_plot/_plot_heatmap.py +0 -277
- scitex/plt/ax/_plot/_plot_joyplot.py +0 -77
- scitex/plt/ax/_plot/_plot_shaded_line.py +0 -142
- scitex/plt/presets.py +0 -224
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/entry_points.txt +0 -0
- {scitex-2.3.0.dist-info → scitex-2.4.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
|
-
# Timestamp: "2025-
|
|
4
|
-
# File:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__FILE__ = __file__
|
|
8
|
-
__DIR__ = os.path.dirname(__FILE__)
|
|
9
|
-
# ----------------------------------------
|
|
3
|
+
# Timestamp: "2025-12-01 13:30:00 (ywatanabe)"
|
|
4
|
+
# File: ./src/scitex/plt/_subplots/_export_as_csv_formatters/_format_plot.py
|
|
5
|
+
|
|
6
|
+
"""CSV formatter for matplotlib plot() calls."""
|
|
10
7
|
|
|
11
8
|
from collections import OrderedDict
|
|
9
|
+
from typing import Any, Dict, Optional
|
|
10
|
+
|
|
12
11
|
import numpy as np
|
|
13
12
|
import pandas as pd
|
|
14
13
|
import xarray as xr
|
|
15
14
|
|
|
16
|
-
def _format_plot(id, tracked_dict, kwargs):
|
|
17
|
-
"""Format data from a plot call.
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
def _format_plot(
|
|
17
|
+
id: str,
|
|
18
|
+
tracked_dict: Optional[Dict[str, Any]],
|
|
19
|
+
kwargs: Dict[str, Any],
|
|
20
|
+
) -> pd.DataFrame:
|
|
21
|
+
"""Format data from a plot() call for CSV export.
|
|
22
|
+
|
|
23
|
+
Handles various input formats including:
|
|
24
|
+
- Pre-formatted plot_df from scitex wrappers
|
|
25
|
+
- Raw args from __getattr__ proxied matplotlib calls
|
|
26
|
+
- Single array: plot(y) generates x from indices
|
|
27
|
+
- Two arrays: plot(x, y)
|
|
28
|
+
- 2D arrays: creates multiple x/y column pairs
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
Parameters
|
|
31
|
+
----------
|
|
32
|
+
id : str
|
|
33
|
+
Identifier prefix for the output columns (e.g., "ax_00").
|
|
34
|
+
tracked_dict : dict or None
|
|
35
|
+
Dictionary containing tracked data. May include:
|
|
36
|
+
- 'plot_df': Pre-formatted DataFrame from wrapper
|
|
37
|
+
- 'args': Raw positional arguments (x, y) from plot()
|
|
38
|
+
kwargs : dict
|
|
39
|
+
Keyword arguments passed to plot (currently unused).
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
pd.DataFrame
|
|
44
|
+
Formatted data with columns prefixed by id.
|
|
45
|
+
For 1D data: {id}_plot_x, {id}_plot_y
|
|
46
|
+
For 2D data: {id}_plot_x00, {id}_plot_y00, {id}_plot_x01, ...
|
|
26
47
|
"""
|
|
27
48
|
# Check if tracked_dict is empty or not a dictionary
|
|
28
49
|
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
29
50
|
return pd.DataFrame()
|
|
30
|
-
|
|
31
|
-
# For
|
|
51
|
+
|
|
52
|
+
# For stx_line, we expect a 'plot_df' key
|
|
32
53
|
if 'plot_df' in tracked_dict:
|
|
33
54
|
plot_df = tracked_dict['plot_df']
|
|
34
55
|
if isinstance(plot_df, pd.DataFrame):
|
|
35
56
|
# Add the id prefix to all columns
|
|
36
57
|
return plot_df.add_prefix(f"{id}_")
|
|
37
|
-
|
|
38
|
-
#
|
|
58
|
+
|
|
59
|
+
# Handle raw args from __getattr__ proxied calls
|
|
39
60
|
if 'args' in tracked_dict:
|
|
40
61
|
args = tracked_dict['args']
|
|
41
62
|
if isinstance(args, tuple) and len(args) > 0:
|
|
63
|
+
# Handle single argument: plot(y) or plot(data_2d)
|
|
42
64
|
if len(args) == 1:
|
|
43
65
|
args_value = args[0]
|
|
44
66
|
|
|
@@ -60,32 +82,47 @@ def _format_plot(id, tracked_dict, kwargs):
|
|
|
60
82
|
df = pd.DataFrame({f"{id}_plot_x": x, f"{id}_plot_y": y})
|
|
61
83
|
return df
|
|
62
84
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
85
|
+
# Handle two arguments: plot(x, y)
|
|
86
|
+
elif len(args) >= 2:
|
|
87
|
+
x_arg, y_arg = args[0], args[1]
|
|
88
|
+
|
|
89
|
+
# Convert to numpy
|
|
90
|
+
x = np.asarray(x_arg.values if hasattr(x_arg, 'values') else x_arg)
|
|
91
|
+
y = np.asarray(y_arg.values if hasattr(y_arg, 'values') else y_arg)
|
|
92
|
+
|
|
93
|
+
# Handle 2D y array (multiple lines)
|
|
94
|
+
if hasattr(y, 'ndim') and y.ndim == 2:
|
|
95
|
+
out = OrderedDict()
|
|
96
|
+
for ii in range(y.shape[1]):
|
|
97
|
+
out[f"{id}_plot_x{ii:02d}"] = x
|
|
98
|
+
out[f"{id}_plot_y{ii:02d}"] = y[:, ii]
|
|
99
|
+
df = pd.DataFrame(out)
|
|
100
|
+
return df
|
|
101
|
+
|
|
102
|
+
# Handle DataFrame y
|
|
103
|
+
if isinstance(y_arg, pd.DataFrame):
|
|
75
104
|
df = pd.DataFrame(
|
|
76
105
|
{
|
|
77
106
|
f"{id}_plot_x": x,
|
|
78
107
|
**{
|
|
79
|
-
f"{id}_plot_y{ii:02d}": np.array(
|
|
80
|
-
for ii, col in enumerate(
|
|
108
|
+
f"{id}_plot_y{ii:02d}": np.array(y_arg[col])
|
|
109
|
+
for ii, col in enumerate(y_arg.columns)
|
|
81
110
|
},
|
|
82
111
|
}
|
|
83
112
|
)
|
|
84
113
|
return df
|
|
85
114
|
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
# Handle 1D arrays (most common case: plot(x, y))
|
|
116
|
+
if hasattr(y, 'ndim') and y.ndim == 1:
|
|
117
|
+
# Flatten x if needed
|
|
118
|
+
x_flat = np.ravel(x)
|
|
119
|
+
y_flat = np.ravel(y)
|
|
120
|
+
df = pd.DataFrame({f"{id}_plot_x": x_flat, f"{id}_plot_y": y_flat})
|
|
88
121
|
return df
|
|
89
122
|
|
|
123
|
+
# Fallback for list-like y
|
|
124
|
+
df = pd.DataFrame({f"{id}_plot_x": np.ravel(x), f"{id}_plot_y": np.ravel(y)})
|
|
125
|
+
return df
|
|
126
|
+
|
|
90
127
|
# Default empty DataFrame if we can't process the input
|
|
91
128
|
return pd.DataFrame()
|
|
@@ -12,7 +12,7 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_box(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_box call."""
|
|
16
16
|
# Check if tracked_dict is empty or not a dictionary
|
|
17
17
|
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
18
18
|
return pd.DataFrame()
|
|
@@ -12,14 +12,14 @@ import pandas as pd
|
|
|
12
12
|
from scitex.pd import force_df
|
|
13
13
|
|
|
14
14
|
def _format_plot_kde(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_kde call.
|
|
16
16
|
|
|
17
17
|
Processes kernel density estimation plot data.
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
id (str): Identifier for the plot
|
|
21
21
|
tracked_dict (dict): Dictionary containing 'x', 'kde', and 'n' keys
|
|
22
|
-
kwargs (dict): Keyword arguments passed to
|
|
22
|
+
kwargs (dict): Keyword arguments passed to stx_kde
|
|
23
23
|
|
|
24
24
|
Returns:
|
|
25
25
|
pd.DataFrame: Formatted KDE data
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
|
|
4
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_quiver.py
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _format_quiver(id, tracked_dict, kwargs):
|
|
11
|
+
"""Format data from a quiver (vector field) call.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
id (str): Identifier for the plot
|
|
15
|
+
tracked_dict (dict): Dictionary containing tracked data
|
|
16
|
+
kwargs (dict): Keyword arguments passed to quiver
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
pd.DataFrame: Formatted data from quiver (X, Y positions and U, V vectors)
|
|
20
|
+
"""
|
|
21
|
+
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
22
|
+
return pd.DataFrame()
|
|
23
|
+
|
|
24
|
+
if 'args' in tracked_dict:
|
|
25
|
+
args = tracked_dict['args']
|
|
26
|
+
if isinstance(args, tuple):
|
|
27
|
+
# quiver can be called as:
|
|
28
|
+
# quiver(U, V) - positions auto-generated
|
|
29
|
+
# quiver(X, Y, U, V) - explicit positions
|
|
30
|
+
if len(args) == 2:
|
|
31
|
+
U = np.asarray(args[0])
|
|
32
|
+
V = np.asarray(args[1])
|
|
33
|
+
X, Y = np.meshgrid(np.arange(U.shape[1]), np.arange(U.shape[0]))
|
|
34
|
+
elif len(args) >= 4:
|
|
35
|
+
X = np.asarray(args[0])
|
|
36
|
+
Y = np.asarray(args[1])
|
|
37
|
+
U = np.asarray(args[2])
|
|
38
|
+
V = np.asarray(args[3])
|
|
39
|
+
else:
|
|
40
|
+
return pd.DataFrame()
|
|
41
|
+
|
|
42
|
+
df = pd.DataFrame({
|
|
43
|
+
f"{id}_quiver_x": X.flatten(),
|
|
44
|
+
f"{id}_quiver_y": Y.flatten(),
|
|
45
|
+
f"{id}_quiver_u": U.flatten(),
|
|
46
|
+
f"{id}_quiver_v": V.flatten()
|
|
47
|
+
})
|
|
48
|
+
return df
|
|
49
|
+
|
|
50
|
+
return pd.DataFrame()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# EOF
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
|
|
4
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_stem.py
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _format_stem(id, tracked_dict, kwargs):
|
|
11
|
+
"""Format data from a stem plot call.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
id (str): Identifier for the plot
|
|
15
|
+
tracked_dict (dict): Dictionary containing tracked data
|
|
16
|
+
kwargs (dict): Keyword arguments passed to stem
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
pd.DataFrame: Formatted data from stem plot
|
|
20
|
+
"""
|
|
21
|
+
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
22
|
+
return pd.DataFrame()
|
|
23
|
+
|
|
24
|
+
if 'args' in tracked_dict:
|
|
25
|
+
args = tracked_dict['args']
|
|
26
|
+
if isinstance(args, tuple) and len(args) > 0:
|
|
27
|
+
if len(args) == 1:
|
|
28
|
+
y = np.asarray(args[0])
|
|
29
|
+
x = np.arange(len(y))
|
|
30
|
+
elif len(args) >= 2:
|
|
31
|
+
x = np.asarray(args[0])
|
|
32
|
+
y = np.asarray(args[1])
|
|
33
|
+
else:
|
|
34
|
+
return pd.DataFrame()
|
|
35
|
+
|
|
36
|
+
df = pd.DataFrame({f"{id}_stem_x": x, f"{id}_stem_y": y})
|
|
37
|
+
return df
|
|
38
|
+
|
|
39
|
+
return pd.DataFrame()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# EOF
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
|
|
4
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_step.py
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _format_step(id, tracked_dict, kwargs):
|
|
11
|
+
"""Format data from a step plot call.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
id (str): Identifier for the plot
|
|
15
|
+
tracked_dict (dict): Dictionary containing tracked data
|
|
16
|
+
kwargs (dict): Keyword arguments passed to step
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
pd.DataFrame: Formatted data from step plot
|
|
20
|
+
"""
|
|
21
|
+
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
22
|
+
return pd.DataFrame()
|
|
23
|
+
|
|
24
|
+
if 'args' in tracked_dict:
|
|
25
|
+
args = tracked_dict['args']
|
|
26
|
+
if isinstance(args, tuple) and len(args) > 0:
|
|
27
|
+
if len(args) == 1:
|
|
28
|
+
y = np.asarray(args[0])
|
|
29
|
+
x = np.arange(len(y))
|
|
30
|
+
elif len(args) >= 2:
|
|
31
|
+
x = np.asarray(args[0])
|
|
32
|
+
y = np.asarray(args[1])
|
|
33
|
+
else:
|
|
34
|
+
return pd.DataFrame()
|
|
35
|
+
|
|
36
|
+
df = pd.DataFrame({f"{id}_step_x": x, f"{id}_step_y": y})
|
|
37
|
+
return df
|
|
38
|
+
|
|
39
|
+
return pd.DataFrame()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# EOF
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Timestamp: "2025-12-01 12:20:00 (ywatanabe)"
|
|
4
|
+
# File: /home/ywatanabe/proj/scitex-code/src/scitex/plt/_subplots/_export_as_csv_formatters/_format_streamplot.py
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _format_streamplot(id, tracked_dict, kwargs):
|
|
11
|
+
"""Format data from a streamplot call.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
id (str): Identifier for the plot
|
|
15
|
+
tracked_dict (dict): Dictionary containing tracked data
|
|
16
|
+
kwargs (dict): Keyword arguments passed to streamplot
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
pd.DataFrame: Formatted data from streamplot (X, Y positions and U, V vectors)
|
|
20
|
+
"""
|
|
21
|
+
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
22
|
+
return pd.DataFrame()
|
|
23
|
+
|
|
24
|
+
if 'args' in tracked_dict:
|
|
25
|
+
args = tracked_dict['args']
|
|
26
|
+
if isinstance(args, tuple) and len(args) >= 4:
|
|
27
|
+
# streamplot(X, Y, U, V) - X, Y are 1D, U, V are 2D
|
|
28
|
+
X = np.asarray(args[0])
|
|
29
|
+
Y = np.asarray(args[1])
|
|
30
|
+
U = np.asarray(args[2])
|
|
31
|
+
V = np.asarray(args[3])
|
|
32
|
+
|
|
33
|
+
# Create meshgrid if X, Y are 1D
|
|
34
|
+
if X.ndim == 1 and Y.ndim == 1:
|
|
35
|
+
X, Y = np.meshgrid(X, Y)
|
|
36
|
+
|
|
37
|
+
df = pd.DataFrame({
|
|
38
|
+
f"{id}_streamplot_x": X.flatten(),
|
|
39
|
+
f"{id}_streamplot_y": Y.flatten(),
|
|
40
|
+
f"{id}_streamplot_u": U.flatten(),
|
|
41
|
+
f"{id}_streamplot_v": V.flatten()
|
|
42
|
+
})
|
|
43
|
+
return df
|
|
44
|
+
|
|
45
|
+
return pd.DataFrame()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# EOF
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_conf_mat.py → _format_stx_conf_mat.py}
RENAMED
|
@@ -12,12 +12,12 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_conf_mat(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_conf_mat call.
|
|
16
16
|
|
|
17
17
|
Args:
|
|
18
18
|
id (str): Identifier for the plot
|
|
19
19
|
tracked_dict (dict): Dictionary containing tracked data
|
|
20
|
-
kwargs (dict): Keyword arguments passed to
|
|
20
|
+
kwargs (dict): Keyword arguments passed to stx_conf_mat
|
|
21
21
|
|
|
22
22
|
Returns:
|
|
23
23
|
pd.DataFrame: Formatted confusion matrix data
|
|
@@ -11,12 +11,12 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
# ----------------------------------------
|
|
12
12
|
|
|
13
13
|
def _format_plot_ecdf(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_ecdf call.
|
|
15
15
|
|
|
16
16
|
Args:
|
|
17
17
|
id (str): Identifier for the plot
|
|
18
18
|
tracked_dict (dict): Dictionary containing 'ecdf_df' key with ECDF data
|
|
19
|
-
kwargs (dict): Keyword arguments passed to
|
|
19
|
+
kwargs (dict): Keyword arguments passed to stx_ecdf
|
|
20
20
|
|
|
21
21
|
Returns:
|
|
22
22
|
pd.DataFrame: Formatted ECDF data
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_fillv.py → _format_stx_fillv.py}
RENAMED
|
@@ -12,14 +12,14 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_fillv(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_fillv call.
|
|
16
16
|
|
|
17
17
|
Formats data similar to line plot format for better compatibility.
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
id (str): Identifier for the plot
|
|
21
21
|
tracked_dict (dict): Dictionary containing tracked data
|
|
22
|
-
kwargs (dict): Keyword arguments passed to
|
|
22
|
+
kwargs (dict): Keyword arguments passed to stx_fillv
|
|
23
23
|
|
|
24
24
|
Returns:
|
|
25
25
|
pd.DataFrame: Formatted fillv data in a long-format dataframe
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_heatmap.py → _format_stx_heatmap.py}
RENAMED
|
@@ -12,14 +12,14 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_heatmap(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_heatmap call.
|
|
16
16
|
|
|
17
17
|
Exports heatmap data in xyz format (x, y, value) for better compatibility.
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
id (str): Identifier for the plot
|
|
21
21
|
tracked_dict (dict): Dictionary containing tracked data
|
|
22
|
-
kwargs (dict): Keyword arguments passed to
|
|
22
|
+
kwargs (dict): Keyword arguments passed to stx_heatmap
|
|
23
23
|
|
|
24
24
|
Returns:
|
|
25
25
|
pd.DataFrame: Formatted heatmap data in xyz format
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_image.py → _format_stx_image.py}
RENAMED
|
@@ -12,7 +12,7 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
12
12
|
# ----------------------------------------
|
|
13
13
|
|
|
14
14
|
def _format_plot_image(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_image call.
|
|
16
16
|
|
|
17
17
|
Exports image data in long-format xyz format for better compatibility.
|
|
18
18
|
Also saves channel data for RGB/RGBA images.
|
|
@@ -20,7 +20,7 @@ def _format_plot_image(id, tracked_dict, kwargs):
|
|
|
20
20
|
Args:
|
|
21
21
|
id (str or int): Identifier for the plot
|
|
22
22
|
tracked_dict (dict): Dictionary containing tracked data
|
|
23
|
-
kwargs (dict): Keyword arguments passed to
|
|
23
|
+
kwargs (dict): Keyword arguments passed to stx_image
|
|
24
24
|
|
|
25
25
|
Returns:
|
|
26
26
|
pd.DataFrame: Formatted image data in xyz format
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_joyplot.py → _format_stx_joyplot.py}
RENAMED
|
@@ -13,12 +13,12 @@ import pandas as pd
|
|
|
13
13
|
from scitex.pd import force_df
|
|
14
14
|
|
|
15
15
|
def _format_plot_joyplot(id, tracked_dict, kwargs):
|
|
16
|
-
"""Format data from a
|
|
16
|
+
"""Format data from a stx_joyplot call.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
id (str): Identifier for the plot
|
|
20
20
|
tracked_dict (dict): Dictionary containing 'joyplot_data' key with joyplot data
|
|
21
|
-
kwargs (dict): Keyword arguments passed to
|
|
21
|
+
kwargs (dict): Keyword arguments passed to stx_joyplot
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
pd.DataFrame: Formatted joyplot data
|
|
@@ -11,14 +11,14 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_line(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_line call.
|
|
15
15
|
|
|
16
|
-
Processes
|
|
16
|
+
Processes stx_line data for CSV export.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
id (str): Identifier for the plot
|
|
20
20
|
tracked_dict (dict): Dictionary containing 'plot_df' key with plot data
|
|
21
|
-
kwargs (dict): Keyword arguments passed to
|
|
21
|
+
kwargs (dict): Keyword arguments passed to stx_line
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
pd.DataFrame: Formatted line plot data
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_ci.py → _format_stx_mean_ci.py}
RENAMED
|
@@ -11,14 +11,14 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_mean_ci(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_mean_ci call.
|
|
15
15
|
|
|
16
16
|
Processes mean with confidence interval band plot data for CSV export.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
id (str): Identifier for the plot
|
|
20
20
|
tracked_dict (dict): Contains 'plot_df' (pandas DataFrame with mean and CI data)
|
|
21
|
-
kwargs (dict): Keyword arguments passed to
|
|
21
|
+
kwargs (dict): Keyword arguments passed to stx_mean_ci
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
pd.DataFrame: Formatted mean and CI data
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_mean_std.py → _format_stx_mean_std.py}
RENAMED
|
@@ -11,14 +11,14 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_mean_std(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_mean_std call.
|
|
15
15
|
|
|
16
16
|
Processes mean with standard deviation band plot data for CSV export.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
id (str): Identifier for the plot
|
|
20
20
|
tracked_dict (dict): Dictionary containing 'plot_df' key with mean and std data
|
|
21
|
-
kwargs (dict): Keyword arguments passed to
|
|
21
|
+
kwargs (dict): Keyword arguments passed to stx_mean_std
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
pd.DataFrame: Formatted mean and std data
|
|
@@ -11,14 +11,14 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_median_iqr(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_median_iqr call.
|
|
15
15
|
|
|
16
16
|
Processes median with interquartile range band plot data for CSV export.
|
|
17
17
|
|
|
18
18
|
Args:
|
|
19
19
|
id (str): Identifier for the plot
|
|
20
20
|
tracked_dict (dict): Contains 'plot_df' (pandas DataFrame with median and IQR data)
|
|
21
|
-
kwargs (dict): Keyword arguments passed to
|
|
21
|
+
kwargs (dict): Keyword arguments passed to stx_median_iqr
|
|
22
22
|
|
|
23
23
|
Returns:
|
|
24
24
|
pd.DataFrame: Formatted median and IQR data
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_raster.py → _format_stx_raster.py}
RENAMED
|
@@ -11,12 +11,12 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_raster(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_raster call.
|
|
15
15
|
|
|
16
16
|
Args:
|
|
17
17
|
id (str): Identifier for the plot
|
|
18
18
|
tracked_dict (dict): Dictionary containing 'raster_digit_df' key with raster plot data
|
|
19
|
-
kwargs (dict): Keyword arguments passed to
|
|
19
|
+
kwargs (dict): Keyword arguments passed to stx_raster
|
|
20
20
|
|
|
21
21
|
Returns:
|
|
22
22
|
pd.DataFrame: Formatted raster plot data
|
|
@@ -12,7 +12,7 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_rectangle(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_rectangle call."""
|
|
16
16
|
# Check if tracked_dict is empty or not a dictionary
|
|
17
17
|
if not tracked_dict or not isinstance(tracked_dict, dict):
|
|
18
18
|
return pd.DataFrame()
|
|
@@ -12,12 +12,12 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_scatter_hist(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_scatter_hist call.
|
|
16
16
|
|
|
17
17
|
Args:
|
|
18
18
|
id (str): Identifier for the plot
|
|
19
19
|
tracked_dict (dict): Dictionary containing tracked data
|
|
20
|
-
kwargs (dict): Keyword arguments passed to
|
|
20
|
+
kwargs (dict): Keyword arguments passed to stx_scatter_hist
|
|
21
21
|
|
|
22
22
|
Returns:
|
|
23
23
|
pd.DataFrame: Formatted scatter histogram data
|
|
@@ -11,12 +11,12 @@ __DIR__ = os.path.dirname(__FILE__)
|
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
13
|
def _format_plot_shaded_line(id, tracked_dict, kwargs):
|
|
14
|
-
"""Format data from a
|
|
14
|
+
"""Format data from a stx_shaded_line call.
|
|
15
15
|
|
|
16
16
|
Args:
|
|
17
17
|
id (str): Identifier for the plot
|
|
18
18
|
tracked_dict (dict): Dictionary containing tracked data
|
|
19
|
-
kwargs (dict): Keyword arguments passed to
|
|
19
|
+
kwargs (dict): Keyword arguments passed to stx_shaded_line
|
|
20
20
|
|
|
21
21
|
Returns:
|
|
22
22
|
pd.DataFrame: Formatted shaded line data
|
scitex/plt/_subplots/_export_as_csv_formatters/{_format_plot_violin.py → _format_stx_violin.py}
RENAMED
|
@@ -12,14 +12,14 @@ import numpy as np
|
|
|
12
12
|
import pandas as pd
|
|
13
13
|
|
|
14
14
|
def _format_plot_violin(id, tracked_dict, kwargs):
|
|
15
|
-
"""Format data from a
|
|
15
|
+
"""Format data from a stx_violin call.
|
|
16
16
|
|
|
17
17
|
Formats data in a long-format for better compatibility.
|
|
18
18
|
|
|
19
19
|
Args:
|
|
20
20
|
id (str): Identifier for the plot
|
|
21
21
|
tracked_dict (dict): Dictionary containing tracked data
|
|
22
|
-
kwargs (dict): Keyword arguments passed to
|
|
22
|
+
kwargs (dict): Keyword arguments passed to stx_violin
|
|
23
23
|
|
|
24
24
|
Returns:
|
|
25
25
|
pd.DataFrame: Formatted violin plot data in long format
|