anyplotlib 0.4.1__py3-none-any.whl → 0.4.2__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.
@@ -568,13 +568,17 @@ class Plot2D(_BasePlot, _PanelMixin, _MarkerMixin):
568
568
  self._state["base_width"] = int(ow)
569
569
  self._state["base_height"] = int(oh)
570
570
  self._overview_stale = False
571
- _TLOG.debug(
572
- "[TILEDBG] overview refresh: overview=%s u8[min=%d max=%d] "
573
- "display=(%s,%s) base_wh=(%d,%d) image_wh=(%s,%s)", (oh, ow),
574
- int(img_u8.min()), int(img_u8.max()),
575
- self._state.get("display_min"), self._state.get("display_max"),
576
- ow, oh, self._state.get("image_width"),
577
- self._state.get("image_height"))
571
+ # min/max are two more full passes over the overview — same guard rule
572
+ # as the FETCH diagnostic below (they are .debug() ARGUMENTS, so lazy
573
+ # formatting does not skip them).
574
+ if _TLOG.isEnabledFor(logging.DEBUG):
575
+ _TLOG.debug(
576
+ "[TILEDBG] overview refresh: overview=%s u8[min=%d max=%d] "
577
+ "display=(%s,%s) base_wh=(%d,%d) image_wh=(%s,%s)", (oh, ow),
578
+ int(img_u8.min()), int(img_u8.max()),
579
+ self._state.get("display_min"), self._state.get("display_max"),
580
+ ow, oh, self._state.get("image_width"),
581
+ self._state.get("image_height"))
578
582
  except Exception as e:
579
583
  _TLOG.warning("[TILEDBG] overview refresh FAILED: %s", e)
580
584
 
@@ -648,28 +652,47 @@ class Plot2D(_BasePlot, _PanelMixin, _MarkerMixin):
648
652
  else:
649
653
  out_h, out_w = dh, max(1, int(round(dh * aspect)))
650
654
  b = self._tile_backend
651
- # DIAGNOSTIC: the raw native region straight from the backend, BEFORE
652
- # sampling — its shape + distinct-value count tells us whether the backend
653
- # actually holds native pixels. If region is 82×82 but the raw crop has
654
- # only ~100 distinct values, the backend source is a downsample (bug).
655
- _raw = np.asarray(b._a[y0:y1, x0:x1]) if hasattr(b, "_a") else None
656
655
  tile = self._tile_backend.sample(
657
656
  x0, x1, y0, y1, out_w, out_h, self._integration_method)
658
657
  if b.origin == "lower":
659
658
  tile = np.flipud(tile)
660
659
  self.set_detail(np.ascontiguousarray(tile), x0, x1, y0, y1)
661
- _bshape = b.full_shape if hasattr(b, "full_shape") else "?"
662
- _rawinfo = ("raw_crop=%s distinct=%d" % (
663
- _raw.shape, int(np.unique(_raw).size))) if _raw is not None else "raw=?"
664
- _tileinfo = "tile_distinct=%d" % int(np.unique(np.asarray(tile)).size)
660
+ # The FETCH diagnostic sorts the raw native crop and the tile
661
+ # (np.unique) — 259 ms on a 4096² frame at the zoom where VIEW_OVERFETCH
662
+ # makes the crop the whole image. Those were arguments to a .debug()
663
+ # call, so lazy %-formatting did NOT save them: every pan paid for them
664
+ # at any log level. Guard the whole block, never inline it again.
665
+ if _TLOG.isEnabledFor(logging.DEBUG):
666
+ self._log_fetch_diagnostic(
667
+ b, tile, zoom, x0, x1, y0, y1, rw, rh, out_w, out_h)
668
+ except Exception as e:
669
+ _TLOG.warning("[TILEDBG] view_changed tile update FAILED: %s", e)
670
+
671
+ def _log_fetch_diagnostic(self, b, tile, zoom, x0, x1, y0, y1, rw, rh,
672
+ out_w, out_h) -> None:
673
+ """The expensive [TILEDBG] FETCH line — only ever call this behind an
674
+ ``isEnabledFor(DEBUG)`` guard.
675
+
676
+ The distinct-value counts are the point of it: if the requested region is
677
+ 82×82 but the backend's raw crop has only ~100 distinct values, the backend
678
+ source is a downsample rather than native pixels (a real bug this caught).
679
+ Both counts are full sorts of up to 16 M pixels, hence the guard."""
680
+ try:
681
+ raw = np.asarray(b._a[y0:y1, x0:x1]) if hasattr(b, "_a") else None
682
+ rawinfo = ("raw_crop=%s distinct=%d"
683
+ % (raw.shape, int(np.unique(raw).size))
684
+ ) if raw is not None else "raw=?"
685
+ arr = np.asarray(tile)
665
686
  _TLOG.debug(
666
687
  "[TILEDBG] view_changed FETCH zoom=%.2f region=[x %d:%d y %d:%d] "
667
- "(%dx%d logical) BACKEND_shape=%s %s → tile=%dx%d %s "
668
- "u8[min=%d max=%d]",
669
- zoom, x0, x1, y0, y1, rw, rh, _bshape, _rawinfo, out_w, out_h,
670
- _tileinfo, int(np.asarray(tile).min()), int(np.asarray(tile).max()))
688
+ "(%dx%d logical) BACKEND_shape=%s %s → tile=%dx%d "
689
+ "tile_distinct=%d u8[min=%d max=%d]",
690
+ zoom, x0, x1, y0, y1, rw, rh,
691
+ b.full_shape if hasattr(b, "full_shape") else "?", rawinfo,
692
+ out_w, out_h, int(np.unique(arr).size),
693
+ int(arr.min()), int(arr.max()))
671
694
  except Exception as e:
672
- _TLOG.warning("[TILEDBG] view_changed tile update FAILED: %s", e)
695
+ _TLOG.debug("[TILEDBG] FETCH diagnostic failed: %s", e)
673
696
 
674
697
  @staticmethod
675
698
  def _encode_bytes(arr: np.ndarray) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: anyplotlib
3
- Version: 0.4.1
3
+ Version: 0.4.2
4
4
  Summary: A plotting library using python, javascript and anywidget for performant in browser plotting.
5
5
  Project-URL: Homepage, https://cssfrancis.github.io/anyplotlib/
6
6
  Project-URL: Repository, https://github.com/CSSFrancis/anyplotlib
@@ -20,7 +20,7 @@ anyplotlib/plot1d/_plot1d.py,sha256=TX3z4SUZpIIL5A63n66S_tbK5K5pdRM1u96BVM1yhWM,
20
20
  anyplotlib/plot1d/_plotbar.py,sha256=2hbj3I86TJr5Zds4a179iNQ9CyQTG8ys9MqY8xBTX_Y,17356
21
21
  anyplotlib/plot2d/__init__.py,sha256=_BVLJeGKuTmlZPpfPW2d99qRamBvOSyx3hsru7ylTzk,264
22
22
  anyplotlib/plot2d/_layer.py,sha256=gONf5R2bYsf_Oymx3Y0RmPrTvFDzVnbDGBKFWkhyAKM,5598
23
- anyplotlib/plot2d/_plot2d.py,sha256=7MPlEDM3vDW9KqJWV42t2jvkklZ0YgxzQlQ-UthsbWk,103923
23
+ anyplotlib/plot2d/_plot2d.py,sha256=8Bmq19LijnEcK1q9UzrrGudA_WM0ebMnKZ0SXM6I3i4,105116
24
24
  anyplotlib/plot2d/_plotmesh.py,sha256=qXOsiQQ13yhPar5KToAIz02sqivdKz3eXcHI7QZsv04,4547
25
25
  anyplotlib/plot2d/_tile_backend.py,sha256=BfJ0X-AbWJvImeNcBW9PzkO3b-JQ_CDBP3vOfdNocOw,7225
26
26
  anyplotlib/plot3d/__init__.py,sha256=m851XQKGzx5bywIbBK0qntBxzJU7zwxqf6xnOQ8pD1M,138
@@ -39,7 +39,7 @@ anyplotlib/widgets/_base.py,sha256=oWaUFTAmDp1727MGDjK6XUDHxrW5nOhYtrpwXfh5za4,7
39
39
  anyplotlib/widgets/_widgets1d.py,sha256=cPsjVskb8smL1vwl3RewhlWRznn3O5NctdKIPNWN2D4,5069
40
40
  anyplotlib/widgets/_widgets2d.py,sha256=rewdJVS6mbB-zGNHA7xc00pYYAiXd9RkP45odY-7nJ8,8552
41
41
  anyplotlib/widgets/_widgets3d.py,sha256=zRd2q5O2KePxU5raCnvO-LatMlpGQjnDMPhG61d40Ks,1638
42
- anyplotlib-0.4.1.dist-info/METADATA,sha256=X57R9Tne6lpUyYNopxL7sX3clD1XfAUFH020cqZiWmk,7068
43
- anyplotlib-0.4.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
44
- anyplotlib-0.4.1.dist-info/licenses/LICENSE,sha256=NonSXCjWxcYbaMxPnkgFzPpP0bVBTwUDpuDKyKC2uvQ,1071
45
- anyplotlib-0.4.1.dist-info/RECORD,,
42
+ anyplotlib-0.4.2.dist-info/METADATA,sha256=766riwv0AAFJOG_qLU-vBOVsQpM5PV4dE4DfG5fLK5w,7068
43
+ anyplotlib-0.4.2.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
44
+ anyplotlib-0.4.2.dist-info/licenses/LICENSE,sha256=NonSXCjWxcYbaMxPnkgFzPpP0bVBTwUDpuDKyKC2uvQ,1071
45
+ anyplotlib-0.4.2.dist-info/RECORD,,