batplot 1.3.7__tar.gz → 1.3.9__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 (32) hide show
  1. {batplot-1.3.7 → batplot-1.3.9}/PKG-INFO +1 -1
  2. {batplot-1.3.7 → batplot-1.3.9}/batplot/__init__.py +1 -1
  3. {batplot-1.3.7 → batplot-1.3.9}/batplot/cpc_interactive.py +17 -0
  4. {batplot-1.3.7 → batplot-1.3.9}/batplot/electrochem_interactive.py +14 -0
  5. {batplot-1.3.7 → batplot-1.3.9}/batplot/operando.py +4 -3
  6. {batplot-1.3.7 → batplot-1.3.9}/batplot/operando_ec_interactive.py +384 -282
  7. {batplot-1.3.7 → batplot-1.3.9}/batplot/session.py +183 -92
  8. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/PKG-INFO +1 -1
  9. {batplot-1.3.7 → batplot-1.3.9}/pyproject.toml +1 -1
  10. {batplot-1.3.7 → batplot-1.3.9}/LICENSE +0 -0
  11. {batplot-1.3.7 → batplot-1.3.9}/README.md +0 -0
  12. {batplot-1.3.7 → batplot-1.3.9}/batplot/args.py +0 -0
  13. {batplot-1.3.7 → batplot-1.3.9}/batplot/batch.py +0 -0
  14. {batplot-1.3.7 → batplot-1.3.9}/batplot/batplot.py +0 -0
  15. {batplot-1.3.7 → batplot-1.3.9}/batplot/batplot_new.py +0 -0
  16. {batplot-1.3.7 → batplot-1.3.9}/batplot/cif.py +0 -0
  17. {batplot-1.3.7 → batplot-1.3.9}/batplot/cli.py +0 -0
  18. {batplot-1.3.7 → batplot-1.3.9}/batplot/converters.py +0 -0
  19. {batplot-1.3.7 → batplot-1.3.9}/batplot/interactive.py +0 -0
  20. {batplot-1.3.7 → batplot-1.3.9}/batplot/modes.py +0 -0
  21. {batplot-1.3.7 → batplot-1.3.9}/batplot/plotting.py +0 -0
  22. {batplot-1.3.7 → batplot-1.3.9}/batplot/readers.py +0 -0
  23. {batplot-1.3.7 → batplot-1.3.9}/batplot/style.py +0 -0
  24. {batplot-1.3.7 → batplot-1.3.9}/batplot/ui.py +0 -0
  25. {batplot-1.3.7 → batplot-1.3.9}/batplot/utils.py +0 -0
  26. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/SOURCES.txt +0 -0
  27. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/dependency_links.txt +0 -0
  28. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/entry_points.txt +0 -0
  29. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/requires.txt +0 -0
  30. {batplot-1.3.7 → batplot-1.3.9}/batplot.egg-info/top_level.txt +0 -0
  31. {batplot-1.3.7 → batplot-1.3.9}/setup.cfg +0 -0
  32. {batplot-1.3.7 → batplot-1.3.9}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: batplot
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: Interactive plotting for XRD, PDF, and XAS data (.xye, .xy, .qye, .dat, .csv, .gr, .nor, .chik, .chir)
5
5
  Author-email: Tian Dai <tianda@uio.no>
6
6
  License: MIT License
@@ -1,5 +1,5 @@
1
1
  """batplot: Interactive plotting for battery data visualization."""
2
2
 
3
- __version__ = "1.3.7"
3
+ __version__ = "1.3.9"
4
4
 
5
5
  __all__ = ["__version__"]
@@ -296,6 +296,11 @@ def _style_snapshot(fig, ax, ax2, sc_charge, sc_discharge, sc_eff, file_data=Non
296
296
  'right': {'linewidth': ax2.spines.get('right').get_linewidth() if ax2.spines.get('right') else None,
297
297
  'visible': ax2.spines.get('right').get_visible() if ax2.spines.get('right') else None},
298
298
  },
299
+ 'labelpads': {
300
+ 'x': getattr(ax.xaxis, 'labelpad', None),
301
+ 'ly': getattr(ax.yaxis, 'labelpad', None), # left y-axis (capacity)
302
+ 'ry': getattr(ax2.yaxis, 'labelpad', None), # right y-axis (efficiency)
303
+ },
299
304
  'series': {
300
305
  'charge': {
301
306
  'color': _color_of(sc_charge),
@@ -628,6 +633,18 @@ def _apply_style(fig, ax, ax2, sc_charge, sc_discharge, sc_eff, cfg: Dict, file_
628
633
  except Exception: pass
629
634
  except Exception:
630
635
  pass
636
+ # Restore labelpads
637
+ try:
638
+ pads = cfg.get('labelpads', {})
639
+ if pads:
640
+ if pads.get('x') is not None:
641
+ ax.xaxis.labelpad = pads['x']
642
+ if pads.get('ly') is not None:
643
+ ax.yaxis.labelpad = pads['ly']
644
+ if pads.get('ry') is not None:
645
+ ax2.yaxis.labelpad = pads['ry']
646
+ except Exception:
647
+ pass
631
648
  try:
632
649
  fig.canvas.draw_idle()
633
650
  except Exception:
@@ -649,6 +649,10 @@ def electrochem_interactive_menu(fig, ax, cycle_lines: Dict[int, Dict[str, Optio
649
649
  'wasd_state': dict(getattr(fig, '_ec_wasd_state', {})) if hasattr(fig, '_ec_wasd_state') else {},
650
650
  'fig_size': list(fig.get_size_inches()),
651
651
  'rotation_angle': getattr(fig, '_ec_rotation_angle', 0),
652
+ 'labelpads': {
653
+ 'x': getattr(ax.xaxis, 'labelpad', None),
654
+ 'y': getattr(ax.yaxis, 'labelpad', None),
655
+ },
652
656
  'spines': {name: {
653
657
  'lw': (ax.spines.get(name).get_linewidth() if ax.spines.get(name) else None),
654
658
  'visible': (ax.spines.get(name).get_visible() if ax.spines.get(name) else None)
@@ -776,6 +780,16 @@ def electrochem_interactive_menu(fig, ax, cycle_lines: Dict[int, Dict[str, Optio
776
780
  _position_top_xlabel(); _position_right_ylabel()
777
781
  except Exception:
778
782
  pass
783
+ # Restore labelpads (for title positioning)
784
+ try:
785
+ pads = snap.get('labelpads', {})
786
+ if pads:
787
+ if pads.get('x') is not None:
788
+ ax.xaxis.labelpad = pads['x']
789
+ if pads.get('y') is not None:
790
+ ax.yaxis.labelpad = pads['y']
791
+ except Exception:
792
+ pass
779
793
  # Lines (by index)
780
794
  try:
781
795
  if len(ax.lines) == len(snap.get('lines', [])):
@@ -167,8 +167,8 @@ def plot_operando_folder(folder: str, args) -> Tuple[plt.Figure, plt.Axes, Dict[
167
167
  # Use imshow for speed; mask nans
168
168
  Zm = np.ma.masked_invalid(Z)
169
169
  extent = (grid_x.min(), grid_x.max(), 0, Zm.shape[0]-1)
170
- # Top-to-down visual order (scan 0 at top) -> origin='upper'
171
- im = ax.imshow(Zm, aspect='auto', origin='upper', extent=extent, cmap='viridis', interpolation='nearest')
170
+ # Bottom-to-top visual order (scan 0 at bottom) to match EC time progression -> origin='lower'
171
+ im = ax.imshow(Zm, aspect='auto', origin='lower', extent=extent, cmap='viridis', interpolation='nearest')
172
172
  # Place colorbar on the left
173
173
  cbar = fig.colorbar(im, ax=ax, location='left', pad=0.15)
174
174
  cbar.ax.yaxis.set_ticks_position('left')
@@ -259,7 +259,8 @@ def plot_operando_folder(folder: str, args) -> Tuple[plt.Figure, plt.Axes, Dict[
259
259
  # Match interactive default: shrink EC gap and rebalance widths
260
260
  try:
261
261
  # Decrease gap more aggressively with a sensible minimum
262
- ec_gap_in = max(0.02, ec_gap_in * 0.2)
262
+ # Increase the multiplier from 0.2 to 0.35 for more spacing
263
+ ec_gap_in = max(0.05, ec_gap_in * 0.35)
263
264
  # Transfer a fraction of width from EC to operando while keeping total similar
264
265
  combined = (desired_ax_w_in if desired_ax_w_in > 0 else ax_wf * fig_w_in) + ec_w_in
265
266
  ax_w_in_current = desired_ax_w_in if desired_ax_w_in > 0 else (ax_wf * fig_w_in)