vima-spatial 0.2.6__tar.gz → 0.2.7__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 (40) hide show
  1. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/PKG-INFO +1 -1
  2. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/setup.cfg +1 -1
  3. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/_settings.py +37 -9
  4. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima_spatial.egg-info/PKG-INFO +1 -1
  5. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/README.md +0 -0
  6. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/pyproject.toml +0 -0
  7. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/__init__.py +0 -0
  8. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/cc.py +0 -0
  9. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/data/__init__.py +0 -0
  10. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/data/download.py +0 -0
  11. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/data/patchcollection.py +0 -0
  12. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/data/samples.py +0 -0
  13. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/fingerprints.py +0 -0
  14. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/__init__.py +0 -0
  15. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/dimreduce.py +0 -0
  16. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/ingest.py +0 -0
  17. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/nonst.py +0 -0
  18. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/st.py +0 -0
  19. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/ingest/util.py +0 -0
  20. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/__init__.py +0 -0
  21. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/resnet_vae.py +0 -0
  22. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/resnetlight_decoder.py +0 -0
  23. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/resnetlight_encoder.py +0 -0
  24. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/simple_vae.py +0 -0
  25. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/models/vae.py +0 -0
  26. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/patchfeatures.py +0 -0
  27. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/train/__init__.py +0 -0
  28. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/train/logging.py +0 -0
  29. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/train/training.py +0 -0
  30. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/__init__.py +0 -0
  31. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/features.py +0 -0
  32. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/patches.py +0 -0
  33. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/patchexamples.py +0 -0
  34. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/spatial.py +0 -0
  35. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima/vis/umaps.py +0 -0
  36. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima_spatial.egg-info/SOURCES.txt +0 -0
  37. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima_spatial.egg-info/dependency_links.txt +0 -0
  38. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima_spatial.egg-info/requires.txt +0 -0
  39. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/src/vima_spatial.egg-info/top_level.txt +0 -0
  40. {vima_spatial-0.2.6 → vima_spatial-0.2.7}/tests/test_ra_regression.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vima-spatial
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: variational inference-based microniche analysis
5
5
  Home-page: https://github.com/yakirr/vima
6
6
  Author: Yakir Reshef
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = vima-spatial
3
- version = 0.2.6
3
+ version = 0.2.7
4
4
  author = Yakir Reshef
5
5
  author_email = yreshef@broadinstitute.org
6
6
  description = variational inference-based microniche analysis
@@ -98,6 +98,32 @@ _LOGGING_LEVELS = {
98
98
 
99
99
  logger = logging.getLogger("vima")
100
100
 
101
+ # matplotlib backends that render to a file and cannot display anything; a
102
+ # terminal with no display falls back to "agg". Names are matched lowercase.
103
+ # Fallback for the query below, and what matplotlib has reported for years.
104
+ _FILE_ONLY_BACKENDS = {"agg", "cairo", "pdf", "pgf", "ps", "svg", "template"}
105
+
106
+
107
+ def _file_only_backends():
108
+ """Names of the backends that can only write to a file.
109
+
110
+ Asked of matplotlib where it exposes the list (3.9+), so a backend added
111
+ later is picked up, with :data:`_FILE_ONLY_BACKENDS` as the fallback.
112
+
113
+ Deliberately phrased as "which backends are file-only" rather than "which
114
+ are interactive", even though matplotlib offers both: it classifies
115
+ Jupyter's inline backend as *non*-interactive, since it drives no GUI event
116
+ loop -- yet inline plots do appear in front of the user, which is the only
117
+ thing we need to know. ``resolve_backend`` would answer that question, but
118
+ it imports the backend module and raises on unknown names, so we avoid it.
119
+ """
120
+ try:
121
+ from matplotlib.backends.registry import backend_registry, BackendFilter
122
+
123
+ return set(backend_registry.list_builtin(BackendFilter.NON_INTERACTIVE))
124
+ except Exception:
125
+ return _FILE_ONLY_BACKENDS
126
+
101
127
  # ANSI colors: debug messages are grayed out, results are green.
102
128
  _GRAY, _GREEN, _RESET = "\033[90m", "\033[32m", "\033[0m"
103
129
 
@@ -200,19 +226,21 @@ class Settings:
200
226
  def _display_available(self):
201
227
  """Whether the active matplotlib backend can actually show a figure.
202
228
 
203
- ``module://`` backends are the ones supplied by an embedding host --
204
- ``matplotlib_inline`` in Jupyter, ``ipympl`` for widgets -- which draw
205
- the figure into the host rather than into a window; they display fine
206
- but are not in matplotlib's ``interactive_bk`` list, so they need their
207
- own check. Everything else is a display only if matplotlib calls it
208
- interactive; a headless terminal falls back to Agg, which is not.
229
+ A backend is a display unless it is one of the file-only ones (see
230
+ :func:`_file_only_backends`). Deciding it that way around means
231
+ anything unrecognized -- a third-party or future backend, or a
232
+ ``module://`` backend from an embedding host such as Jupyter's
233
+ ``matplotlib_inline`` or ``ipympl`` -- counts as a display, so the
234
+ worst case is plain ``plt.show()``, exactly as before this setting
235
+ existed.
209
236
  """
210
237
  import matplotlib
211
238
 
212
- backend = matplotlib.get_backend()
213
- if backend.startswith("module://"):
239
+ try:
240
+ backend = matplotlib.get_backend()
241
+ except Exception: # backend resolution can fail in odd environments
214
242
  return True
215
- return backend.lower() in {b.lower() for b in matplotlib.rcsetup.interactive_bk}
243
+ return backend.lower() not in _file_only_backends()
216
244
 
217
245
  def _saving_plots(self):
218
246
  """Whether :meth:`show` should save rather than display."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vima-spatial
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: variational inference-based microniche analysis
5
5
  Home-page: https://github.com/yakirr/vima
6
6
  Author: Yakir Reshef
File without changes