Example#
- class Example(
- name: str,
- function: Callable[..., _DatasetT_co],
- paths: tuple[str, ...],
- file_sizes: tuple[int, ...],
- source_urls: tuple[str, ...],
A single example dataset: its files, where they come from, and how to read it.
Added in version 0.49.
Call
get_example()to get an example; this class is not meant to be constructed directly. Every sequence-valued field is a tuple with one entry per path, in the same order, including for single-file examples. The class is generic over the datasetload()returns and the tuplereadersreturns, whichget_example()resolves statically for every example name.
Examples#
Download Python source code | Download Jupyter notebook
Look up an example. This resolves its files but does not read them.
>>> from pyvista import examples
>>> frog = examples.get_example('frog')
>>> frog.name
'frog'
It is stored as two files, but only one of them is read.
Sizes are in bytes, one per path, so examples compare directly.
>>> bunny = examples.get_example('bunny')
>>> sum(frog.file_sizes) > sum(bunny.file_sizes)
True
Read the dataset itself.
>>> mesh = frog.load()
>>> mesh.n_cells
31594185
Attributes#
Return a reader for each file which has one. |
|
Name of the example, such as |
|
Public function which returns this example's dataset, such as |
|
Local path of every file or folder belonging to the example, in declaration order. |
|
Size in bytes of each entry in |
|
URL of each file which is downloaded, empty for an example which ships with PyVista. |
Methods#
Read the example and return its dataset. |