Utilities related to data reading, writing, fetching, and generation.
vispy.io.
imread
Read image data from disk
Requires imageio or PIL.
Filename to read.
Format of the file. If None, it will be inferred from the filename.
Image data.
See also
imsave
read_png
write_png
Save image data to disk
Filename to write.
load_crate
Load an image of a crate
256x256x3 crate image.
load_data_file
Get a standard vispy demo data file
The filename on the remote demo-data repository to download, e.g. 'molecular_viewer/micelle.npy'. These correspond to paths on https://github.com/vispy/demo-data/.
demo-data
'molecular_viewer/micelle.npy'
https://github.com/vispy/demo-data/
Directory to use to save the file. By default, the vispy configuration directory is used.
If True, the file will be downloaded even if a local copy exists (and this copy will be overwritten). Can also be a YYYY-MM-DD date to ensure a file is up-to-date (modified date of a file on disk, if present, is checked).
The path to the file on the local system.
load_iris
Load the iris dataset
data[‘data’] : a (150, 4) NumPy array with the iris’ features data[‘group’] : a (150,) NumPy array with the iris’ group
load_spatial_filters
Load spatial-filters kernel
Whether or not the data should be in “packed” representation for use in GLSL code.
16x1024x4 (packed float in rgba) or 16x1024 (unpacked float) 16 interpolation kernel with length 1024 each.
Respective interpolation names, plus “Nearest” which does not require a filter but can still be used
read_mesh
Read mesh data from file.
File name to read. Format will be inferred from the filename. Currently only ‘.obj’ and ‘.obj.gz’ are supported.
Vertices.
Triangle face definitions.
Normals for the mesh.
Texture coordinates.
Read a PNG file to RGB8 or RGBA8
Unlike imread, this requires no external dependencies.
File to read.
write_mesh
Write mesh data to file.
Filename to write. Must end with “.obj” or “.gz”.
Name of the object.
Currently only “obj” is supported.
If the file exists, overwrite it.
Reshape the faces array to (Nf, 3). Set to False if you need to write a mesh with non triangular faces.
Write a PNG file
Unlike imsave, this requires no external dependencies.
File to save to.