batplot 1.8.1__py3-none-any.whl → 1.8.3__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.
Potentially problematic release.
This version of batplot might be problematic. Click here for more details.
- batplot/__init__.py +1 -1
- batplot/args.py +2 -0
- batplot/batch.py +23 -0
- batplot/batplot.py +101 -12
- batplot/cpc_interactive.py +25 -3
- batplot/electrochem_interactive.py +20 -4
- batplot/interactive.py +19 -15
- batplot/modes.py +12 -12
- batplot/operando_ec_interactive.py +4 -4
- batplot/session.py +218 -0
- batplot/style.py +21 -2
- batplot/version_check.py +1 -1
- {batplot-1.8.1.dist-info → batplot-1.8.3.dist-info}/METADATA +1 -1
- batplot-1.8.3.dist-info/RECORD +75 -0
- {batplot-1.8.1.dist-info → batplot-1.8.3.dist-info}/top_level.txt +1 -0
- batplot_backup_20251221_101150/__init__.py +5 -0
- batplot_backup_20251221_101150/args.py +625 -0
- batplot_backup_20251221_101150/batch.py +1176 -0
- batplot_backup_20251221_101150/batplot.py +3589 -0
- batplot_backup_20251221_101150/cif.py +823 -0
- batplot_backup_20251221_101150/cli.py +149 -0
- batplot_backup_20251221_101150/color_utils.py +547 -0
- batplot_backup_20251221_101150/config.py +198 -0
- batplot_backup_20251221_101150/converters.py +204 -0
- batplot_backup_20251221_101150/cpc_interactive.py +4409 -0
- batplot_backup_20251221_101150/electrochem_interactive.py +4520 -0
- batplot_backup_20251221_101150/interactive.py +3894 -0
- batplot_backup_20251221_101150/manual.py +323 -0
- batplot_backup_20251221_101150/modes.py +799 -0
- batplot_backup_20251221_101150/operando.py +603 -0
- batplot_backup_20251221_101150/operando_ec_interactive.py +5487 -0
- batplot_backup_20251221_101150/plotting.py +228 -0
- batplot_backup_20251221_101150/readers.py +2607 -0
- batplot_backup_20251221_101150/session.py +2951 -0
- batplot_backup_20251221_101150/style.py +1441 -0
- batplot_backup_20251221_101150/ui.py +790 -0
- batplot_backup_20251221_101150/utils.py +1046 -0
- batplot_backup_20251221_101150/version_check.py +253 -0
- batplot-1.8.1.dist-info/RECORD +0 -52
- {batplot-1.8.1.dist-info → batplot-1.8.3.dist-info}/WHEEL +0 -0
- {batplot-1.8.1.dist-info → batplot-1.8.3.dist-info}/entry_points.txt +0 -0
- {batplot-1.8.1.dist-info → batplot-1.8.3.dist-info}/licenses/LICENSE +0 -0
batplot/session.py
CHANGED
|
@@ -36,11 +36,116 @@ import os
|
|
|
36
36
|
|
|
37
37
|
import matplotlib.pyplot as plt
|
|
38
38
|
import numpy as np
|
|
39
|
+
import sys
|
|
39
40
|
|
|
40
41
|
from .utils import _confirm_overwrite
|
|
41
42
|
from .color_utils import ensure_colormap
|
|
42
43
|
|
|
43
44
|
|
|
45
|
+
def _get_package_versions():
|
|
46
|
+
"""Get versions of critical packages for compatibility checking.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
dict: Package name -> version string mapping
|
|
50
|
+
"""
|
|
51
|
+
versions = {}
|
|
52
|
+
critical_packages = ['numpy', 'matplotlib', 'scipy']
|
|
53
|
+
|
|
54
|
+
for pkg_name in critical_packages:
|
|
55
|
+
try:
|
|
56
|
+
mod = __import__(pkg_name)
|
|
57
|
+
versions[pkg_name] = getattr(mod, '__version__', 'unknown')
|
|
58
|
+
except ImportError:
|
|
59
|
+
versions[pkg_name] = 'not_installed'
|
|
60
|
+
except Exception:
|
|
61
|
+
versions[pkg_name] = 'unknown'
|
|
62
|
+
|
|
63
|
+
# Also track Python version
|
|
64
|
+
versions['python'] = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}"
|
|
65
|
+
|
|
66
|
+
return versions
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _check_package_compatibility(saved_versions, current_versions, filename):
|
|
70
|
+
"""Check if package versions are compatible and warn/error if not.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
saved_versions: dict of package -> version from saved session
|
|
74
|
+
current_versions: dict of package -> version currently installed
|
|
75
|
+
filename: session filename for error messages
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
bool: True if compatible (or can proceed), False if should abort
|
|
79
|
+
"""
|
|
80
|
+
if not saved_versions:
|
|
81
|
+
# Old session file without version info - allow but warn
|
|
82
|
+
print("Warning: Session file does not contain package version information.")
|
|
83
|
+
print("This may cause compatibility issues. Consider recreating the session.")
|
|
84
|
+
return True
|
|
85
|
+
|
|
86
|
+
mismatches = []
|
|
87
|
+
critical_mismatches = []
|
|
88
|
+
|
|
89
|
+
for pkg in ['numpy', 'matplotlib', 'python']:
|
|
90
|
+
saved_ver = saved_versions.get(pkg, 'unknown')
|
|
91
|
+
current_ver = current_versions.get(pkg, 'unknown')
|
|
92
|
+
|
|
93
|
+
if saved_ver == 'unknown' or current_ver == 'unknown':
|
|
94
|
+
continue
|
|
95
|
+
|
|
96
|
+
if saved_ver != current_ver:
|
|
97
|
+
# Check for critical incompatibilities
|
|
98
|
+
if pkg == 'numpy':
|
|
99
|
+
# numpy 2.0+ uses _core, <2.0 doesn't - this is a breaking change
|
|
100
|
+
try:
|
|
101
|
+
saved_major = int(saved_ver.split('.')[0])
|
|
102
|
+
current_major = int(current_ver.split('.')[0])
|
|
103
|
+
if saved_major != current_major:
|
|
104
|
+
critical_mismatches.append((pkg, saved_ver, current_ver))
|
|
105
|
+
else:
|
|
106
|
+
mismatches.append((pkg, saved_ver, current_ver))
|
|
107
|
+
except (ValueError, IndexError):
|
|
108
|
+
mismatches.append((pkg, saved_ver, current_ver))
|
|
109
|
+
elif pkg == 'python':
|
|
110
|
+
# Python major version changes are critical
|
|
111
|
+
try:
|
|
112
|
+
saved_major = int(saved_ver.split('.')[0])
|
|
113
|
+
current_major = int(current_ver.split('.')[0])
|
|
114
|
+
if saved_major != current_major:
|
|
115
|
+
critical_mismatches.append((pkg, saved_ver, current_ver))
|
|
116
|
+
else:
|
|
117
|
+
mismatches.append((pkg, saved_ver, current_ver))
|
|
118
|
+
except (ValueError, IndexError):
|
|
119
|
+
mismatches.append((pkg, saved_ver, current_ver))
|
|
120
|
+
else:
|
|
121
|
+
mismatches.append((pkg, saved_ver, current_ver))
|
|
122
|
+
|
|
123
|
+
if critical_mismatches:
|
|
124
|
+
print(f"\nERROR: Critical package version mismatch detected for session: {filename}")
|
|
125
|
+
print("The following packages have incompatible major version changes:")
|
|
126
|
+
for pkg, saved, current in critical_mismatches:
|
|
127
|
+
print(f" {pkg}: saved with {saved}, current is {current}")
|
|
128
|
+
print("\nThis will likely cause pickle loading to fail.")
|
|
129
|
+
print("Solutions:")
|
|
130
|
+
print(" 1. Install matching package versions:")
|
|
131
|
+
for pkg, saved, current in critical_mismatches:
|
|
132
|
+
print(f" pip install '{pkg}=={saved}' # or use conda")
|
|
133
|
+
print(" 2. Recreate the session from original data files")
|
|
134
|
+
return False
|
|
135
|
+
|
|
136
|
+
if mismatches:
|
|
137
|
+
print(f"\nWarning: Package version differences detected for session: {filename}")
|
|
138
|
+
print("Minor version differences may be okay, but proceed with caution:")
|
|
139
|
+
for pkg, saved, current in mismatches:
|
|
140
|
+
print(f" {pkg}: saved with {saved}, current is {current}")
|
|
141
|
+
print("If you encounter errors, try matching the saved versions.")
|
|
142
|
+
response = input("Continue loading session? (y/n): ").strip().lower()
|
|
143
|
+
if response != 'y':
|
|
144
|
+
return False
|
|
145
|
+
|
|
146
|
+
return True
|
|
147
|
+
|
|
148
|
+
|
|
44
149
|
def _current_tick_width(axis_obj, which: str):
|
|
45
150
|
"""
|
|
46
151
|
Return the configured tick width for the given X/Y axis.
|
|
@@ -431,8 +536,12 @@ def dump_session(
|
|
|
431
536
|
wasd_state = _capture_wasd_state(ax)
|
|
432
537
|
|
|
433
538
|
try:
|
|
539
|
+
# Get current package versions for compatibility checking
|
|
540
|
+
package_versions = _get_package_versions()
|
|
541
|
+
|
|
434
542
|
sess = {
|
|
435
543
|
'version': 3,
|
|
544
|
+
'package_versions': package_versions, # Track versions for compatibility checking
|
|
436
545
|
'x_data': [np.array(a) for a in x_data_list],
|
|
437
546
|
'y_data': [np.array(a) for a in y_data_list],
|
|
438
547
|
'orig_y': [np.array(a) for a in orig_y],
|
|
@@ -507,6 +616,8 @@ def dump_session(
|
|
|
507
616
|
}
|
|
508
617
|
# Save curve names visibility
|
|
509
618
|
sess['curve_names_visible'] = bool(getattr(fig, '_curve_names_visible', True))
|
|
619
|
+
# Save whether data were plotted with swapped axes via --ro
|
|
620
|
+
sess['ro_active'] = bool(getattr(fig, '_ro_active', False))
|
|
510
621
|
# Save stack/legend anchor preferences
|
|
511
622
|
sess['stack_label_at_bottom'] = bool(getattr(fig, '_stack_label_at_bottom', False))
|
|
512
623
|
sess['label_anchor_left'] = bool(getattr(fig, '_label_anchor_left', False))
|
|
@@ -752,9 +863,13 @@ def dump_operando_session(
|
|
|
752
863
|
cb_h_offset = getattr(cbar.ax, '_cb_h_offset_in', 0.0)
|
|
753
864
|
ec_h_offset = getattr(ec_ax, '_ec_h_offset_in', 0.0) if ec_ax is not None else None
|
|
754
865
|
|
|
866
|
+
# Get current package versions for compatibility checking
|
|
867
|
+
package_versions = _get_package_versions()
|
|
868
|
+
|
|
755
869
|
sess = {
|
|
756
870
|
'kind': 'operando_ec',
|
|
757
871
|
'version': 2,
|
|
872
|
+
'package_versions': package_versions, # Track versions for compatibility checking
|
|
758
873
|
'figure': {'size': (fig_w, fig_h), 'dpi': dpi},
|
|
759
874
|
'layout_inches': {
|
|
760
875
|
'cb_w_in': cb_w_in,
|
|
@@ -819,6 +934,26 @@ def load_operando_session(filename: str):
|
|
|
819
934
|
try:
|
|
820
935
|
with open(filename, 'rb') as f:
|
|
821
936
|
sess = pickle.load(f)
|
|
937
|
+
except ModuleNotFoundError as e:
|
|
938
|
+
# Handle numpy._core and other module import errors
|
|
939
|
+
if '_core' in str(e) or 'numpy' in str(e).lower():
|
|
940
|
+
print(f"\nERROR: NumPy version mismatch detected when loading: {filename}")
|
|
941
|
+
print("This session was saved with a different NumPy version.")
|
|
942
|
+
print("The error 'No module named numpy._core' indicates:")
|
|
943
|
+
print(" - Session saved with NumPy 2.0+ but loading with NumPy <2.0, OR")
|
|
944
|
+
print(" - Session saved with NumPy <2.0 but loading with NumPy 2.0+")
|
|
945
|
+
print("\nSolutions:")
|
|
946
|
+
print(" 1. Check NumPy version: python3 -c 'import numpy; print(numpy.__version__)'")
|
|
947
|
+
print(" 2. Install matching version:")
|
|
948
|
+
print(" - If session was saved with NumPy 2.0+: pip install 'numpy>=2.0'")
|
|
949
|
+
print(" - If session was saved with NumPy <2.0: pip install 'numpy<2.0'")
|
|
950
|
+
print(" 3. Recreate the session from original data files")
|
|
951
|
+
else:
|
|
952
|
+
print(f"\nERROR: Module import error when loading: {filename}")
|
|
953
|
+
print(f"Error: {e}")
|
|
954
|
+
print("This usually indicates a package version mismatch.")
|
|
955
|
+
print("Try installing matching package versions or recreate the session.")
|
|
956
|
+
return None
|
|
822
957
|
except Exception as e:
|
|
823
958
|
print(f"Failed to load session: {e}")
|
|
824
959
|
return None
|
|
@@ -826,6 +961,12 @@ def load_operando_session(filename: str):
|
|
|
826
961
|
if not isinstance(sess, dict) or sess.get('kind') != 'operando_ec':
|
|
827
962
|
print("Not an operando+EC session file.")
|
|
828
963
|
return None
|
|
964
|
+
|
|
965
|
+
# Check package version compatibility
|
|
966
|
+
saved_versions = sess.get('package_versions', {})
|
|
967
|
+
current_versions = _get_package_versions()
|
|
968
|
+
if not _check_package_compatibility(saved_versions, current_versions, filename):
|
|
969
|
+
return None
|
|
829
970
|
|
|
830
971
|
# Use standard DPI of 100 instead of saved DPI to avoid display-dependent issues
|
|
831
972
|
# (Retina displays, Windows scaling, etc. can cause saved DPI to differ)
|
|
@@ -1605,9 +1746,13 @@ def dump_ec_session(
|
|
|
1605
1746
|
legend_xy_in = (float(xy[0]), float(xy[1]))
|
|
1606
1747
|
except Exception:
|
|
1607
1748
|
legend_xy_in = None
|
|
1749
|
+
# Get current package versions for compatibility checking
|
|
1750
|
+
package_versions = _get_package_versions()
|
|
1751
|
+
|
|
1608
1752
|
sess = {
|
|
1609
1753
|
'kind': 'ec_gc',
|
|
1610
1754
|
'version': 2,
|
|
1755
|
+
'package_versions': package_versions, # Track versions for compatibility checking
|
|
1611
1756
|
'figure': {'size': (fig_w, fig_h), 'dpi': dpi},
|
|
1612
1757
|
'axis': axis,
|
|
1613
1758
|
'subplot_margins': subplot_margins,
|
|
@@ -1657,6 +1802,26 @@ def load_ec_session(filename: str):
|
|
|
1657
1802
|
try:
|
|
1658
1803
|
with open(filename, 'rb') as f:
|
|
1659
1804
|
sess = pickle.load(f)
|
|
1805
|
+
except ModuleNotFoundError as e:
|
|
1806
|
+
# Handle numpy._core and other module import errors
|
|
1807
|
+
if '_core' in str(e) or 'numpy' in str(e).lower():
|
|
1808
|
+
print(f"\nERROR: NumPy version mismatch detected when loading: {filename}")
|
|
1809
|
+
print("This session was saved with a different NumPy version.")
|
|
1810
|
+
print("The error 'No module named numpy._core' indicates:")
|
|
1811
|
+
print(" - Session saved with NumPy 2.0+ but loading with NumPy <2.0, OR")
|
|
1812
|
+
print(" - Session saved with NumPy <2.0 but loading with NumPy 2.0+")
|
|
1813
|
+
print("\nSolutions:")
|
|
1814
|
+
print(" 1. Check NumPy version: python3 -c 'import numpy; print(numpy.__version__)'")
|
|
1815
|
+
print(" 2. Install matching version:")
|
|
1816
|
+
print(" - If session was saved with NumPy 2.0+: pip install 'numpy>=2.0'")
|
|
1817
|
+
print(" - If session was saved with NumPy <2.0: pip install 'numpy<2.0'")
|
|
1818
|
+
print(" 3. Recreate the session from original data files")
|
|
1819
|
+
else:
|
|
1820
|
+
print(f"\nERROR: Module import error when loading: {filename}")
|
|
1821
|
+
print(f"Error: {e}")
|
|
1822
|
+
print("This usually indicates a package version mismatch.")
|
|
1823
|
+
print("Try installing matching package versions or recreate the session.")
|
|
1824
|
+
return None
|
|
1660
1825
|
except Exception as e:
|
|
1661
1826
|
print(f"Failed to load EC session: {e}")
|
|
1662
1827
|
return None
|
|
@@ -1664,6 +1829,12 @@ def load_ec_session(filename: str):
|
|
|
1664
1829
|
if not isinstance(sess, dict) or sess.get('kind') != 'ec_gc':
|
|
1665
1830
|
print("Not an EC GC session file.")
|
|
1666
1831
|
return None
|
|
1832
|
+
|
|
1833
|
+
# Check package version compatibility
|
|
1834
|
+
saved_versions = sess.get('package_versions', {})
|
|
1835
|
+
current_versions = _get_package_versions()
|
|
1836
|
+
if not _check_package_compatibility(saved_versions, current_versions, filename):
|
|
1837
|
+
return None
|
|
1667
1838
|
|
|
1668
1839
|
# Use standard DPI of 100 instead of saved DPI to avoid display-dependent issues
|
|
1669
1840
|
# (Retina displays, Windows scaling, etc. can cause saved DPI to differ)
|
|
@@ -2368,9 +2539,13 @@ def dump_cpc_session(
|
|
|
2368
2539
|
'right_y': float(getattr(ax2, '_right_ylabel_manual_offset_y_pts', 0.0) or 0.0),
|
|
2369
2540
|
}
|
|
2370
2541
|
|
|
2542
|
+
# Get current package versions for compatibility checking
|
|
2543
|
+
package_versions = _get_package_versions()
|
|
2544
|
+
|
|
2371
2545
|
meta = {
|
|
2372
2546
|
'kind': 'cpc',
|
|
2373
2547
|
'version': 2, # Incremented version for new format
|
|
2548
|
+
'package_versions': package_versions, # Track versions for compatibility checking
|
|
2374
2549
|
'figure': {
|
|
2375
2550
|
'size': (fig_w, fig_h),
|
|
2376
2551
|
'dpi': dpi,
|
|
@@ -2526,12 +2701,38 @@ def load_cpc_session(filename: str):
|
|
|
2526
2701
|
try:
|
|
2527
2702
|
with open(filename, 'rb') as f:
|
|
2528
2703
|
sess = pickle.load(f)
|
|
2704
|
+
except ModuleNotFoundError as e:
|
|
2705
|
+
# Handle numpy._core and other module import errors
|
|
2706
|
+
if '_core' in str(e) or 'numpy' in str(e).lower():
|
|
2707
|
+
print(f"\nERROR: NumPy version mismatch detected when loading: {filename}")
|
|
2708
|
+
print("This session was saved with a different NumPy version.")
|
|
2709
|
+
print("The error 'No module named numpy._core' indicates:")
|
|
2710
|
+
print(" - Session saved with NumPy 2.0+ but loading with NumPy <2.0, OR")
|
|
2711
|
+
print(" - Session saved with NumPy <2.0 but loading with NumPy 2.0+")
|
|
2712
|
+
print("\nSolutions:")
|
|
2713
|
+
print(" 1. Check NumPy version: python3 -c 'import numpy; print(numpy.__version__)'")
|
|
2714
|
+
print(" 2. Install matching version:")
|
|
2715
|
+
print(" - If session was saved with NumPy 2.0+: pip install 'numpy>=2.0'")
|
|
2716
|
+
print(" - If session was saved with NumPy <2.0: pip install 'numpy<2.0'")
|
|
2717
|
+
print(" 3. Recreate the session from original data files")
|
|
2718
|
+
else:
|
|
2719
|
+
print(f"\nERROR: Module import error when loading: {filename}")
|
|
2720
|
+
print(f"Error: {e}")
|
|
2721
|
+
print("This usually indicates a package version mismatch.")
|
|
2722
|
+
print("Try installing matching package versions or recreate the session.")
|
|
2723
|
+
return None
|
|
2529
2724
|
except Exception as e:
|
|
2530
2725
|
print(f"Failed to load session: {e}")
|
|
2531
2726
|
return None
|
|
2532
2727
|
if not isinstance(sess, dict) or sess.get('kind') != 'cpc':
|
|
2533
2728
|
print("Not a CPC session file.")
|
|
2534
2729
|
return None
|
|
2730
|
+
|
|
2731
|
+
# Check package version compatibility
|
|
2732
|
+
saved_versions = sess.get('package_versions', {})
|
|
2733
|
+
current_versions = _get_package_versions()
|
|
2734
|
+
if not _check_package_compatibility(saved_versions, current_versions, filename):
|
|
2735
|
+
return None
|
|
2535
2736
|
try:
|
|
2536
2737
|
# Use standard DPI of 100 instead of saved DPI to avoid display-dependent issues
|
|
2537
2738
|
# (Retina displays, Windows scaling, etc. can cause saved DPI to differ)
|
|
@@ -2828,6 +3029,23 @@ def load_cpc_session(filename: str):
|
|
|
2828
3029
|
ax2.yaxis.set_minor_locator(AutoMinorLocator())
|
|
2829
3030
|
ax2.yaxis.set_minor_formatter(NullFormatter())
|
|
2830
3031
|
ax2.tick_params(axis='y', which='minor', right=True)
|
|
3032
|
+
# Store tick_state on axes for interactive menu
|
|
3033
|
+
tick_state = {}
|
|
3034
|
+
for side_key, prefix in [('top', 't'), ('bottom', 'b'), ('left', 'l'), ('right', 'r')]:
|
|
3035
|
+
s = wasd_state.get(side_key, {})
|
|
3036
|
+
tick_state[f'{prefix}_ticks'] = bool(s.get('ticks', side_key in ('bottom', 'left')))
|
|
3037
|
+
tick_state[f'{prefix}_labels'] = bool(s.get('labels', side_key in ('bottom', 'left')))
|
|
3038
|
+
tick_state[f'm{prefix}x' if prefix in 'tb' else f'm{prefix}y'] = bool(s.get('minor', False))
|
|
3039
|
+
# Legacy keys
|
|
3040
|
+
tick_state['bx'] = tick_state.get('b_ticks', True)
|
|
3041
|
+
tick_state['tx'] = tick_state.get('t_ticks', False)
|
|
3042
|
+
tick_state['ly'] = tick_state.get('l_ticks', True)
|
|
3043
|
+
tick_state['ry'] = tick_state.get('r_ticks', True) # CPC has right axis
|
|
3044
|
+
tick_state['mbx'] = tick_state.get('mbx', False)
|
|
3045
|
+
tick_state['mtx'] = tick_state.get('mtx', False)
|
|
3046
|
+
tick_state['mly'] = tick_state.get('mly', False)
|
|
3047
|
+
tick_state['mry'] = tick_state.get('mry', False)
|
|
3048
|
+
ax._saved_tick_state = tick_state
|
|
2831
3049
|
except Exception:
|
|
2832
3050
|
pass
|
|
2833
3051
|
|
batplot/style.py
CHANGED
|
@@ -358,6 +358,13 @@ def print_style_info(
|
|
|
358
358
|
print(f"Font family chain (rcParams['font.sans-serif']): {plt.rcParams.get('font.sans-serif')}")
|
|
359
359
|
print(f"Mathtext fontset: {plt.rcParams.get('mathtext.fontset')}")
|
|
360
360
|
|
|
361
|
+
# Report whether data axes were swapped via --ro when this figure was created
|
|
362
|
+
try:
|
|
363
|
+
ro_active = bool(getattr(fig, "_ro_active", False))
|
|
364
|
+
except Exception:
|
|
365
|
+
ro_active = False
|
|
366
|
+
print(f"Data axes swapped via --ro: {'YES' if ro_active else 'no'}")
|
|
367
|
+
|
|
361
368
|
# Rotation angle
|
|
362
369
|
rotation_angle = getattr(ax, '_rotation_angle', 0)
|
|
363
370
|
if rotation_angle != 0:
|
|
@@ -646,6 +653,8 @@ def export_style_config(
|
|
|
646
653
|
}
|
|
647
654
|
# Save rotation angle
|
|
648
655
|
cfg["rotation_angle"] = getattr(ax, '_rotation_angle', 0)
|
|
656
|
+
# Track whether data axes were swapped via --ro when this style was saved
|
|
657
|
+
cfg["ro_active"] = bool(getattr(fig, '_ro_active', False))
|
|
649
658
|
|
|
650
659
|
# Save curve names visibility
|
|
651
660
|
cfg["curve_names_visible"] = True # Default to visible
|
|
@@ -853,6 +862,17 @@ def apply_style_config(
|
|
|
853
862
|
except Exception as e:
|
|
854
863
|
print(f"Could not read config: {e}")
|
|
855
864
|
return
|
|
865
|
+
# Enforce compatibility between style/geometry ro state and current figure ro state.
|
|
866
|
+
# Styles saved from a plot using --ro (swapped x/y) must not be applied to a non-ro plot, and vice versa.
|
|
867
|
+
file_ro = bool(cfg.get("ro_active", False))
|
|
868
|
+
current_ro = bool(getattr(fig, "_ro_active", False))
|
|
869
|
+
if file_ro != current_ro:
|
|
870
|
+
if file_ro:
|
|
871
|
+
print("Warning: Style/geometry file was saved with --ro (swapped x/y axes); current plot is not using --ro.")
|
|
872
|
+
else:
|
|
873
|
+
print("Warning: Style/geometry file was saved without --ro; current plot was created with --ro.")
|
|
874
|
+
print("Not applying style/geometry to avoid corrupting axis orientation.")
|
|
875
|
+
return
|
|
856
876
|
# Save current labelpad values BEFORE any style changes
|
|
857
877
|
saved_xlabelpad = None
|
|
858
878
|
saved_ylabelpad = None
|
|
@@ -878,8 +898,7 @@ def apply_style_config(
|
|
|
878
898
|
if not keep_canvas_fixed:
|
|
879
899
|
# Use forward=False to prevent automatic subplot adjustment that can shift the plot
|
|
880
900
|
fig.set_size_inches(fw, fh, forward=False)
|
|
881
|
-
|
|
882
|
-
print("(Canvas fixed) Ignoring style figure size request.")
|
|
901
|
+
# No message needed when canvas is fixed - this is normal behavior
|
|
883
902
|
except Exception as e:
|
|
884
903
|
print(f"Warning: could not parse figure size: {e}")
|
|
885
904
|
try:
|
batplot/version_check.py
CHANGED
|
@@ -210,7 +210,7 @@ def _print_update_message(current: str, latest: str) -> None:
|
|
|
210
210
|
"""
|
|
211
211
|
# Calculate box width (minimum 68, expand if needed for longer messages)
|
|
212
212
|
box_width = 68
|
|
213
|
-
custom_msg = UPDATE_INFO.get('
|
|
213
|
+
custom_msg = UPDATE_INFO.get('Fixed some bugs')
|
|
214
214
|
update_notes = UPDATE_INFO.get('update_notes')
|
|
215
215
|
show_notes = UPDATE_INFO.get('show_update_notes', True)
|
|
216
216
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: batplot
|
|
3
|
-
Version: 1.8.
|
|
3
|
+
Version: 1.8.3
|
|
4
4
|
Summary: Interactive plotting tool for material science (1D plot) and electrochemistry (GC, CV, dQ/dV, CPC, operando) with batch processing
|
|
5
5
|
Author-email: Tian Dai <tianda@uio.no>
|
|
6
6
|
License: MIT License
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
batplot/__init__.py,sha256=RAScNSaXpWIGw1hbfjWc2RDcKAf-ftvoSfY-3DOZTF0,118
|
|
2
|
+
batplot/args.py,sha256=mrDjMURp_OQnXrAwl9WnE_FW4HJu940O7NmL9QWQnD4,35189
|
|
3
|
+
batplot/batch.py,sha256=P2HNBYqrSzDr2fruYz8BFKwNFX6vdJpHDZpaG_hmEc8,55253
|
|
4
|
+
batplot/batplot.py,sha256=Yd6wyMTRgu65BY9ousd_3Zxoauce99vYqzeSgqhxv8U,177164
|
|
5
|
+
batplot/cif.py,sha256=JfHwNf3SHrcpALc_F5NjJmQ3lg71MBRSaIUJjGYPTx8,30120
|
|
6
|
+
batplot/cli.py,sha256=ScDb2je8VQ0mz_z0SLCHEigiTuFPY5pb1snnzCouKms,5828
|
|
7
|
+
batplot/color_utils.py,sha256=7InQLVo1XTg7sgAbltM2KeDSFJgr787YEaV9vJbIoWY,20460
|
|
8
|
+
batplot/config.py,sha256=6nGY7fKN4T5KZUGQS2ArUBgEkLAL0j37XwG5SCVQgKA,6420
|
|
9
|
+
batplot/converters.py,sha256=rR2WMPM0nR5E3eZI3gWbaJf_AfbdQx3urVSbJmZXNzo,8237
|
|
10
|
+
batplot/cpc_interactive.py,sha256=qadWV2PaQMsqM16mSp5r1-WP7di0JCnzNI4RJy27alo,239616
|
|
11
|
+
batplot/electrochem_interactive.py,sha256=8mFr5vtWb_ZDiJmZWXjkARq21D2GflT8-J2xvCGvDIc,222769
|
|
12
|
+
batplot/interactive.py,sha256=5u2ulhTzRr7fA-INc5hfcz7xaHObnnigiXjrgdtE7XE,206728
|
|
13
|
+
batplot/manual.py,sha256=pbRI6G4Pm12pOW8LrOLWWu7IEOtqWN3tRHtgge50LlA,11556
|
|
14
|
+
batplot/modes.py,sha256=qE2OsOQQKhwOWene5zxJeuuewTrZxubtahQuz5je7ok,37252
|
|
15
|
+
batplot/operando.py,sha256=p2Ug1mFUQxaU702cTBGgJKb3_v1C2p3LLUwfXaVBpPY,28311
|
|
16
|
+
batplot/operando_ec_interactive.py,sha256=8GQ47-I8SLTS88sFEk8m3vDxFEjSfD3hao62Qke7SxA,305137
|
|
17
|
+
batplot/plotting.py,sha256=hG2_EdDhF1Qpn1XfZKdCQ5-w_m9gUYFbr804UQ5QjsU,10841
|
|
18
|
+
batplot/readers.py,sha256=kAI0AvYrdfGRZkvADJ4riN96IWtrH24aAoZpBtONTbw,112960
|
|
19
|
+
batplot/session.py,sha256=5eZLJHE66wtZPwNsnR1I2iyEvxY3cLTl3aY7HNxpX6U,145772
|
|
20
|
+
batplot/style.py,sha256=jXtFaJR1aa6vIHupmDNqY2NY5Rgtw49UxF7cS4y8fCA,63375
|
|
21
|
+
batplot/ui.py,sha256=ifpbK74juUzLMCt-sJGVaWtpDb1NMRJzs2YyiwwafzY,35302
|
|
22
|
+
batplot/utils.py,sha256=LY2-Axr3DsQMTxuXe48vSjrLJKEnkzkZjdSFdQizbpg,37599
|
|
23
|
+
batplot/version_check.py,sha256=--U_74DKgHbGtVdBsg9DfUJ10S5-OMXT-rzaYjK0JBc,9997
|
|
24
|
+
batplot/data/USER_MANUAL.md,sha256=VYPvNZt3Fy8Z4Izr2FnQBw9vEaFTPkybhHDnF-OuKws,17694
|
|
25
|
+
batplot-1.8.3.dist-info/licenses/LICENSE,sha256=2PAnHeCiTfgI7aKZLWr0G56HI9fGKQ0CEbQ02H-yExQ,1065
|
|
26
|
+
batplot_backup_20251121_223043/__init__.py,sha256=3s2DUQuTbWs65hoN9cQQ8IiJbaFJY8fNxiCpwRBYoOA,118
|
|
27
|
+
batplot_backup_20251121_223043/args.py,sha256=OH-h84QhN-IhMS8sPAsSEqccHD3wpeMgmXa_fqv5xtg,21215
|
|
28
|
+
batplot_backup_20251121_223043/batch.py,sha256=oI7PONJyciHDOqNPq-8fnOQMyn9CpAdVznKaEdsy0ig,48650
|
|
29
|
+
batplot_backup_20251121_223043/batplot.py,sha256=cJOqfqEWd3vW4prlt0i2Ih6BqopnjFiRP_fAxCMHcds,157883
|
|
30
|
+
batplot_backup_20251121_223043/cif.py,sha256=MeMHq7GvFwrFwpASD4XkqbHVBiBrJxmG112IPThfbZo,17564
|
|
31
|
+
batplot_backup_20251121_223043/cli.py,sha256=lq-0MSCHouGm1qXMYFlI2YMwAMZZSPQxhfMrR8-vdTM,2622
|
|
32
|
+
batplot_backup_20251121_223043/color_utils.py,sha256=jQzsR1Q2cfn7luIdK5aMW4BZhIKb5Q_Q9NfmiUk0AwA,8467
|
|
33
|
+
batplot_backup_20251121_223043/config.py,sha256=MKtmMiQrY9WmghEpcdyBwpiT-Xl3SwLVZTt0DhuB7Yc,1939
|
|
34
|
+
batplot_backup_20251121_223043/converters.py,sha256=O7zvCNTztrXXSxJtm2GZkseYt4agidA6URSCugh953I,3090
|
|
35
|
+
batplot_backup_20251121_223043/cpc_interactive.py,sha256=Z8Sil20F8ibhZUFm1s2oKWGr_tDFwbPBCvEzfb3xADQ,157886
|
|
36
|
+
batplot_backup_20251121_223043/electrochem_interactive.py,sha256=FxFuq7945tIZJWWxdXkh8ZGzyCV5u8khVIr9bFCtKTw,173915
|
|
37
|
+
batplot_backup_20251121_223043/interactive.py,sha256=dAntE1WkAC2pf50wK-jOLmO-t3BOt9NgtgrFmyM_0ac,181928
|
|
38
|
+
batplot_backup_20251121_223043/modes.py,sha256=s4eUHfbl-uORt9kR7Rl56xvirMkPXSsU_dVVv8PrOSE,24698
|
|
39
|
+
batplot_backup_20251121_223043/operando.py,sha256=SABx1BQguoXXsG5PFAbp_CMvAz9vDA3JKRa4lcKGCm0,22980
|
|
40
|
+
batplot_backup_20251121_223043/operando_ec_interactive.py,sha256=k9_r70OKqclJQUOT3c_W2DxXfkF9qVRCcUxo-QuTwsI,261415
|
|
41
|
+
batplot_backup_20251121_223043/plotting.py,sha256=fwzcdKQcHZDamtJj33zfs--Kwc81KoMhn91EQ8Vkeq8,4157
|
|
42
|
+
batplot_backup_20251121_223043/readers.py,sha256=O1CbGE5sedFn1TvCAvIB39Y6zCqcBt3ehvIkf0b6rYw,78339
|
|
43
|
+
batplot_backup_20251121_223043/session.py,sha256=CzzDZw_7rb8r2seVZZbP6dLoDl8nhhViKgB-qaT5-5s,111705
|
|
44
|
+
batplot_backup_20251121_223043/style.py,sha256=xg-tj6bEbFUVjjxYMokiLehS4tSfKanLIQKtly3cAP0,51318
|
|
45
|
+
batplot_backup_20251121_223043/ui.py,sha256=K0XZWyiuBRNkFod9mgZyJ9CLN78GR1-hh6EznnIb5S8,31208
|
|
46
|
+
batplot_backup_20251121_223043/utils.py,sha256=jydA0JxsCWWAudXEwSjlxTG17y2F8U6hIAukAzi1P0g,32526
|
|
47
|
+
batplot_backup_20251121_223043/version_check.py,sha256=vlHkGkgUJcD_Z4KZmwonxZvKZh0MwHLaBSxaLPc66AQ,4555
|
|
48
|
+
batplot_backup_20251221_101150/__init__.py,sha256=AjJgj7OxrIM-uNCR6JvGnRjpVNZgCUbmj0VE_BpFFF8,118
|
|
49
|
+
batplot_backup_20251221_101150/args.py,sha256=mrDjMURp_OQnXrAwl9WnE_FW4HJu940O7NmL9QWQnD4,35189
|
|
50
|
+
batplot_backup_20251221_101150/batch.py,sha256=YQ7obCIqLCObwDbM7TXpOBh7g7BO95wZNsa2Fy84c6o,53858
|
|
51
|
+
batplot_backup_20251221_101150/batplot.py,sha256=40lU1nY1NqeAOpzNG_vLF_L34COKhiA19pMpbvA3SJc,171885
|
|
52
|
+
batplot_backup_20251221_101150/cif.py,sha256=JfHwNf3SHrcpALc_F5NjJmQ3lg71MBRSaIUJjGYPTx8,30120
|
|
53
|
+
batplot_backup_20251221_101150/cli.py,sha256=ScDb2je8VQ0mz_z0SLCHEigiTuFPY5pb1snnzCouKms,5828
|
|
54
|
+
batplot_backup_20251221_101150/color_utils.py,sha256=7InQLVo1XTg7sgAbltM2KeDSFJgr787YEaV9vJbIoWY,20460
|
|
55
|
+
batplot_backup_20251221_101150/config.py,sha256=6nGY7fKN4T5KZUGQS2ArUBgEkLAL0j37XwG5SCVQgKA,6420
|
|
56
|
+
batplot_backup_20251221_101150/converters.py,sha256=rR2WMPM0nR5E3eZI3gWbaJf_AfbdQx3urVSbJmZXNzo,8237
|
|
57
|
+
batplot_backup_20251221_101150/cpc_interactive.py,sha256=HrrjaB8-CNYUitgl5zWMNvWQLZfxyFAtpSm67qoi-nE,238235
|
|
58
|
+
batplot_backup_20251221_101150/electrochem_interactive.py,sha256=ti7V8BoAxUk4BD_vDRKAu5ydlHMl75htLvdVYFUUVsw,221778
|
|
59
|
+
batplot_backup_20251221_101150/interactive.py,sha256=uerVR-56g2Ur8qDZ-cXffPbpYMQXEXiMNXCxyWZZ8k0,206259
|
|
60
|
+
batplot_backup_20251221_101150/manual.py,sha256=pbRI6G4Pm12pOW8LrOLWWu7IEOtqWN3tRHtgge50LlA,11556
|
|
61
|
+
batplot_backup_20251221_101150/modes.py,sha256=Utfal5IaV8rfoNyNFziUZpqRlpZAWJdiTc45DY-FJE8,37300
|
|
62
|
+
batplot_backup_20251221_101150/operando.py,sha256=p2Ug1mFUQxaU702cTBGgJKb3_v1C2p3LLUwfXaVBpPY,28311
|
|
63
|
+
batplot_backup_20251221_101150/operando_ec_interactive.py,sha256=TMB6rDpeolX0CgE2V7tWC24ffJrnbJomQSnTsTd8CNQ,305121
|
|
64
|
+
batplot_backup_20251221_101150/plotting.py,sha256=hG2_EdDhF1Qpn1XfZKdCQ5-w_m9gUYFbr804UQ5QjsU,10841
|
|
65
|
+
batplot_backup_20251221_101150/readers.py,sha256=kAI0AvYrdfGRZkvADJ4riN96IWtrH24aAoZpBtONTbw,112960
|
|
66
|
+
batplot_backup_20251221_101150/session.py,sha256=05JsVi0ygMzOxVRRZ4klhE5Eh6eE6QxKR8p7_j6slBI,134429
|
|
67
|
+
batplot_backup_20251221_101150/style.py,sha256=ig1ozX4dhEsXf5JKaPZOvgVS3CWx-BTFSc3vfAH3Y-E,62274
|
|
68
|
+
batplot_backup_20251221_101150/ui.py,sha256=ifpbK74juUzLMCt-sJGVaWtpDb1NMRJzs2YyiwwafzY,35302
|
|
69
|
+
batplot_backup_20251221_101150/utils.py,sha256=LY2-Axr3DsQMTxuXe48vSjrLJKEnkzkZjdSFdQizbpg,37599
|
|
70
|
+
batplot_backup_20251221_101150/version_check.py,sha256=ztTHwqgWd8OlS9PLLY5A_TabWxBASDA_-5yyN15PZC8,9996
|
|
71
|
+
batplot-1.8.3.dist-info/METADATA,sha256=BNWy96koh0Pcj9CDJYuJ6Xp44krYa8Wg9SM1T4qhYhA,7406
|
|
72
|
+
batplot-1.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
73
|
+
batplot-1.8.3.dist-info/entry_points.txt,sha256=73GgH3Zs-qGIvgiyQLgGsSW-ryOwPPKHveOW6TDIR5Q,82
|
|
74
|
+
batplot-1.8.3.dist-info/top_level.txt,sha256=Z5Q4sAiT_FDqZqhlLsYn9avRTuFAEEf3AVfkswxOb18,70
|
|
75
|
+
batplot-1.8.3.dist-info/RECORD,,
|