Giter Club home page Giter Club logo

ndv's Introduction

ndv

License PyPI Python Version CI codecov

Simple, fast-loading, asynchronous, n-dimensional array viewer for Qt, with minimal dependencies.

import ndv

data = ndv.data.cells3d()
# or ndv.data.nd_sine_wave()
# or *any* arraylike object (see support below)

ndv.imshow(data)

Montage

As an alternative to ndv.imshow(), you can instantiate the ndv.NDViewer (QWidget subclass) directly

from qtpy.QtWidgets import QApplication
from ndv import NDViewer

app = QApplication([])
viewer = NDViewer(data)
viewer.show()
app.exec()

ndv.NDViewer

  • very fast import and load time
  • supports arbitrary number of dimensions, with 2D/3D view canvas, and sliders for all non-visible dims
  • sliders support integer as well as slice (range)-based slicing
  • colormaps provided by cmap
  • supports vispy and pygfx backends
  • supports any numpy-like duck arrays, including (but not limited to):
    • numpy.ndarray
    • cupy.ndarray
    • dask.array.Array
    • jax.Array
    • pyopencl.array.Array
    • sparse.COO
    • tensorstore.TensorStore (supports named dimensions)
    • torch.Tensor (supports named dimensions)
    • xarray.DataArray (supports named dimensions)
    • zarr (supports named dimensions)

See examples for each of these array types in examples

Note

You can add support for any custom storage class by subclassing ndv.DataWrapper and implementing a couple methods.
(This doesn't require modifying ndv, but contributions of new wrappers are welcome!)

Installation

The only required dependencies are numpy and superqt[cmap,iconify]. You will also need a Qt backend (PyQt or PySide) and one of either vispy or pygfx, which can be installed through extras ndv[<pyqt|pyside>,<vispy|pygfx>]:

pip install ndv[pyqt,vispy]

Tip

If you have both vispy and pygfx installed, ndv will default to using vispy, but you can override this with the environment variable NDV_CANVAS_BACKEND=pygfx or NDV_CANVAS_BACKEND=vispy

Motivation

This package arose from the need for a way to quickly view multi-dimensional arrays with zero tolerance for long import times and/or excessive dependency lists. I want something that I can use to view any of the many multi-dimensional array types, out of the box, with no assumptions about dimensionality. I want it to work reasonably well with remote, asynchronously loaded data. I also want it to take advantage of things like named dimensions and categorical coordinate values when available. For now, it's a Qt-only widget, since that's where the need arose, but I can imagine a jupyter widget in the future (likely as a remote frame buffer for vispy/pygfx).

I do not intend for this to grow into full-fledged application, or wrap a complete scene graph, though point and ROI selection would be welcome additions.

ndv's People

Contributors

tlambert03 avatar gselzer avatar hanjinliu avatar dependabot[bot] avatar pre-commit-ci[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.