Debian Codegraph @

pyvista/examples/downloads.py

raw
1 """Downloadable datasets collected from various sources.
2
3 Once downloaded, these datasets are stored locally allowing for the
4 rapid reuse of these datasets.
5
6 Files are all hosted in https://github.com/pyvista/data/ and are downloaded
7 using the ``download_file`` function. If you add a file to the example data
8 repository, you should add a ``download-<dataset>`` method here which will
9 rendered on this page.
10
11 See the :ref:`dataset_gallery` for detailed information about the datasets,
12 including file and dataset metadata.
13
14 Examples
15 --------
16 >>> from pyvista import examples
17 >>> mesh = examples.download_saddle_surface()
18 >>> mesh.plot()
19
20 """
21
22 from __future__ import annotations
23
24 import functools
25 import importlib.util
26 import logging
27 import os
28 from pathlib import Path
29 from pathlib import PureWindowsPath
30 import shutil
31 import sys
32 from typing import TYPE_CHECKING
33 from typing import cast
34
35 import numpy as np
36 import pooch
37
38 import pyvista as pv
39 from pyvista import _vtk
40 from pyvista._deprecate_positional_args import _deprecate_positional_args
41 from pyvista._warn_external import warn_external
42 from pyvista.core.filters import _get_output
43 from pyvista.core.utilities.fileio import get_ext
44 from pyvista.core.utilities.fileio import read
45 from pyvista.core.utilities.fileio import read_texture
46 from pyvista.examples._dataset_loader import _download_dataset
47 from pyvista.examples._dataset_loader import _DownloadableFile
48 from pyvista.examples._dataset_loader import _load_as_cubemap
49 from pyvista.examples._dataset_loader import _load_as_multiblock
50 from pyvista.examples._dataset_loader import _MultiFileDownloadableDatasetLoader
51 from pyvista.examples._dataset_loader import _SingleFileDownloadableDatasetLoader
52
53 if TYPE_CHECKING:
54 from pyvista import ImageData
55 from pyvista import MultiBlock
56 from pyvista import PolyData
57 # disable pooch verbose logging
58 POOCH_LOGGER = pooch.get_logger() # type: ignore[attr-defined]
59 POOCH_LOGGER.setLevel(logging.CRITICAL)
60
61
62 CACHE_VERSION = 3
63
64 _USERDATA_PATH_VARNAME = 'PYVISTA_USERDATA_PATH'
65 _VTK_DATA_VARNAME = 'PYVISTA_VTK_DATA'
66
67 _DEFAULT_USER_DATA_PATH = str(pooch.os_cache(f'pyvista_{CACHE_VERSION}')) # type: ignore[attr-defined]
68 _DEFAULT_VTK_DATA_SOURCE = 'https://github.com/pyvista/data/raw/master/Data/'
69
70
71 def _warn_invalid_dir_not_used(path, env_var):
72 msg = f'The given {env_var} is not a valid directory and will not be used:\n{path.as_posix()}'
73 warn_external(msg)
74
75
76 def _get_vtk_data_source() -> tuple[str, bool]:
77 # If available, a local pyvista/data instance will be used for examples
78 # Set default output
79 source = _DEFAULT_VTK_DATA_SOURCE
80 file_cache = False
81 if _VTK_DATA_VARNAME in os.environ:
82 path = Path(os.environ[_VTK_DATA_VARNAME])
83 if not path.is_dir():
84 _warn_invalid_dir_not_used(path, _VTK_DATA_VARNAME)
85 else:
86 if path.name != 'Data':
87 # append 'Data' if user does not provide it
88 path = path / 'Data'
89
90 # pooch assumes this is a URL so we have to take care of this
91 path_str = path.as_posix()
92 if not path_str.endswith('/'):
93 path_str += '/'
94
95 source = path_str
96 file_cache = True
97 return source, file_cache
98
99
100 def _get_user_data_path() -> str:
101 # Allow user to override the local path
102 # Set default output
103 output_path = _DEFAULT_USER_DATA_PATH
104 if _USERDATA_PATH_VARNAME in os.environ:
105 path = Path(os.environ[_USERDATA_PATH_VARNAME])
106 if not path.is_dir():
107 _warn_invalid_dir_not_used(path, _USERDATA_PATH_VARNAME)
108 else:
109 # Use user-specified path
110 output_path = str(path)
111 return output_path
112
113
114 def _warn_if_path_not_accessible(path: str | Path, msg: str):
115 # Provide helpful message if pooch path is inaccessible
116 try:
117 if not Path(path).is_dir():
118 Path(path).mkdir(exist_ok=True, parents=True)
119 if not os.access(path, os.W_OK): # pragma: no cover
120 raise OSError
121 except (PermissionError, OSError):
122 # Warn, don't raise just in case there's an environment issue.
123 msg = f'Unable to access path: {path}\n{msg}'
124 warn_external(msg)
125
126
127 SOURCE, _FILE_CACHE = _get_vtk_data_source()
128 USER_DATA_PATH = _get_user_data_path()
129
130 _user_data_path_warn_msg = (
131 f'Manually specify the PyVista examples cache with the '
132 f'{_USERDATA_PATH_VARNAME} environment variable.'
133 )
134 _warn_if_path_not_accessible(USER_DATA_PATH, _user_data_path_warn_msg)
135
136 # Note that our fetcher doesn't have a registry (or we have an empty registry)
137 # with hashes because we don't want to have to add in all of them individually
138 # to the registry since we're not (at the moment) concerned about hashes.
139 FETCHER = pooch.create( # type: ignore[attr-defined]
140 path=USER_DATA_PATH,
141 base_url=SOURCE,
142 registry={},
143 retry_if_failed=3,
144 )
145
146
147 def file_from_files(target_path, fnames):
148 """Return the full path of a single file within a list of files.
149
150 Parameters
151 ----------
152 target_path : str
153 Path of the file to match the end of. If you need to match a file
154 relative to the root directory of the archive, start the path with
155 ``"unzip"``. Path must be a posix-like path.
156
157 fnames : list
158 List of filenames.
159
160 Returns
161 -------
162 str
163 Entry in ``fnames`` matching ``filename``.
164
165 """
166 found_fnames = []
167 for fname in fnames:
168 # always convert windows paths
169 posix_fname = PureWindowsPath(fname).as_posix() if os.name == 'nt' else fname
170 # ignore mac hidden directories
171 if '/__MACOSX/' in posix_fname: # pragma: no cover
172 continue
173 if posix_fname.endswith(target_path):
174 found_fnames.append(posix_fname)
175
176 if len(found_fnames) == 1:
177 return found_fnames[0]
178
179 if len(found_fnames) > 1:
180 files_str = '\n'.join(found_fnames)
181 msg = f'Ambiguous "{target_path}". Multiple matches found:\n{files_str}'
182 raise RuntimeError(msg)
183
184 files_str = '\n'.join(fnames)
185 msg = f'Missing "{target_path}" from archive. Archive contains:\n{files_str}'
186 raise FileNotFoundError(msg)
187
188
189 def _file_copier(input_file, output_file, *_, **__):
190 """Copy a file from a local directory to the output path."""
191 if not Path(input_file).is_file():
192 msg = f"'{input_file}' not found within PYVISTA_VTK_DATA '{SOURCE}'"
193 raise FileNotFoundError(msg)
194 shutil.copy(input_file, output_file)
195
196
197 def download_file(filename):
198 """Download a single file from the pyvista/data repository.
199
200 You can add an example file at `pyvista/data
201 <https://github.com/pyvista/data>`_.
202
203 Parameters
204 ----------
205 filename : str
206 Filename relative to the ``Data`` directory.
207
208 Returns
209 -------
210 output : str | list
211 A single path if the file is not an archive. A ``list`` of paths if the
212 file is an archive.
213
214 Examples
215 --------
216 Download the ``'puppy.jpg'`` image.
217
218 >>> from pyvista import examples
219 >>> path = examples.download_file('puppy.jpg') # doctest:+SKIP
220 >>> path # doctest:+SKIP
221 '/home/user/.cache/pyvista_3/puppy.jpg'
222
223 """
224 try: # should the file already exist within fetcher's registry
225 return _download_file(filename)
226 except ValueError: # otherwise simply add the file to the registry
227 FETCHER.registry[filename] = None
228 return _download_file(filename)
229
230
231 def _download_file(filename):
232 """Download a file using pooch."""
233 return FETCHER.fetch(
234 filename,
235 processor=pooch.Unzip() if filename.endswith('.zip') else None, # type: ignore[attr-defined]
236 downloader=_file_copier if _FILE_CACHE else None,
237 )
238
239
240 def _download_archive(filename, target_file=None):
241 """Download an archive.
242
243 Return the path to a single file when set.
244
245 Parameters
246 ----------
247 filename : str
248 Relative path to the archive file. The entire archive will be
249 downloaded and unarchived.
250
251 target_file : str, optional
252 Target file to return within the archive.
253
254 Returns
255 -------
256 output : list | str
257 List of files when ``target_file`` is ``None``. Otherwise, a single path.
258
259 """
260 fnames = download_file(filename)
261 if target_file is not None:
262 return file_from_files(target_file, fnames)
263 return fnames
264
265
266 def _download_archive_file_or_folder(filename, target_file=None):
267 """Download an archive.
268
269 This function is similar to _download_archive, but also allows
270 setting `target_file` as a folder. The target folder path must be
271 fully specified relative to the root path of the archive.
272
273 Set ``target_file=''`` (empty string) to download the entire
274 archive and return the directory path to the entire extracted
275 archive.
276
277 """
278 try:
279 # Return file(s)
280 return _download_archive(filename, target_file=target_file)
281 except (FileNotFoundError, RuntimeError):
282 pass
283 # Return folder, or re-raise error by calling function again
284 folder = str(Path(USER_DATA_PATH) / (filename + '.unzip') / target_file)
285 return (
286 folder if Path(folder).is_dir() else _download_archive(filename, target_file=target_file)
287 )
288
289
290 def delete_downloads():
291 """Delete all downloaded examples to free space or update the files.
292
293 Examples
294 --------
295 Delete all local downloads.
296
297 >>> from pyvista import examples
298 >>> examples.delete_downloads() # doctest:+SKIP
299
300 """
301 if Path(USER_DATA_PATH).is_dir():
302 shutil.rmtree(USER_DATA_PATH)
303 Path(USER_DATA_PATH).mkdir()
304
305
306 def _download_and_read(filename, *, texture=False, file_format=None, load=True):
307 """Download and read a file.
308
309 Parameters
310 ----------
311 filename : str
312 Path to the filename. This cannot be a zip file.
313
314 texture : bool, default: False
315 ``True`` when file being read is a texture.
316
317 file_format : str, optional
318 Override the file format with a different extension.
319
320 load : bool, default: True
321 Read the file. When ``False``, return the path to the
322 file.
323
324 Returns
325 -------
326 output : pyvista.DataSet | str
327 Dataset or path to the file depending on the ``load`` parameter.
328
329 """
330 if get_ext(filename) == '.zip': # pragma: no cover
331 msg = 'Cannot download and read an archive file'
332 raise ValueError(msg)
333
334 saved_file = download_file(filename)
335 if not load:
336 return saved_file
337 if texture:
338 return read_texture(saved_file)
339 return read(saved_file, file_format=file_format)
340
341
342 @_deprecate_positional_args
343 def download_masonry_texture(load=True): # noqa: FBT002
344 """Download masonry texture.
345
346 Parameters
347 ----------
348 load : bool, default: True
349 Load the dataset after downloading it when ``True``. Set this
350 to ``False`` and only the filename will be returned.
351
352 Returns
353 -------
354 output : pyvista.DataSet | str
355 DataSet or filename depending on ``load``.
356
357 Examples
358 --------
359 Create plot the masonry testure on a surface.
360
361 >>> import pyvista as pv
362 >>> from pyvista import examples
363 >>> texture = examples.download_masonry_texture()
364 >>> surf = pv.Cylinder()
365 >>> surf.plot(texture=texture)
366
367 .. seealso::
368
369 :ref:`Masonry Texture Dataset <masonry_texture_dataset>`
370 See this dataset in the Dataset Gallery for more info.
371
372 :ref:`texture_example`
373 Example using this dataset.
374
375 """
376 return _download_dataset(_dataset_masonry_texture, load=load)
377
378
379 _dataset_masonry_texture = _SingleFileDownloadableDatasetLoader(
380 'masonry.bmp',
381 read_func=read_texture,
382 )
383
384
385 @_deprecate_positional_args
386 def download_usa_texture(load=True): # noqa: FBT002
387 """Download USA texture.
388
389 Parameters
390 ----------
391 load : bool, default: True
392 Load the dataset after downloading it when ``True``. Set this
393 to ``False`` and only the filename will be returned.
394
395 Returns
396 -------
397 output : pyvista.DataSet | str
398 DataSet or filename depending on ``load``.
399
400 Examples
401 --------
402 >>> import pyvista as pv
403 >>> from pyvista import examples
404 >>> dataset = examples.download_usa_texture()
405 >>> dataset.plot(cpos='xy')
406
407 .. seealso::
408
409 :ref:`Usa Texture Dataset <usa_texture_dataset>`
410 See this dataset in the Dataset Gallery for more info.
411
412 :ref:`Usa Dataset <usa_dataset>`
413
414 """
415 return _download_dataset(_dataset_usa_texture, load=load)
416
417
418 _dataset_usa_texture = _SingleFileDownloadableDatasetLoader(
419 'usa_image.jpg',
420 read_func=read_texture,
421 )
422
423
424 @_deprecate_positional_args
425 def download_puppy_texture(load=True): # noqa: FBT002
426 """Download puppy texture.
427
428 Parameters
429 ----------
430 load : bool, default: True
431 Load the dataset after downloading it when ``True``. Set this
432 to ``False`` and only the filename will be returned.
433
434 Returns
435 -------
436 output : pyvista.DataSet | str
437 DataSet or filename depending on ``load``.
438
439 Examples
440 --------
441 >>> from pyvista import examples
442 >>> dataset = examples.download_puppy_texture()
443 >>> dataset.plot(cpos='xy')
444
445 .. seealso::
446
447 :ref:`Puppy Texture Dataset <puppy_texture_dataset>`
448 See this dataset in the Dataset Gallery for more info.
449
450 :ref:`Puppy Dataset <puppy_dataset>`
451
452 :ref:`texture_example`
453 Example which uses this dataset.
454
455 """
456 return _download_dataset(_dataset_puppy_texture, load=load)
457
458
459 _dataset_puppy_texture = _SingleFileDownloadableDatasetLoader('puppy.jpg', read_func=read_texture)
460
461
462 @_deprecate_positional_args
463 def download_puppy(load=True): # noqa: FBT002
464 """Download puppy dataset.
465
466 Parameters
467 ----------
468 load : bool, default: True
469 Load the dataset after downloading it when ``True``. Set this
470 to ``False`` and only the filename will be returned.
471
472 Returns
473 -------
474 output : pyvista.ImageData | str
475 DataSet or filename depending on ``load``.
476
477 Examples
478 --------
479 .. pyvista-plot::
480 :force_static:
481
482 >>> from pyvista import examples
483 >>> dataset = examples.download_puppy()
484 >>> dataset.plot(cpos='xy', rgba=True)
485
486 .. seealso::
487
488 :ref:`Puppy Dataset <puppy_dataset>`
489 See this dataset in the Dataset Gallery for more info.
490
491 :ref:`Puppy Texture Dataset <puppy_texture_dataset>`
492
493 :ref:`read_image_example`
494
495 """
496 return _download_dataset(_dataset_puppy, load=load)
497
498
499 _dataset_puppy = _SingleFileDownloadableDatasetLoader('puppy.jpg')
500
501
502 @_deprecate_positional_args
503 def download_usa(load=True): # noqa: FBT002
504 """Download usa dataset.
505
506 Parameters
507 ----------
508 load : bool, default: True
509 Load the dataset after downloading it when ``True``. Set this
510 to ``False`` and only the filename will be returned.
511
512 Returns
513 -------
514 output : pyvista.DataSet | str
515 DataSet or filename depending on ``load``.
516
517 Examples
518 --------
519 >>> from pyvista import examples
520 >>> dataset = examples.download_usa()
521 >>> dataset.plot(style='wireframe', cpos='xy')
522
523 .. seealso::
524
525 :ref:`Usa Dataset <usa_dataset>`
526 See this dataset in the Dataset Gallery for more info.
527
528 :ref:`Usa Texture Dataset <usa_texture_dataset>`
529
530 """
531 return _download_dataset(_dataset_usa, load=load)
532
533
534 _dataset_usa = _SingleFileDownloadableDatasetLoader('usa.vtk')
535
536
537 @_deprecate_positional_args
538 def download_st_helens(load=True): # noqa: FBT002
539 """Download Saint Helens dataset.
540
541 Parameters
542 ----------
543 load : bool, default: True
544 Load the dataset after downloading it when ``True``. Set this
545 to ``False`` and only the filename will be returned.
546
547 Returns
548 -------
549 output : pyvista.ImageData | str
550 DataSet or filename depending on ``load``.
551
552 Examples
553 --------
554 >>> from pyvista import examples
555 >>> dataset = examples.download_st_helens()
556 >>> dataset.plot(cmap='gist_earth')
557
558 .. seealso::
559
560 :ref:`St Helens Dataset <st_helens_dataset>`
561 See this dataset in the Dataset Gallery for more info.
562
563 This dataset is used in the following examples:
564
565 * :ref:`colormap_example`
566 * :ref:`lighting_mesh_example`
567 * :ref:`opacity_example`
568 * :ref:`orbit_example`
569 * :ref:`plot_over_line_example`
570 * :ref:`plotter_lighting_example`
571 * :ref:`themes_example`
572
573 """
574 return _download_dataset(_dataset_st_helens, load=load)
575
576
577 _dataset_st_helens = _SingleFileDownloadableDatasetLoader('SainteHelens.dem')
578
579
580 @_deprecate_positional_args
581 def download_bunny(load=True): # noqa: FBT002
582 """Download bunny dataset.
583
584 The Stanford Bunny from the `Stanford 3D Scanning Repository
585 <http://graphics.stanford.edu/data/3Dscanrep/>`_. Please credit the
586 Stanford Computer Graphics Laboratory (Turk and Levoy, SIGGRAPH '94)
587 when using this model.
588
589 Stanford permits free redistribution for research and mirroring.
590 Inclusion in a product-for-sale requires permission from the Stanford
591 Computer Graphics Laboratory.
592
593 Parameters
594 ----------
595 load : bool, default: True
596 Load the dataset after downloading it when ``True``. Set this
597 to ``False`` and only the filename will be returned.
598
599 Returns
600 -------
601 output : pyvista.PolyData | str
602 DataSet or filename depending on ``load``.
603
604 Examples
605 --------
606 >>> from pyvista import examples
607 >>> dataset = examples.download_bunny()
608 >>> dataset.plot(cpos='xy')
609
610 .. seealso::
611
612 :ref:`Bunny Dataset <bunny_dataset>`
613 See this dataset in the Dataset Gallery for more info.
614
615 :ref:`Bunny Coarse Dataset <bunny_coarse_dataset>`
616
617 This dataset is used in the following examples:
618
619 * :ref:`read_file_example`
620 * :ref:`clip_with_surface_example`
621 * :ref:`extract_edges_example`
622 * :ref:`subdivide_example`
623 * :ref:`silhouette_example`
624 * :ref:`light_types_example`
625
626 """
627 return _download_dataset(_dataset_bunny, load=load)
628
629
630 _dataset_bunny = _SingleFileDownloadableDatasetLoader('bunny.ply')
631
632
633 @_deprecate_positional_args
634 def download_bunny_coarse(load=True): # noqa: FBT002
635 """Download coarse bunny dataset.
636
637 A decimated version of the Stanford Bunny from the `Stanford 3D
638 Scanning Repository <http://graphics.stanford.edu/data/3Dscanrep/>`_.
639 Please credit the Stanford Computer Graphics Laboratory
640 (Turk and Levoy, SIGGRAPH '94) when using this model.
641
642 Stanford permits free redistribution for research and mirroring.
643 Inclusion in a product-for-sale requires permission from the Stanford
644 Computer Graphics Laboratory.
645
646 Parameters
647 ----------
648 load : bool, default: True
649 Load the dataset after downloading it when ``True``. Set this
650 to ``False`` and only the filename will be returned.
651
652 Returns
653 -------
654 output : pyvista.PolyData | str
655 DataSet or filename depending on ``load``.
656
657 Examples
658 --------
659 >>> from pyvista import examples
660 >>> dataset = examples.download_bunny_coarse()
661 >>> dataset.plot(cpos='xy')
662
663 .. seealso::
664
665 :ref:`Bunny Coarse Dataset <bunny_coarse_dataset>`
666 See this dataset in the Dataset Gallery for more info.
667
668 :ref:`Bunny Dataset <bunny_dataset>`
669
670 This dataset is used in the following examples:
671
672 * :ref:`read_file_example`
673 * :ref:`clip_with_surface_example`
674 * :ref:`subdivide_example`
675
676 """
677 return _download_dataset(_dataset_bunny_coarse, load=load)
678
679
680 def _bunny_coarse_load_func(mesh):
681 mesh.verts = np.array([], dtype=np.int32)
682 return mesh
683
684
685 _dataset_bunny_coarse = _SingleFileDownloadableDatasetLoader(
686 'Bunny.vtp',
687 load_func=_bunny_coarse_load_func,
688 )
689
690
691 @_deprecate_positional_args
692 def download_cow(load=True): # noqa: FBT002
693 """Download cow dataset.
694
695 Parameters
696 ----------
697 load : bool, default: True
698 Load the dataset after downloading it when ``True``. Set this
699 to ``False`` and only the filename will be returned.
700
701 Returns
702 -------
703 output : pyvista.PolyData | str
704 DataSet or filename depending on ``load``.
705
706 Examples
707 --------
708 >>> from pyvista import examples
709 >>> dataset = examples.download_cow()
710 >>> dataset.plot(cpos='xy')
711
712 .. seealso::
713
714 :ref:`Cow Dataset <cow_dataset>`
715 See this dataset in the Dataset Gallery for more info.
716
717 :ref:`Cow Head Dataset <cow_head_dataset>`
718
719 This dataset is used in the following examples:
720
721 * :ref:`extract_edges_example`
722 * :ref:`mesh_quality_example`
723 * :ref:`rotate_example`
724 * :ref:`linked_views_example`
725 * :ref:`light_actors_example`
726
727 """
728 return _download_dataset(_dataset_cow, load=load)
729
730
731 _dataset_cow = _SingleFileDownloadableDatasetLoader('cow.vtp')
732
733
734 @_deprecate_positional_args
735 def download_cow_head(load=True): # noqa: FBT002
736 """Download cow head dataset.
737
738 Parameters
739 ----------
740 load : bool, default: True
741 Load the dataset after downloading it when ``True``. Set this
742 to ``False`` and only the filename will be returned.
743
744 Returns
745 -------
746 output : pyvista.PolyData | str
747 DataSet or filename depending on ``load``.
748
749 Examples
750 --------
751 >>> from pyvista import examples
752 >>> dataset = examples.download_cow_head()
753 >>> dataset.plot(cpos='xy')
754
755 .. seealso::
756
757 :ref:`Cow Head Dataset <cow_head_dataset>`
758 See this dataset in the Dataset Gallery for more info.
759
760 :ref:`Cow Dataset <cow_dataset>`
761
762 """
763 return _download_dataset(_dataset_cow_head, load=load)
764
765
766 _dataset_cow_head = _SingleFileDownloadableDatasetLoader('cowHead.vtp')
767
768
769 @_deprecate_positional_args
770 def download_faults(load=True): # noqa: FBT002
771 """Download faults dataset.
772
773 Parameters
774 ----------
775 load : bool, default: True
776 Load the dataset after downloading it when ``True``. Set this
777 to ``False`` and only the filename will be returned.
778
779 Returns
780 -------
781 output : pyvista.PolyData | str
782 DataSet or filename depending on ``load``.
783
784 Examples
785 --------
786 >>> from pyvista import examples
787 >>> dataset = examples.download_faults()
788 >>> dataset.plot(line_width=4)
789
790 .. seealso::
791
792 :ref:`Faults Dataset <faults_dataset>`
793 See this dataset in the Dataset Gallery for more info.
794
795 """
796 return _download_dataset(_dataset_faults, load=load)
797
798
799 _dataset_faults = _SingleFileDownloadableDatasetLoader('faults.vtk')
800
801
802 @_deprecate_positional_args
803 def download_tensors(load=True): # noqa: FBT002
804 """Download tensors dataset.
805
806 Parameters
807 ----------
808 load : bool, default: True
809 Load the dataset after downloading it when ``True``. Set this
810 to ``False`` and only the filename will be returned.
811
812 Returns
813 -------
814 output : pyvista.UnstructuredGrid | str
815 DataSet or filename depending on ``load``.
816
817 Examples
818 --------
819 >>> from pyvista import examples
820 >>> dataset = examples.download_tensors()
821 >>> dataset.plot()
822
823 .. seealso::
824
825 :ref:`Tensors Dataset <tensors_dataset>`
826 See this dataset in the Dataset Gallery for more info.
827
828 """
829 return _download_dataset(_dataset_tensors, load=load)
830
831
832 _dataset_tensors = _SingleFileDownloadableDatasetLoader('tensors.vtk')
833
834
835 @_deprecate_positional_args
836 def download_head(load=True): # noqa: FBT002
837 """Download head dataset.
838
839 Parameters
840 ----------
841 load : bool, default: True
842 Load the dataset after downloading it when ``True``. Set this
843 to ``False`` and only the filename will be returned.
844
845 Returns
846 -------
847 output : pyvista.ImageData | str
848 DataSet or filename depending on ``load``.
849
850 Examples
851 --------
852 >>> import pyvista as pv
853 >>> from pyvista import examples
854 >>> dataset = examples.download_head()
855 >>> pl = pv.Plotter()
856 >>> _ = pl.add_volume(dataset, cmap='cool', opacity='sigmoid_6')
857 >>> pl.camera_position = pv.CameraPosition(
858 ... position=(-228.0, -418.0, -158.0),
859 ... focal_point=(94.0, 122.0, 82.0),
860 ... viewup=(-0.2, -0.3, 0.9),
861 ... )
862 >>> pl.show()
863
864 .. seealso::
865
866 :ref:`Head Dataset <head_dataset>`
867 See this dataset in the Dataset Gallery for more info.
868
869 :ref:`Head 2 Dataset <head_2_dataset>`
870
871 :ref:`medical_dataset_gallery`
872 Browse other medical datasets.
873
874 :ref:`volume_rendering_example`
875 Example using this dataset.
876
877 """
878 return _download_dataset(_dataset_head, load=load)
879
880
881 def _head_files_func():
882 # Multiple files needed for read, but only one gets loaded
883 head_raw = _DownloadableFile('HeadMRVolume.raw')
884 head_mhd = _SingleFileDownloadableDatasetLoader('HeadMRVolume.mhd')
885 return head_mhd, head_raw
886
887
888 _dataset_head = _MultiFileDownloadableDatasetLoader(_head_files_func)
889
890
891 @_deprecate_positional_args
892 def download_head_2(load=True): # noqa: FBT002
893 """Download head dataset.
894
895 Parameters
896 ----------
897 load : bool, default: True
898 Load the dataset after downloading it when ``True``. Set this
899 to ``False`` and only the filename will be returned.
900
901 Returns
902 -------
903 output : pyvista.ImageData | str
904 DataSet or filename depending on ``load``.
905
906 Examples
907 --------
908 >>> import pyvista as pv
909 >>> from pyvista import examples
910 >>> dataset = examples.download_head_2()
911 >>> pl = pv.Plotter()
912 >>> _ = pl.add_volume(dataset, cmap='cool', opacity='sigmoid_6')
913 >>> pl.show()
914
915 .. seealso::
916
917 :ref:`Head 2 Dataset <head_2_dataset>`
918 See this dataset in the Dataset Gallery for more info.
919
920 :ref:`Head Dataset <head_dataset>`
921
922 :ref:`medical_dataset_gallery`
923 Browse other medical datasets.
924
925 """
926 return _download_dataset(_dataset_head_2, load=load)
927
928
929 _dataset_head_2 = _SingleFileDownloadableDatasetLoader('head.vti')
930
931
932 @_deprecate_positional_args
933 def download_bolt_nut(load=True): # noqa: FBT002
934 """Download bolt nut dataset.
935
936 Parameters
937 ----------
938 load : bool, default: True
939 Load the dataset after downloading it when ``True``. Set this
940 to ``False`` and only the filename will be returned.
941
942 Returns
943 -------
944 output : pyvista.MultiBlock or tuple
945 DataSet or tuple of filenames depending on ``load``.
946
947 Examples
948 --------
949 >>> import pyvista as pv
950 >>> from pyvista import examples
951 >>> dataset = examples.download_bolt_nut()
952 >>> pl = pv.Plotter()
953 >>> _ = pl.add_volume(
954 ... dataset,
955 ... cmap='coolwarm',
956 ... opacity='sigmoid_5',
957 ... show_scalar_bar=False,
958 ... )
959 >>> pl.camera_position = pv.CameraPosition(
960 ... position=(194.6, -141.8, 182.0),
961 ... focal_point=(34.5, 61.0, 32.5),
962 ... viewup=(-0.229, 0.45, 0.86),
963 ... )
964 >>> pl.show()
965
966 .. seealso::
967
968 :ref:`Bolt Nut Dataset <bolt_nut_dataset>`
969 See this dataset in the Dataset Gallery for more info.
970
971 :ref:`volume_rendering_example`
972 Example which uses this dataset.
973
974 """
975 return _download_dataset(_dataset_bolt_nut, load=load)
976
977
978 def _bolt_nut_files_func():
979 # Multiple mesh files are loaded for this example
980 bolt = _SingleFileDownloadableDatasetLoader('bolt.slc')
981 nut = _SingleFileDownloadableDatasetLoader('nut.slc')
982 return bolt, nut
983
984
985 _dataset_bolt_nut = _MultiFileDownloadableDatasetLoader(
986 _bolt_nut_files_func,
987 load_func=_load_as_multiblock,
988 )
989
990
991 @_deprecate_positional_args
992 def download_clown(load=True): # noqa: FBT002
993 """Download clown dataset.
994
995 Parameters
996 ----------
997 load : bool, default: True
998 Load the dataset after downloading it when ``True``. Set this
999 to ``False`` and only the filename will be returned.
1000
1001 Returns
1002 -------
1003 output : pyvista.PolyData | str
1004 DataSet or filename depending on ``load``.
1005
1006 Examples
1007 --------
1008 >>> from pyvista import examples
1009 >>> dataset = examples.download_clown()
1010 >>> dataset.plot(color=True)
1011
1012 .. seealso::
1013
1014 :ref:`Clown Dataset <clown_dataset>`
1015 See this dataset in the Dataset Gallery for more info.
1016
1017 """
1018 return _download_dataset(_dataset_clown, load=load)
1019
1020
1021 _dataset_clown = _SingleFileDownloadableDatasetLoader('clown.facet')
1022
1023
1024 @_deprecate_positional_args
1025 def download_topo_global(load=True): # noqa: FBT002
1026 """Download topo dataset.
1027
1028 Parameters
1029 ----------
1030 load : bool, default: True
1031 Load the dataset after downloading it when ``True``. Set this
1032 to ``False`` and only the filename will be returned.
1033
1034 Returns
1035 -------
1036 output : pyvista.PolyData | str
1037 DataSet or filename depending on ``load``.
1038
1039 Examples
1040 --------
1041 .. pyvista-plot::
1042 :force_static:
1043
1044 >>> from pyvista import examples
1045 >>> dataset = examples.download_topo_global()
1046 >>> dataset.plot(cmap='gist_earth')
1047
1048 .. seealso::
1049
1050 :ref:`Topo Global Dataset <topo_global_dataset>`
1051 See this dataset in the Dataset Gallery for more info.
1052
1053 This dataset is used in the following examples:
1054
1055 * :ref:`compute_normals_example`
1056 * :ref:`background_image_example`
1057
1058 """
1059 return _download_dataset(_dataset_topo_global, load=load)
1060
1061
1062 _dataset_topo_global = _SingleFileDownloadableDatasetLoader('EarthModels/ETOPO_10min_Ice.vtp')
1063
1064
1065 @_deprecate_positional_args
1066 def download_topo_land(load=True): # noqa: FBT002
1067 """Download topo land dataset.
1068
1069 Parameters
1070 ----------
1071 load : bool, default: True
1072 Load the dataset after downloading it when ``True``. Set this
1073 to ``False`` and only the filename will be returned.
1074
1075 Returns
1076 -------
1077 output : pyvista.PolyData | str
1078 DataSet or filename depending on ``load``.
1079
1080 Examples
1081 --------
1082 >>> from pyvista import examples
1083 >>> dataset = examples.download_topo_land()
1084 >>> dataset.plot(clim=[-2000, 3000], cmap='gist_earth', show_scalar_bar=False)
1085
1086 .. seealso::
1087
1088 :ref:`Topo Land Dataset <topo_land_dataset>`
1089 See this dataset in the Dataset Gallery for more info.
1090
1091 This dataset is used in the following examples:
1092
1093 * :ref:`geodesic_example`
1094 * :ref:`background_image_example`
1095
1096 """
1097 return _download_dataset(_dataset_topo_land, load=load)
1098
1099
1100 _dataset_topo_land = _SingleFileDownloadableDatasetLoader(
1101 'EarthModels/ETOPO_10min_Ice_only-land.vtp',
1102 )
1103
1104
1105 @_deprecate_positional_args
1106 def download_coastlines(load=True): # noqa: FBT002
1107 """Download coastlines dataset.
1108
1109 Parameters
1110 ----------
1111 load : bool, default: True
1112 Load the dataset after downloading it when ``True``. Set this
1113 to ``False`` and only the filename will be returned.
1114
1115 Returns
1116 -------
1117 output : pyvista.PolyData | str
1118 DataSet or filename depending on ``load``.
1119
1120 Examples
1121 --------
1122 >>> from pyvista import examples
1123 >>> dataset = examples.download_coastlines()
1124 >>> dataset.plot()
1125
1126 .. seealso::
1127
1128 :ref:`Coastlines Dataset <coastlines_dataset>`
1129 See this dataset in the Dataset Gallery for more info.
1130
1131 """
1132 return _download_dataset(_dataset_coastlines, load=load)
1133
1134
1135 _dataset_coastlines = _SingleFileDownloadableDatasetLoader('EarthModels/Coastlines_Los_Alamos.vtp')
1136
1137
1138 @_deprecate_positional_args
1139 def download_knee(load=True): # noqa: FBT002
1140 """Download knee dataset.
1141
1142 Parameters
1143 ----------
1144 load : bool, default: True
1145 Load the dataset after downloading it when ``True``. Set this
1146 to ``False`` and only the filename will be returned.
1147
1148 Returns
1149 -------
1150 output : pyvista.ImageData | str
1151 DataSet or filename depending on ``load``.
1152
1153 Examples
1154 --------
1155 >>> from pyvista import examples
1156 >>> dataset = examples.download_knee()
1157 >>> dataset.plot(cpos='xy', show_scalar_bar=False)
1158
1159 .. seealso::
1160
1161 :ref:`Knee Dataset <knee_dataset>`
1162 See this dataset in the Dataset Gallery for more info.
1163
1164 :ref:`Knee Full Dataset <knee_full_dataset>`
1165
1166 :ref:`medical_dataset_gallery`
1167 Browse other medical datasets.
1168
1169 This dataset is used in the following examples:
1170
1171 * :ref:`opacity_example`
1172 * :ref:`volume_rendering_example`
1173 * :ref:`slider_bar_widget_example`
1174
1175 """
1176 return _download_dataset(_dataset_knee, load=load)
1177
1178
1179 _dataset_knee = _SingleFileDownloadableDatasetLoader('DICOM_KNEE.dcm')
1180
1181
1182 @_deprecate_positional_args
1183 def download_knee_full(load=True): # noqa: FBT002
1184 """Download full knee dataset.
1185
1186 Parameters
1187 ----------
1188 load : bool, default: True
1189 Load the dataset after downloading it when ``True``. Set this
1190 to ``False`` and only the filename will be returned.
1191
1192 Returns
1193 -------
1194 output : pyvista.ImageData | str
1195 DataSet or filename depending on ``load``.
1196
1197 Examples
1198 --------
1199 >>> from pyvista import examples
1200 >>> import pyvista as pv
1201 >>> dataset = examples.download_knee_full()
1202 >>> cpos = pv.CameraPosition(
1203 ... position=(-381.74, -46.02, 216.54),
1204 ... focal_point=(74.8305, 89.2905, 100.0),
1205 ... viewup=(0.23, 0.072, 0.97),
1206 ... )
1207 >>> dataset.plot(volume=True, cmap='bone', cpos=cpos, show_scalar_bar=False)
1208
1209 .. seealso::
1210
1211 :ref:`Knee Full Dataset <knee_full_dataset>`
1212 See this dataset in the Dataset Gallery for more info.
1213
1214 :ref:`Knee Dataset <knee_dataset>`
1215
1216 :ref:`medical_dataset_gallery`
1217 Browse other medical datasets.
1218
1219 This dataset is used in the following examples:
1220
1221 * :ref:`volume_rendering_example`
1222 * :ref:`slider_bar_widget_example`
1223
1224 """
1225 return _download_dataset(_dataset_knee_full, load=load)
1226
1227
1228 _dataset_knee_full = _SingleFileDownloadableDatasetLoader('vw_knee.slc')
1229
1230
1231 @_deprecate_positional_args
1232 def download_lidar(load=True): # noqa: FBT002
1233 """Download lidar dataset.
1234
1235 Parameters
1236 ----------
1237 load : bool, default: True
1238 Load the dataset after downloading it when ``True``. Set this
1239 to ``False`` and only the filename will be returned.
1240
1241 Returns
1242 -------
1243 output : pyvista.PolyData | str
1244 DataSet or filename depending on ``load``.
1245
1246 Examples
1247 --------
1248 .. pyvista-plot::
1249 :force_static:
1250
1251 >>> from pyvista import examples
1252 >>> dataset = examples.download_lidar()
1253 >>> dataset.plot(cmap='gist_earth')
1254
1255 .. seealso::
1256
1257 :ref:`Lidar Dataset <lidar_dataset>`
1258 See this dataset in the Dataset Gallery for more info.
1259
1260 This dataset is used in the following examples:
1261
1262 * :ref:`create_point_cloud_example`
1263 * :ref:`edl_example`
1264
1265 """
1266 return _download_dataset(_dataset_lidar, load=load)
1267
1268
1269 _dataset_lidar = _SingleFileDownloadableDatasetLoader('kafadar-lidar-interp.vtp')
1270
1271
1272 @_deprecate_positional_args
1273 def download_exodus(load=True): # noqa: FBT002
1274 """Sample ExodusII data file.
1275
1276 Parameters
1277 ----------
1278 load : bool, default: True
1279 Load the dataset after downloading it when ``True``. Set this
1280 to ``False`` and only the filename will be returned.
1281
1282 Returns
1283 -------
1284 output : pyvista.MultiBlock | str
1285 DataSet or filename depending on ``load``.
1286
1287 Examples
1288 --------
1289 >>> from pyvista import examples
1290 >>> dataset = examples.download_exodus()
1291 >>> dataset.plot()
1292
1293 .. seealso::
1294
1295 :ref:`Exodus Dataset <exodus_dataset>`
1296 See this dataset in the Dataset Gallery for more info.
1297
1298 """
1299 return _download_dataset(_dataset_exodus, load=load)
1300
1301
1302 _dataset_exodus = _SingleFileDownloadableDatasetLoader('mesh_fs8.exo')
1303
1304
1305 @_deprecate_positional_args
1306 def download_nefertiti(load=True): # noqa: FBT002
1307 """Download mesh of Queen Nefertiti.
1308
1309 .. warning::
1310
1311 **Non-commercial license.** This dataset is "The Other Nefertiti"
1312 (2016) by Nora Al-Badri and Jan Nikolai Nelles, released under
1313 `CC BY-NC-SA 4.0 <https://creativecommons.org/licenses/by-nc-sa/4.0/>`_.
1314 The license prohibits commercial use and imposes a ShareAlike
1315 requirement on derivative works. Do not use this dataset in
1316 commercial products or in any distribution that is incompatible
1317 with the NonCommercial or ShareAlike clauses.
1318
1319 The official Neues Museum / Staatliche Museen zu Berlin scan is
1320 also non-commercial (CC BY-NC-SA 3.0 DE). No permissively licensed
1321 Nefertiti scan is currently known to exist.
1322
1323 Required attribution: *Nora Al-Badri and Jan Nikolai Nelles,
1324 The Other Nefertiti (2016), CC BY-NC-SA 4.0*.
1325
1326 For a permissively licensed bust suitable for commercial use, see
1327 :func:`download_washington_bust` or :func:`download_lincoln_life_mask`,
1328 both released under CC0 by the Smithsonian.
1329
1330 Parameters
1331 ----------
1332 load : bool, default: True
1333 Load the dataset after downloading it when ``True``. Set this
1334 to ``False`` and only the filename will be returned.
1335
1336 Returns
1337 -------
1338 output : pyvista.PolyData | str
1339 DataSet or filename depending on ``load``.
1340
1341 Examples
1342 --------
1343 >>> from pyvista import examples
1344 >>> dataset = examples.download_nefertiti() # doctest: +SKIP
1345 >>> dataset.plot(cpos='xz') # doctest: +SKIP
1346
1347 .. seealso::
1348
1349 :ref:`Nefertiti Dataset <nefertiti_dataset>`
1350 See this dataset in the Dataset Gallery for more info.
1351
1352 This dataset is used in the following examples:
1353
1354 * :ref:`compute_normals_example`
1355 * :ref:`extract_edges_example`
1356 * :ref:`show_edges_example`
1357 * :ref:`edl_example`
1358 * :ref:`pbr_example`
1359 * :ref:`box_widget_example`
1360
1361 """
1362 warn_external(
1363 'download_nefertiti returns a dataset licensed under CC BY-NC-SA 4.0 '
1364 '("The Other Nefertiti" by Al-Badri and Nelles, 2016). It may not be '
1365 'used for commercial purposes, and derivative works must be shared '
1366 'under the same license. For a CC0 alternative suitable for commercial '
1367 'use, see download_washington_bust or download_lincoln_life_mask.',
1368 UserWarning,
1369 )
1370 return _download_dataset(_dataset_nefertiti, load=load)
1371
1372
1373 _dataset_nefertiti = _SingleFileDownloadableDatasetLoader(
1374 'nefertiti.ply.zip',
1375 target_file='nefertiti.ply',
1376 )
1377
1378
1379 def download_washington_bust(*, load: bool = True) -> PolyData | str:
1380 """Download a bust of George Washington.
1381
1382 A marble bust of George Washington (after Giuseppe Ceracchi, ca. 1819),
1383 collection of the Smithsonian National Portrait Gallery (NPG.70.4).
1384
1385 This dataset is released by the Smithsonian under the `CC0 Public
1386 Domain Dedication <https://creativecommons.org/publicdomain/zero/1.0/>`_:
1387 *"This media file is in the public domain (free of copyright
1388 restrictions). You can copy, modify, and distribute this work without
1389 contacting the Smithsonian."*
1390
1391 Source: https://3d.si.edu/
1392
1393 Parameters
1394 ----------
1395 load : bool, default: True
1396 Load the dataset after downloading it when ``True``. Set this
1397 to ``False`` and only the filename will be returned.
1398
1399 Returns
1400 -------
1401 output : pyvista.PolyData | str
1402 DataSet or filename depending on ``load``.
1403
1404 Examples
1405 --------
1406 >>> from pyvista import examples
1407 >>> dataset = examples.download_washington_bust() # doctest: +SKIP
1408 >>> dataset.plot() # doctest: +SKIP
1409
1410 .. seealso::
1411
1412 :ref:`Washington Bust Dataset <washington_bust_dataset>`
1413 See this dataset in the Dataset Gallery for more info.
1414
1415 :func:`download_lincoln_life_mask`
1416 Another CC0 head sculpture from the Smithsonian.
1417
1418 """
1419 return _download_dataset(_dataset_washington_bust, load=load)
1420
1421
1422 _dataset_washington_bust = _SingleFileDownloadableDatasetLoader(
1423 'washington_bust/washington_bust.obj',
1424 )
1425
1426
1427 def download_lincoln_life_mask(*, load: bool = True) -> PolyData | str:
1428 """Download the life mask of Abraham Lincoln.
1429
1430 A 3D scan of the Mills life mask of Abraham Lincoln (plaster, 1865),
1431 collection of the Smithsonian. The mask was cast from Lincoln's face
1432 two months before his assassination.
1433
1434 This dataset is released by the Smithsonian under the `CC0 Public
1435 Domain Dedication <https://creativecommons.org/publicdomain/zero/1.0/>`_:
1436 *"This media file is in the public domain (free of copyright
1437 restrictions). You can copy, modify, and distribute this work without
1438 contacting the Smithsonian."*
1439
1440 Source: https://3d.si.edu/
1441
1442 Parameters
1443 ----------
1444 load : bool, default: True
1445 Load the dataset after downloading it when ``True``. Set this
1446 to ``False`` and only the filename will be returned.
1447
1448 Returns
1449 -------
1450 output : pyvista.PolyData | str
1451 DataSet or filename depending on ``load``.
1452
1453 Examples
1454 --------
1455 >>> from pyvista import examples
1456 >>> dataset = examples.download_lincoln_life_mask() # doctest: +SKIP
1457 >>> dataset.plot() # doctest: +SKIP
1458
1459 .. seealso::
1460
1461 :ref:`Lincoln Life Mask Dataset <lincoln_life_mask_dataset>`
1462 See this dataset in the Dataset Gallery for more info.
1463
1464 :func:`download_washington_bust`
1465 A proper head-and-shoulders bust, also CC0.
1466
1467 """
1468 return _download_dataset(_dataset_lincoln_life_mask, load=load)
1469
1470
1471 _dataset_lincoln_life_mask = _SingleFileDownloadableDatasetLoader(
1472 'lincoln_life_mask/lincoln_life_mask.obj',
1473 )
1474
1475
1476 @_deprecate_positional_args
1477 def download_blood_vessels(load=True): # noqa: FBT002
1478 """Download data representing the bifurcation of blood vessels.
1479
1480 Parameters
1481 ----------
1482 load : bool, default: True
1483 Load the dataset after downloading it when ``True``. Set this
1484 to ``False`` and only the filename will be returned.
1485
1486 Returns
1487 -------
1488 output : pyvista.UnstructuredGrid | str
1489 DataSet or filename depending on ``load``.
1490
1491 Examples
1492 --------
1493 >>> from pyvista import examples
1494 >>> dataset = examples.download_blood_vessels()
1495 >>> dataset.plot()
1496
1497 .. seealso::
1498
1499 :ref:`Blood Vessels Dataset <blood_vessels_dataset>`
1500 See this dataset in the Dataset Gallery for more info.
1501
1502 This dataset is used in the following examples:
1503
1504 * :ref:`read_parallel_example`
1505 * :ref:`streamlines_example`
1506 * :ref:`integrate_data_example`
1507
1508 """
1509 return _download_dataset(_dataset_blood_vessels, load=load)
1510
1511
1512 def _blood_vessels_load_func(obj):
1513 obj.set_active_vectors('velocity')
1514 return obj
1515
1516
1517 _dataset_blood_vessels = _SingleFileDownloadableDatasetLoader(
1518 'pvtu_blood_vessels/blood_vessels.zip',
1519 target_file='T0000000500.pvtu',
1520 load_func=_blood_vessels_load_func,
1521 )
1522
1523
1524 @_deprecate_positional_args
1525 def download_iron_protein(load=True): # noqa: FBT002
1526 """Download iron protein dataset.
1527
1528 Parameters
1529 ----------
1530 load : bool, default: True
1531 Load the dataset after downloading it when ``True``. Set this
1532 to ``False`` and only the filename will be returned.
1533
1534 Returns
1535 -------
1536 output : pyvista.ImageData | str
1537 DataSet or filename depending on ``load``.
1538
1539 Examples
1540 --------
1541 >>> from pyvista import examples
1542 >>> dataset = examples.download_iron_protein()
1543 >>> dataset.plot(volume=True, cmap='blues')
1544
1545 .. seealso::
1546
1547 :ref:`Iron Protein Dataset <iron_protein_dataset>`
1548 See this dataset in the Dataset Gallery for more info.
1549
1550 """
1551 return _download_dataset(_dataset_iron_protein, load=load)
1552
1553
1554 _dataset_iron_protein = _SingleFileDownloadableDatasetLoader('ironProt.vtk')
1555
1556
1557 @_deprecate_positional_args
1558 def download_tetrahedron(load=True): # noqa: FBT002
1559 """Download tetrahedron dataset.
1560
1561 Parameters
1562 ----------
1563 load : bool, default: True
1564 Load the dataset after downloading it when ``True``. Set this
1565 to ``False`` and only the filename will be returned.
1566
1567 Returns
1568 -------
1569 output : pyvista.UnstructuredGrid | str
1570 DataSet or filename depending on ``load``.
1571
1572 Examples
1573 --------
1574 Shrink and plot the dataset to show it is composed of several
1575 tetrahedrons.
1576
1577 >>> from pyvista import examples
1578 >>> dataset = examples.download_tetrahedron()
1579 >>> dataset.shrink(0.85).plot()
1580
1581 .. seealso::
1582
1583 :ref:`Tetrahedron Dataset <tetrahedron_dataset>`
1584 See this dataset in the Dataset Gallery for more info.
1585
1586 """
1587 return _download_dataset(_dataset_tetrahedron, load=load)
1588
1589
1590 _dataset_tetrahedron = _SingleFileDownloadableDatasetLoader('Tetrahedron.vtu')
1591
1592
1593 @_deprecate_positional_args
1594 def download_saddle_surface(load=True): # noqa: FBT002
1595 """Download saddle surface dataset.
1596
1597 Parameters
1598 ----------
1599 load : bool, default: True
1600 Load the dataset after downloading it when ``True``. Set this
1601 to ``False`` and only the filename will be returned.
1602
1603 Returns
1604 -------
1605 output : pyvista.PolyData | str
1606 DataSet or filename depending on ``load``.
1607
1608 Examples
1609 --------
1610 >>> from pyvista import examples
1611 >>> dataset = examples.download_saddle_surface()
1612 >>> dataset.plot()
1613
1614 .. seealso::
1615
1616 :ref:`Saddle Surface Dataset <saddle_surface_dataset>`
1617 See this dataset in the Dataset Gallery for more info.
1618
1619 :ref:`interpolate_example`
1620 Example using this dataset.
1621
1622 """
1623 return _download_dataset(_dataset_saddle_surface, load=load)
1624
1625
1626 _dataset_saddle_surface = _SingleFileDownloadableDatasetLoader('InterpolatingOnSTL_final.stl')
1627
1628
1629 @_deprecate_positional_args
1630 def download_sparse_points(load=True): # noqa: FBT002
1631 """Download sparse points data.
1632
1633 Used with :func:`download_saddle_surface`.
1634
1635 Parameters
1636 ----------
1637 load : bool, default: True
1638 Load the dataset after downloading it when ``True``. Set this
1639 to ``False`` and only the filename will be returned.
1640
1641 Returns
1642 -------
1643 output : pyvista.PolyData | str
1644 DataSet or filename depending on ``load``.
1645
1646 Examples
1647 --------
1648 >>> from pyvista import examples
1649 >>> dataset = examples.download_sparse_points()
1650 >>> dataset.plot(scalars='val', render_points_as_spheres=True, point_size=50)
1651
1652 .. seealso::
1653
1654 :ref:`Sparse Points Dataset <sparse_points_dataset>`
1655 See this dataset in the Dataset Gallery for more info.
1656
1657 :ref:`interpolate_example`
1658 Example using this dataset.
1659
1660 """
1661 return _download_dataset(_dataset_sparse_points, load=load)
1662
1663
1664 def _sparse_points_reader(saved_file):
1665 points_reader = _vtk.vtkDelimitedTextReader()
1666 points_reader.SetFileName(saved_file)
1667 points_reader.DetectNumericColumnsOn()
1668 points_reader.SetFieldDelimiterCharacters('\t')
1669 points_reader.SetHaveHeaders(True)
1670 table_points = _vtk.vtkTableToPolyData()
1671 table_points.SetInputConnection(points_reader.GetOutputPort())
1672 table_points.SetXColumn('x')
1673 table_points.SetYColumn('y')
1674 table_points.SetZColumn('z')
1675 table_points.Update()
1676 return pv.wrap(table_points.GetOutput())
1677
1678
1679 _dataset_sparse_points = _SingleFileDownloadableDatasetLoader(
1680 'sparsePoints.txt',
1681 read_func=_sparse_points_reader,
1682 )
1683
1684
1685 @_deprecate_positional_args
1686 def download_foot_bones(load=True): # noqa: FBT002
1687 """Download foot bones dataset.
1688
1689 Parameters
1690 ----------
1691 load : bool, default: True
1692 Load the dataset after downloading it when ``True``. Set this
1693 to ``False`` and only the filename will be returned.
1694
1695 Returns
1696 -------
1697 output : pyvista.PolyData | str
1698 DataSet or filename depending on ``load``.
1699
1700 Examples
1701 --------
1702 >>> from pyvista import examples
1703 >>> dataset = examples.download_foot_bones()
1704 >>> dataset.plot()
1705
1706 .. seealso::
1707
1708 :ref:`Foot Bones Dataset <foot_bones_dataset>`
1709 See this dataset in the Dataset Gallery for more info.
1710
1711 :ref:`voxelize_example`
1712 Example using this dataset.
1713
1714 :ref:`compare_threshold_filters_example`
1715 Example using this dataset.
1716
1717
1718 """
1719 return _download_dataset(_dataset_foot_bones, load=load)
1720
1721
1722 _dataset_foot_bones = _SingleFileDownloadableDatasetLoader('fsu/footbones.ply')
1723
1724
1725 @_deprecate_positional_args
1726 def download_guitar(load=True): # noqa: FBT002
1727 """Download guitar dataset.
1728
1729 Parameters
1730 ----------
1731 load : bool, default: True
1732 Load the dataset after downloading it when ``True``. Set this
1733 to ``False`` and only the filename will be returned.
1734
1735 Returns
1736 -------
1737 output : pyvista.PolyData | str
1738 DataSet or filename depending on ``load``.
1739
1740 Examples
1741 --------
1742 >>> from pyvista import examples
1743 >>> dataset = examples.download_guitar()
1744 >>> dataset.plot()
1745
1746 .. seealso::
1747
1748 :ref:`Guitar Dataset <guitar_dataset>`
1749 See this dataset in the Dataset Gallery for more info.
1750
1751 :ref:`Trumpet Dataset <trumpet_dataset>`
1752
1753 """
1754 return _download_dataset(_dataset_guitar, load=load)
1755
1756
1757 _dataset_guitar = _SingleFileDownloadableDatasetLoader('fsu/stratocaster.ply')
1758
1759
1760 @_deprecate_positional_args
1761 def download_quadratic_pyramid(load=True): # noqa: FBT002
1762 """Download quadratic pyramid dataset.
1763
1764 Parameters
1765 ----------
1766 load : bool, default: True
1767 Load the dataset after downloading it when ``True``. Set this
1768 to ``False`` and only the filename will be returned.
1769
1770 Returns
1771 -------
1772 output : pyvista.UnstructuredGrid | str
1773 DataSet or filename depending on ``load``.
1774
1775 Examples
1776 --------
1777 Shrink and plot the dataset to show it is composed of several
1778 pyramids.
1779
1780 >>> from pyvista import examples
1781 >>> dataset = examples.download_quadratic_pyramid()
1782 >>> dataset.shrink(0.4).plot()
1783
1784 .. seealso::
1785
1786 :ref:`Quadratic Pyramid Dataset <quadratic_pyramid_dataset>`
1787 See this dataset in the Dataset Gallery for more info.
1788
1789 """
1790 return _download_dataset(_dataset_quadratic_pyramid, load=load)
1791
1792
1793 _dataset_quadratic_pyramid = _SingleFileDownloadableDatasetLoader('QuadraticPyramid.vtu')
1794
1795
1796 @_deprecate_positional_args
1797 def download_bird(load=True): # noqa: FBT002
1798 """Download bird dataset.
1799
1800 Parameters
1801 ----------
1802 load : bool, default: True
1803 Load the dataset after downloading it when ``True``. Set this
1804 to ``False`` and only the filename will be returned.
1805
1806 Returns
1807 -------
1808 output : pyvista.ImageData | str
1809 DataSet or filename depending on ``load``.
1810
1811 Examples
1812 --------
1813 >>> from pyvista import examples
1814 >>> dataset = examples.download_bird()
1815 >>> dataset.plot(rgba=True, cpos='xy')
1816
1817 .. seealso::
1818
1819 :ref:`Bird Dataset <bird_dataset>`
1820 See this dataset in the Dataset Gallery for more info.
1821
1822 :ref:`Bird Texture Dataset <bird_texture_dataset>`
1823
1824 """
1825 return _download_dataset(_dataset_bird, load=load)
1826
1827
1828 _dataset_bird = _SingleFileDownloadableDatasetLoader('Pileated.jpg')
1829
1830
1831 @_deprecate_positional_args
1832 def download_bird_texture(load=True): # noqa: FBT002
1833 """Download bird texture.
1834
1835 Parameters
1836 ----------
1837 load : bool, default: True
1838 Load the dataset after downloading it when ``True``. Set this
1839 to ``False`` and only the filename will be returned.
1840
1841 Returns
1842 -------
1843 output : pyvista.Texture | str
1844 DataSet or filename depending on ``load``.
1845
1846 Examples
1847 --------
1848 >>> from pyvista import examples
1849 >>> dataset = examples.download_bird_texture()
1850 >>> dataset.plot(cpos='xy')
1851
1852 .. seealso::
1853
1854 :ref:`Bird Texture Dataset <bird_texture_dataset>`
1855 See this dataset in the Dataset Gallery for more info.
1856
1857 :ref:`Bird Dataset <bird_dataset>`
1858
1859 """
1860 return _download_dataset(_dataset_bird_texture, load=load)
1861
1862
1863 _dataset_bird_texture = _SingleFileDownloadableDatasetLoader(
1864 'Pileated.jpg',
1865 read_func=read_texture,
1866 )
1867
1868
1869 @_deprecate_positional_args
1870 def download_office(load=True): # noqa: FBT002
1871 """Download office dataset.
1872
1873 Parameters
1874 ----------
1875 load : bool, default: True
1876 Load the dataset after downloading it when ``True``. Set this
1877 to ``False`` and only the filename will be returned.
1878
1879 Returns
1880 -------
1881 output : pyvista.StructuredGrid | str
1882 DataSet or filename depending on ``load``.
1883
1884 Examples
1885 --------
1886 >>> from pyvista import examples
1887 >>> dataset = examples.download_office()
1888 >>> dataset.contour().plot()
1889
1890 .. seealso::
1891
1892 :ref:`Office Dataset <office_dataset>`
1893 See this dataset in the Dataset Gallery for more info.
1894
1895 :ref:`clip_with_plane_box_example`
1896 Example using this dataset.
1897
1898 """
1899 return _download_dataset(_dataset_office, load=load)
1900
1901
1902 _dataset_office = _SingleFileDownloadableDatasetLoader('office.binary.vtk')
1903
1904
1905 @_deprecate_positional_args
1906 def download_horse_points(load=True): # noqa: FBT002
1907 """Download horse points dataset.
1908
1909 Parameters
1910 ----------
1911 load : bool, default: True
1912 Load the dataset after downloading it when ``True``. Set this
1913 to ``False`` and only the filename will be returned.
1914
1915 Returns
1916 -------
1917 output : pyvista.PolyData | str
1918 DataSet or filename depending on ``load``.
1919
1920 Examples
1921 --------
1922 >>> from pyvista import examples
1923 >>> dataset = examples.download_horse_points()
1924 >>> dataset.plot(point_size=1)
1925
1926 .. seealso::
1927
1928 :ref:`Horse Points Dataset <horse_points_dataset>`
1929 See this dataset in the Dataset Gallery for more info.
1930
1931 :ref:`Horse Dataset <horse_dataset>`
1932
1933 :ref:`farthest_point_sampling_example`
1934 Example using this dataset.
1935
1936 """
1937 return _download_dataset(_dataset_horse_points, load=load)
1938
1939
1940 _dataset_horse_points = _SingleFileDownloadableDatasetLoader('horsePoints.vtp')
1941
1942
1943 @_deprecate_positional_args
1944 def download_horse(load=True): # noqa: FBT002
1945 """Download horse dataset.
1946
1947 Parameters
1948 ----------
1949 load : bool, default: True
1950 Load the dataset after downloading it when ``True``. Set this
1951 to ``False`` and only the filename will be returned.
1952
1953 Returns
1954 -------
1955 output : pyvista.DataSet | str
1956 DataSet or filename depending on ``load``.
1957
1958 Examples
1959 --------
1960 >>> from pyvista import examples
1961 >>> dataset = examples.download_horse()
1962 >>> dataset.plot(smooth_shading=True)
1963
1964 .. seealso::
1965
1966 :ref:`Horse Dataset <horse_dataset>`
1967 See this dataset in the Dataset Gallery for more info.
1968
1969 :ref:`Horse Points Dataset <horse_points_dataset>`
1970
1971 :ref:`mesh_lighting_example`
1972 Example using this dataset.
1973
1974 """
1975 return _download_dataset(_dataset_horse, load=load)
1976
1977
1978 _dataset_horse = _SingleFileDownloadableDatasetLoader('horse.vtp')
1979
1980
1981 @_deprecate_positional_args
1982 def download_cake_easy(load=True): # noqa: FBT002
1983 """Download cake dataset.
1984
1985 Parameters
1986 ----------
1987 load : bool, default: True
1988 Load the dataset after downloading it when ``True``. Set this
1989 to ``False`` and only the filename will be returned.
1990
1991 Returns
1992 -------
1993 output : pyvista.ImageData | str
1994 DataSet or filename depending on ``load``.
1995
1996 Examples
1997 --------
1998 >>> from pyvista import examples
1999 >>> dataset = examples.download_cake_easy()
2000 >>> dataset.plot(rgba=True, cpos='xy')
2001
2002 .. seealso::
2003
2004 :ref:`Cake Easy Dataset <cake_easy_dataset>`
2005 See this dataset in the Dataset Gallery for more info.
2006
2007 :ref:`Cake Easy Texture Dataset <cake_easy_texture_dataset>`
2008
2009 """
2010 return _download_dataset(_dataset_cake_easy, load=load)
2011
2012
2013 _dataset_cake_easy = _SingleFileDownloadableDatasetLoader('cake_easy.jpg')
2014
2015
2016 @_deprecate_positional_args
2017 def download_cake_easy_texture(load=True): # noqa: FBT002
2018 """Download cake texture.
2019
2020 Parameters
2021 ----------
2022 load : bool, default: True
2023 Load the dataset after downloading it when ``True``. Set this
2024 to ``False`` and only the filename will be returned.
2025
2026 Returns
2027 -------
2028 output : pyvista.Texture | str
2029 DataSet or filename depending on ``load``.
2030
2031 Examples
2032 --------
2033 >>> from pyvista import examples
2034 >>> dataset = examples.download_cake_easy_texture()
2035 >>> dataset.plot(cpos='xy')
2036
2037 .. seealso::
2038
2039 :ref:`Cake Easy Texture Dataset <cake_easy_texture_dataset>`
2040 See this dataset in the Dataset Gallery for more info.
2041
2042 :ref:`Cake Easy Dataset <cake_easy_dataset>`
2043
2044 """
2045 return _download_dataset(_dataset_cake_easy_texture, load=load)
2046
2047
2048 _dataset_cake_easy_texture = _SingleFileDownloadableDatasetLoader(
2049 'cake_easy.jpg',
2050 read_func=read_texture,
2051 )
2052
2053
2054 @_deprecate_positional_args
2055 def download_rectilinear_grid(load=True): # noqa: FBT002
2056 """Download rectilinear grid dataset.
2057
2058 Parameters
2059 ----------
2060 load : bool, default: True
2061 Load the dataset after downloading it when ``True``. Set this
2062 to ``False`` and only the filename will be returned.
2063
2064 Returns
2065 -------
2066 output : pyvista.RectilinearGrid | str
2067 DataSet or filename depending on ``load``.
2068
2069 Examples
2070 --------
2071 Compute the threshold of this dataset.
2072
2073 >>> from pyvista import examples
2074 >>> dataset = examples.download_rectilinear_grid()
2075 >>> dataset.threshold(0.0001).plot()
2076
2077 .. seealso::
2078
2079 :ref:`Rectilinear Grid Dataset <rectilinear_grid_dataset>`
2080 See this dataset in the Dataset Gallery for more info.
2081
2082 """
2083 return _download_dataset(_dataset_rectilinear_grid, load=load)
2084
2085
2086 _dataset_rectilinear_grid = _SingleFileDownloadableDatasetLoader('RectilinearGrid.vtr')
2087
2088
2089 @_deprecate_positional_args
2090 def download_gourds(zoom=False, load=True): # noqa: FBT002
2091 """Download gourds dataset.
2092
2093 Parameters
2094 ----------
2095 zoom : bool, default: False
2096 When ``True``, return the zoomed picture of the gourds.
2097
2098 load : bool, default: True
2099 Load the dataset after downloading it when ``True``. Set this
2100 to ``False`` and only the filename will be returned.
2101
2102 Returns
2103 -------
2104 output : pyvista.ImageData | str
2105 DataSet or filename depending on ``load``.
2106
2107 Examples
2108 --------
2109 >>> from pyvista import examples
2110 >>> dataset = examples.download_gourds()
2111 >>> dataset.plot(rgba=True, cpos='xy')
2112
2113 .. seealso::
2114
2115 :ref:`Gourds Dataset <gourds_dataset>`
2116 See this dataset in the Dataset Gallery for more info.
2117
2118 :ref:`Gourds Pnm Dataset <gourds_pnm_dataset>`
2119
2120 :ref:`Gourds Texture Dataset <gourds_texture_dataset>`
2121
2122 :ref:`gaussian_smoothing_example`
2123 Example using this dataset.
2124
2125 """
2126 example = __gourds2 if zoom else _dataset_gourds
2127 return _download_dataset(example, load=load)
2128
2129
2130 # Two loadable files, but only one example
2131 # Name variables such that non-zoomed version is the 'representative' example
2132 # Use '__' on the zoomed version to label it as private
2133 _dataset_gourds = _SingleFileDownloadableDatasetLoader('Gourds.png')
2134 __gourds2 = _SingleFileDownloadableDatasetLoader('Gourds2.jpg')
2135
2136
2137 @_deprecate_positional_args
2138 def download_gourds_texture(zoom=False, load=True): # noqa: FBT002
2139 """Download gourds texture.
2140
2141 Parameters
2142 ----------
2143 zoom : bool, default: False
2144 When ``True``, return the zoomed picture of the gourds.
2145
2146 load : bool, default: True
2147 Load the dataset after downloading it when ``True``. Set this
2148 to ``False`` and only the filename will be returned.
2149
2150 Returns
2151 -------
2152 output : pyvista.DataSet | str
2153 DataSet or filename depending on ``load``.
2154
2155 Examples
2156 --------
2157 >>> from pyvista import examples
2158 >>> dataset = examples.download_gourds_texture()
2159 >>> dataset.plot(cpos='xy')
2160
2161 .. seealso::
2162
2163 :ref:`Gourds Texture Dataset <gourds_texture_dataset>`
2164 See this dataset in the Dataset Gallery for more info.
2165
2166 :ref:`Gourds Dataset <gourds_dataset>`
2167
2168 :ref:`Gourds Pnm Dataset <gourds_pnm_dataset>`
2169
2170 """
2171 example = __gourds2_texture if zoom else _dataset_gourds_texture
2172 return _download_dataset(example, load=load)
2173
2174
2175 # Two loadable files, but only one example
2176 # Name variables such that non-zoomed version is the 'representative' example
2177 # Use '__' on the zoomed version to label it as private
2178 _dataset_gourds_texture = _SingleFileDownloadableDatasetLoader(
2179 'Gourds.png',
2180 read_func=read_texture,
2181 )
2182 __gourds2_texture = _SingleFileDownloadableDatasetLoader('Gourds2.jpg', read_func=read_texture)
2183
2184
2185 @_deprecate_positional_args
2186 def download_gourds_pnm(load=True): # noqa: FBT002
2187 """Download gourds dataset from pnm file.
2188
2189 Parameters
2190 ----------
2191 load : bool, default: True
2192 Load the dataset after downloading it when ``True``. Set this
2193 to ``False`` and only the filename will be returned.
2194
2195 Returns
2196 -------
2197 output : pyvista.ImageData | str
2198 DataSet or filename depending on ``load``.
2199
2200 Examples
2201 --------
2202 >>> from pyvista import examples
2203 >>> dataset = examples.download_gourds_pnm()
2204 >>> dataset.plot(rgba=True, cpos='xy')
2205
2206 .. seealso::
2207
2208 :ref:`Gourds Pnm Dataset <gourds_pnm_dataset>`
2209 See this dataset in the Dataset Gallery for more info.
2210
2211 :ref:`Gourds Dataset <gourds_dataset>`
2212
2213 :ref:`Gourds Texture Dataset <gourds_texture_dataset>`
2214
2215 """
2216 return _download_dataset(_dataset_gourds_pnm, load=load)
2217
2218
2219 _dataset_gourds_pnm = _SingleFileDownloadableDatasetLoader('Gourds.pnm')
2220
2221
2222 @_deprecate_positional_args
2223 def download_unstructured_grid(load=True): # noqa: FBT002
2224 """Download unstructured grid dataset.
2225
2226 Parameters
2227 ----------
2228 load : bool, default: True
2229 Load the dataset after downloading it when ``True``. Set this
2230 to ``False`` and only the filename will be returned.
2231
2232 Returns
2233 -------
2234 output : pyvista.UnstructuredGrid | str
2235 DataSet or filename depending on ``load``.
2236
2237 Examples
2238 --------
2239 >>> from pyvista import examples
2240 >>> dataset = examples.download_unstructured_grid()
2241 >>> dataset.plot(show_edges=True)
2242
2243 .. seealso::
2244
2245 :ref:`Unstructured Grid Dataset <unstructured_grid_dataset>`
2246 See this dataset in the Dataset Gallery for more info.
2247
2248 """
2249 return _download_dataset(_dataset_unstructured_grid, load=load)
2250
2251
2252 _dataset_unstructured_grid = _SingleFileDownloadableDatasetLoader('uGridEx.vtk')
2253
2254
2255 @_deprecate_positional_args
2256 def download_letter_k(load=True): # noqa: FBT002
2257 """Download letter k dataset.
2258
2259 Parameters
2260 ----------
2261 load : bool, default: True
2262 Load the dataset after downloading it when ``True``. Set this
2263 to ``False`` and only the filename will be returned.
2264
2265 Returns
2266 -------
2267 output : pyvista.PolyData | str
2268 DataSet or filename depending on ``load``.
2269
2270 Examples
2271 --------
2272 >>> from pyvista import examples
2273 >>> dataset = examples.download_letter_k()
2274 >>> dataset.plot(cpos='xy')
2275
2276 .. seealso::
2277
2278 :ref:`Letter K Dataset <letter_k_dataset>`
2279 See this dataset in the Dataset Gallery for more info.
2280
2281 :ref:`Letter A Dataset <letter_a_dataset>`
2282
2283 """
2284 return _download_dataset(_dataset_letter_k, load=load)
2285
2286
2287 _dataset_letter_k = _SingleFileDownloadableDatasetLoader('k.vtk')
2288
2289
2290 @_deprecate_positional_args
2291 def download_letter_a(load=True): # noqa: FBT002
2292 """Download letter a dataset.
2293
2294 Parameters
2295 ----------
2296 load : bool, default: True
2297 Load the dataset after downloading it when ``True``. Set this
2298 to ``False`` and only the filename will be returned.
2299
2300 Returns
2301 -------
2302 output : pyvista.UnstructuredGrid | str
2303 DataSet or filename depending on ``load``.
2304
2305 Examples
2306 --------
2307 >>> from pyvista import examples
2308 >>> dataset = examples.download_letter_a()
2309 >>> dataset.plot(cpos='xy', show_edges=True)
2310
2311 .. seealso::
2312
2313 :ref:`Letter A Dataset <letter_a_dataset>`
2314 See this dataset in the Dataset Gallery for more info.
2315
2316 :ref:`Letter K Dataset <letter_k_dataset>`
2317
2318 :ref:`cell_centers_example`
2319 Example using this dataset.
2320
2321 """
2322 return _download_dataset(_dataset_letter_a, load=load)
2323
2324
2325 _dataset_letter_a = _SingleFileDownloadableDatasetLoader('a_grid.vtk')
2326
2327
2328 @_deprecate_positional_args
2329 def download_poly_line(load=True): # noqa: FBT002
2330 """Download polyline dataset.
2331
2332 Parameters
2333 ----------
2334 load : bool, default: True
2335 Load the dataset after downloading it when ``True``. Set this
2336 to ``False`` and only the filename will be returned.
2337
2338 Returns
2339 -------
2340 output : pyvista.PolyData | str
2341 DataSet or filename depending on ``load``.
2342
2343 Examples
2344 --------
2345 >>> from pyvista import examples
2346 >>> dataset = examples.download_poly_line()
2347 >>> dataset.plot(line_width=5)
2348
2349 .. seealso::
2350
2351 :ref:`Poly Line Dataset <poly_line_dataset>`
2352 See this dataset in the Dataset Gallery for more info.
2353
2354 """
2355 return _download_dataset(_dataset_poly_line, load=load)
2356
2357
2358 _dataset_poly_line = _SingleFileDownloadableDatasetLoader('polyline.vtk')
2359
2360
2361 @_deprecate_positional_args
2362 def download_cad_model(load=True): # noqa: FBT002
2363 """Download cad dataset.
2364
2365 Parameters
2366 ----------
2367 load : bool, default: True
2368 Load the dataset after downloading it when ``True``. Set this
2369 to ``False`` and only the filename will be returned.
2370
2371 Returns
2372 -------
2373 output : pyvista.PolyData | str
2374 DataSet or filename depending on ``load``.
2375
2376 Examples
2377 --------
2378 >>> from pyvista import examples
2379 >>> dataset = examples.download_cad_model()
2380 >>> dataset.plot()
2381
2382 .. seealso::
2383
2384 :ref:`Cad Model Dataset <cad_model_dataset>`
2385 See this dataset in the Dataset Gallery for more info.
2386
2387 :ref:`read_file_example`
2388 Example using this dataset.
2389
2390 """
2391 return _download_dataset(_dataset_cad_model, load=load)
2392
2393
2394 _dataset_cad_model = _SingleFileDownloadableDatasetLoader('42400-IDGH.stl')
2395
2396
2397 @_deprecate_positional_args
2398 def download_frog(load=True): # noqa: FBT002
2399 """Download frog dataset.
2400
2401 Parameters
2402 ----------
2403 load : bool, default: True
2404 Load the dataset after downloading it when ``True``. Set this
2405 to ``False`` and only the filename will be returned.
2406
2407 Returns
2408 -------
2409 output : pyvista.ImageData | str
2410 DataSet or filename depending on ``load``.
2411
2412 Examples
2413 --------
2414 >>> from pyvista import examples
2415 >>> import pyvista as pv
2416 >>> cpos = pv.CameraPosition(
2417 ... position=(8.4287e02, -5.7418e02, -4.4085e02),
2418 ... focal_point=(2.4950e02, 2.3450e02, 1.0125e02),
2419 ... viewup=(-3.2000e-01, 3.5000e-01, -8.8000e-01),
2420 ... )
2421 >>> dataset = examples.download_frog()
2422 >>> dataset.plot(volume=True, cpos=cpos)
2423
2424 .. seealso::
2425
2426 :ref:`Frog Dataset <frog_dataset>`
2427 See this dataset in the Dataset Gallery for more info.
2428
2429 :ref:`Frog Tissues Dataset <frog_tissues_dataset>`
2430 Segmentation labels associated with this dataset.
2431
2432 :ref:`medical_dataset_gallery`
2433 Browse other medical datasets.
2434
2435 :ref:`volume_rendering_example`
2436 Example using this dataset.
2437
2438 """
2439 return _download_dataset(_dataset_frog, load=load)
2440
2441
2442 def _frog_files_func():
2443 # Multiple files needed for read, but only one gets loaded
2444 frog_zraw = _DownloadableFile('froggy/frog.zraw')
2445 frog_mhd = _SingleFileDownloadableDatasetLoader('froggy/frog.mhd')
2446 return frog_mhd, frog_zraw
2447
2448
2449 _dataset_frog = _MultiFileDownloadableDatasetLoader(_frog_files_func)
2450
2451
2452 @_deprecate_positional_args
2453 def download_chest(load=True): # noqa: FBT002
2454 """Download chest dataset.
2455
2456 Parameters
2457 ----------
2458 load : bool, default: True
2459 Load the dataset after downloading it when ``True``. Set this
2460 to ``False`` and only the filename will be returned.
2461
2462 Returns
2463 -------
2464 output : pyvista.ImageData | str
2465 DataSet or filename depending on ``load``.
2466
2467 Examples
2468 --------
2469 >>> from pyvista import examples
2470 >>> dataset = examples.download_chest()
2471 >>> dataset.plot(cpos='xy')
2472
2473 .. seealso::
2474
2475 :ref:`Chest Dataset <chest_dataset>`
2476 See this dataset in the Dataset Gallery for more info.
2477
2478 :ref:`medical_dataset_gallery`
2479 Browse other medical datasets.
2480
2481 :ref:`volume_rendering_example`
2482 Example using this dataset.
2483
2484 """
2485 return _download_dataset(_dataset_chest, load=load)
2486
2487
2488 _dataset_chest = _SingleFileDownloadableDatasetLoader('MetaIO/ChestCT-SHORT.mha')
2489
2490
2491 @_deprecate_positional_args
2492 def download_brain_atlas_with_sides(load=True): # noqa: FBT002
2493 """Download an image of an averaged brain with a right-left label.
2494
2495 Parameters
2496 ----------
2497 load : bool, default: True
2498 Load the dataset after downloading it when ``True``. Set this
2499 to ``False`` and only the filename will be returned.
2500
2501 Returns
2502 -------
2503 output : pyvista.ImageData | str
2504 DataSet or filename depending on ``load``.
2505
2506 Examples
2507 --------
2508 >>> from pyvista import examples
2509 >>> dataset = examples.download_brain_atlas_with_sides()
2510 >>> dataset.slice(normal='z').plot(cpos='xy')
2511
2512 .. seealso::
2513
2514 :ref:`Brain Atlas With Sides Dataset <brain_atlas_with_sides_dataset>`
2515 See this dataset in the Dataset Gallery for more info.
2516
2517 :ref:`Brain Dataset <brain_dataset>`
2518
2519 :ref:`medical_dataset_gallery`
2520 Browse other medical datasets.
2521
2522 """
2523 return _download_dataset(_dataset_brain_atlas_with_sides, load=load)
2524
2525
2526 _dataset_brain_atlas_with_sides = _SingleFileDownloadableDatasetLoader('avg152T1_RL_nifti.nii.gz')
2527
2528
2529 @_deprecate_positional_args
2530 def download_prostate(load=True): # noqa: FBT002
2531 """Download prostate dataset.
2532
2533 Parameters
2534 ----------
2535 load : bool, default: True
2536 Load the dataset after downloading it when ``True``. Set this
2537 to ``False`` and only the filename will be returned.
2538
2539 Returns
2540 -------
2541 output : pyvista.ImageData | str
2542 DataSet or filename depending on ``load``.
2543
2544 Examples
2545 --------
2546 >>> from pyvista import examples
2547 >>> dataset = examples.download_prostate()
2548 >>> dataset.plot(cpos='xy')
2549
2550 .. seealso::
2551
2552 :ref:`Prostate Dataset <prostate_dataset>`
2553 See this dataset in the Dataset Gallery for more info.
2554
2555 :ref:`medical_dataset_gallery`
2556 Browse other medical datasets.
2557
2558 """
2559 return _download_dataset(_dataset_prostate, load=load)
2560
2561
2562 _dataset_prostate = _SingleFileDownloadableDatasetLoader('prostate.img')
2563
2564
2565 @_deprecate_positional_args
2566 def download_filled_contours(load=True): # noqa: FBT002
2567 """Download filled contours dataset.
2568
2569 Parameters
2570 ----------
2571 load : bool, default: True
2572 Load the dataset after downloading it when ``True``. Set this
2573 to ``False`` and only the filename will be returned.
2574
2575 Returns
2576 -------
2577 output : pyvista.PolyData | str
2578 DataSet or filename depending on ``load``.
2579
2580 Examples
2581 --------
2582 >>> from pyvista import examples
2583 >>> dataset = examples.download_filled_contours()
2584 >>> dataset.plot(cpos='xy')
2585
2586 .. seealso::
2587
2588 :ref:`Filled Contours Dataset <filled_contours_dataset>`
2589 See this dataset in the Dataset Gallery for more info.
2590
2591 """
2592 return _download_dataset(_dataset_filled_contours, load=load)
2593
2594
2595 _dataset_filled_contours = _SingleFileDownloadableDatasetLoader('filledContours.vtp')
2596
2597
2598 @_deprecate_positional_args
2599 def download_doorman(load=True): # noqa: FBT002
2600 """Download doorman dataset.
2601
2602 .. versionchanged:: 0.44.0
2603 Add support for downloading the texture images.
2604
2605 Parameters
2606 ----------
2607 load : bool, default: True
2608 Load the dataset after downloading it when ``True``. Set this
2609 to ``False`` and only the filename will be returned.
2610
2611 Returns
2612 -------
2613 output : pyvista.PolyData | str
2614 DataSet or filename depending on ``load``.
2615
2616 Examples
2617 --------
2618 >>> from pyvista import examples
2619 >>> dataset = examples.download_doorman()
2620 >>> dataset.plot(cpos='xy')
2621
2622 .. seealso::
2623
2624 :ref:`Doorman Dataset <doorman_dataset>`
2625 See this dataset in the Dataset Gallery for more info.
2626
2627 :ref:`read_file_example`
2628 Example using this dataset.
2629
2630 """
2631 return _download_dataset(_dataset_doorman, load=load)
2632
2633
2634 def _doorman_files_func():
2635 # Multiple files needed for read, but only one gets loaded
2636 doorman_obj = _SingleFileDownloadableDatasetLoader('doorman/doorman.obj')
2637 doorman_mtl = _DownloadableFile('doorman/doorman.mtl')
2638 t_doorMan_d = _DownloadableFile('doorman/t_doorMan_d.png')
2639 t_doorMan_n = _DownloadableFile('doorman/t_doorMan_n.png')
2640 t_doorMan_s = _DownloadableFile('doorman/t_doorMan_s.png')
2641 t_doorMan_teeth_d = _DownloadableFile('doorman/t_doorMan_teeth_d.png')
2642 t_doorMan_teeth_n = _DownloadableFile('doorman/t_doorMan_teeth_n.png')
2643 t_eye_d = _DownloadableFile('doorman/t_eye_d.png')
2644 t_eye_n = _DownloadableFile('doorman/t_eye_n.png')
2645 return (
2646 doorman_obj,
2647 doorman_mtl,
2648 t_doorMan_d,
2649 t_doorMan_n,
2650 t_doorMan_s,
2651 t_doorMan_teeth_d,
2652 t_doorMan_teeth_n,
2653 t_eye_d,
2654 t_eye_n,
2655 )
2656
2657
2658 _dataset_doorman = _MultiFileDownloadableDatasetLoader(
2659 files_func=_doorman_files_func,
2660 )
2661
2662
2663 @_deprecate_positional_args
2664 def download_mug(load=True): # noqa: FBT002
2665 """Download mug dataset.
2666
2667 Parameters
2668 ----------
2669 load : bool, default: True
2670 Load the dataset after downloading it when ``True``. Set this
2671 to ``False`` and only the filename will be returned.
2672
2673 Returns
2674 -------
2675 output : pyvista.MultiBlock | str
2676 DataSet or filename depending on ``load``.
2677
2678 Examples
2679 --------
2680 >>> from pyvista import examples
2681 >>> dataset = examples.download_mug()
2682 >>> dataset.plot()
2683
2684 .. seealso::
2685
2686 :ref:`Mug Dataset <mug_dataset>`
2687 See this dataset in the Dataset Gallery for more info.
2688
2689 """
2690 return _download_dataset(_dataset_mug, load=load)
2691
2692
2693 _dataset_mug = _SingleFileDownloadableDatasetLoader('mug.e')
2694
2695
2696 @_deprecate_positional_args
2697 def download_oblique_cone(load=True): # noqa: FBT002
2698 """Download oblique cone dataset.
2699
2700 Parameters
2701 ----------
2702 load : bool, default: True
2703 Load the dataset after downloading it when ``True``. Set this
2704 to ``False`` and only the filename will be returned.
2705
2706 Returns
2707 -------
2708 output : pyvista.PolyData | str
2709 DataSet or filename depending on ``load``.
2710
2711 Examples
2712 --------
2713 >>> from pyvista import examples
2714 >>> dataset = examples.download_oblique_cone()
2715 >>> dataset.plot()
2716
2717 .. seealso::
2718
2719 :ref:`Oblique Cone Dataset <oblique_cone_dataset>`
2720 See this dataset in the Dataset Gallery for more info.
2721
2722 """
2723 return _download_dataset(_dataset_oblique_cone, load=load)
2724
2725
2726 _dataset_oblique_cone = _SingleFileDownloadableDatasetLoader('ObliqueCone.vtp')
2727
2728
2729 @_deprecate_positional_args
2730 def download_emoji(load=True): # noqa: FBT002
2731 """Download emoji dataset.
2732
2733 Parameters
2734 ----------
2735 load : bool, default: True
2736 Load the dataset after downloading it when ``True``. Set this
2737 to ``False`` and only the filename will be returned.
2738
2739 Returns
2740 -------
2741 output : pyvista.ImageData | str
2742 DataSet or filename depending on ``load``.
2743
2744 Examples
2745 --------
2746 >>> from pyvista import examples
2747 >>> dataset = examples.download_emoji()
2748 >>> dataset.plot(rgba=True, cpos='xy')
2749
2750 .. seealso::
2751
2752 :ref:`Emoji Dataset <emoji_dataset>`
2753 See this dataset in the Dataset Gallery for more info.
2754
2755 :ref:`Emoji Texture Dataset <emoji_texture_dataset>`
2756
2757 """
2758 return _download_dataset(_dataset_emoji, load=load)
2759
2760
2761 _dataset_emoji = _SingleFileDownloadableDatasetLoader('emote.jpg')
2762
2763
2764 @_deprecate_positional_args
2765 def download_emoji_texture(load=True): # noqa: FBT002
2766 """Download emoji texture.
2767
2768 Parameters
2769 ----------
2770 load : bool, default: True
2771 Load the dataset after downloading it when ``True``. Set this
2772 to ``False`` and only the filename will be returned.
2773
2774 Returns
2775 -------
2776 output : pyvista.Texture | str
2777 DataSet or filename depending on ``load``.
2778
2779 Examples
2780 --------
2781 >>> from pyvista import examples
2782 >>> dataset = examples.download_emoji_texture()
2783 >>> dataset.plot(cpos='xy')
2784
2785 .. seealso::
2786
2787 :ref:`Emoji Texture Dataset <emoji_texture_dataset>`
2788 See this dataset in the Dataset Gallery for more info.
2789
2790 :ref:`Emoji Dataset <emoji_dataset>`
2791
2792 """
2793 return _download_dataset(_dataset_emoji_texture, load=load)
2794
2795
2796 _dataset_emoji_texture = _SingleFileDownloadableDatasetLoader('emote.jpg', read_func=read_texture)
2797
2798
2799 @_deprecate_positional_args
2800 def download_teapot(load=True): # noqa: FBT002
2801 """Download teapot dataset.
2802
2803 The `Utah Teapot <https://en.wikipedia.org/wiki/Utah_teapot>`_,
2804 originally modeled by Martin Newell at the University of Utah in
2805 1975. The specific mesh distributed here was tessellated by Martin
2806 Isenburg (UNC Chapel Hill) for Isenburg and Snoeyink, "Face Fixer:
2807 Compressing Polygon Meshes with Properties" (SIGGRAPH 2000).
2808
2809 No formal license has ever been issued for the original Newell
2810 dataset. The model has been freely distributed in computer graphics
2811 software for 50 years and is conventionally treated as public domain.
2812
2813 Parameters
2814 ----------
2815 load : bool, default: True
2816 Load the dataset after downloading it when ``True``. Set this
2817 to ``False`` and only the filename will be returned.
2818
2819 Returns
2820 -------
2821 output : pyvista.PolyData | str
2822 DataSet or filename depending on ``load``.
2823
2824 Examples
2825 --------
2826 >>> from pyvista import examples
2827 >>> dataset = examples.download_teapot()
2828 >>> dataset.plot(cpos='xy')
2829
2830 .. seealso::
2831
2832 :ref:`Teapot Dataset <teapot_dataset>`
2833 See this dataset in the Dataset Gallery for more info.
2834
2835 This dataset is used in the following examples:
2836
2837 * :ref:`read_file_example`
2838 * :ref:`cell_centers_example`
2839
2840 """
2841 return _download_dataset(_dataset_teapot, load=load)
2842
2843
2844 _dataset_teapot = _SingleFileDownloadableDatasetLoader('teapot.g')
2845
2846
2847 @_deprecate_positional_args
2848 def download_brain(load=True): # noqa: FBT002
2849 """Download brain dataset.
2850
2851 Parameters
2852 ----------
2853 load : bool, default: True
2854 Load the dataset after downloading it when ``True``. Set this
2855 to ``False`` and only the filename will be returned.
2856
2857 Returns
2858 -------
2859 output : pyvista.ImageData | str
2860 DataSet or filename depending on ``load``.
2861
2862 Examples
2863 --------
2864 >>> from pyvista import examples
2865 >>> dataset = examples.download_brain()
2866 >>> dataset.plot(volume=True)
2867
2868 .. seealso::
2869
2870 :ref:`Brain Dataset <brain_dataset>`
2871 See this dataset in the Dataset Gallery for more info.
2872
2873 :ref:`Brain Atlas With Sides Dataset <brain_atlas_with_sides_dataset>`
2874
2875 :ref:`medical_dataset_gallery`
2876 Browse other medical datasets.
2877
2878 This dataset is used in the following examples:
2879
2880 * :ref:`gaussian_smoothing_example`
2881 * :ref:`slice_example`
2882 * :ref:`depth_peeling_example`
2883 * :ref:`moving_isovalue_example`
2884 * :ref:`plane_widget_example`
2885
2886 """
2887 return _download_dataset(_dataset_brain, load=load)
2888
2889
2890 _dataset_brain = _SingleFileDownloadableDatasetLoader('brain.vtk')
2891
2892
2893 def download_frd(*, load=True):
2894 """Download a sample CalculiX FRD file.
2895
2896 .. versionadded:: 0.48
2897
2898 Parameters
2899 ----------
2900 load : bool, default: True
2901 Load the dataset. When ``False``, return the path to the file.
2902
2903 Returns
2904 -------
2905 pyvista.UnstructuredGrid | str
2906 Dataset or path to the file depending on the ``load`` parameter.
2907
2908 Examples
2909 --------
2910 >>> from pyvista import examples
2911 >>> dataset = examples.download_frd()
2912 >>> dataset.plot()
2913
2914 .. seealso::
2915
2916 :ref:`Frd Dataset <frd_dataset>`
2917 See this dataset in the Dataset Gallery for more info.
2918
2919 :ref:`calculix_colormap_example`
2920 Example of how to recreate the default ``cgx`` (CalculiX GraphiX) colormap.
2921
2922 """
2923 return _download_dataset(_dataset_frd, load=load)
2924
2925
2926 _dataset_frd = _SingleFileDownloadableDatasetLoader('mesh.frd')
2927
2928
2929 @_deprecate_positional_args
2930 def download_structured_grid(load=True): # noqa: FBT002
2931 """Download structured grid dataset.
2932
2933 Parameters
2934 ----------
2935 load : bool, default: True
2936 Load the dataset after downloading it when ``True``. Set this
2937 to ``False`` and only the filename will be returned.
2938
2939 Returns
2940 -------
2941 output : pyvista.StructuredGrid | str
2942 DataSet or filename depending on ``load``.
2943
2944 Examples
2945 --------
2946 >>> from pyvista import examples
2947 >>> dataset = examples.download_structured_grid()
2948 >>> dataset.plot(show_edges=True)
2949
2950 .. seealso::
2951
2952 :ref:`Structured Grid Dataset <structured_grid_dataset>`
2953 See this dataset in the Dataset Gallery for more info.
2954
2955 :ref:`Structured Grid Two Dataset <structured_grid_two_dataset>`
2956
2957 """
2958 return _download_dataset(_dataset_structured_grid, load=load)
2959
2960
2961 _dataset_structured_grid = _SingleFileDownloadableDatasetLoader('StructuredGrid.vts')
2962
2963
2964 @_deprecate_positional_args
2965 def download_structured_grid_two(load=True): # noqa: FBT002
2966 """Download structured grid two dataset.
2967
2968 Parameters
2969 ----------
2970 load : bool, default: True
2971 Load the dataset after downloading it when ``True``. Set this
2972 to ``False`` and only the filename will be returned.
2973
2974 Returns
2975 -------
2976 output : pyvista.StructuredGrid | str
2977 DataSet or filename depending on ``load``.
2978
2979 Examples
2980 --------
2981 >>> from pyvista import examples
2982 >>> dataset = examples.download_structured_grid_two()
2983 >>> dataset.plot(show_edges=True)
2984
2985 .. seealso::
2986
2987 :ref:`Structured Grid Two Dataset <structured_grid_two_dataset>`
2988 See this dataset in the Dataset Gallery for more info.
2989
2990 :ref:`Structured Grid Dataset <structured_grid_dataset>`
2991
2992 """
2993 return _download_dataset(_dataset_structured_grid_two, load=load)
2994
2995
2996 _dataset_structured_grid_two = _SingleFileDownloadableDatasetLoader('SampleStructGrid.vtk')
2997
2998
2999 @_deprecate_positional_args
3000 def download_trumpet(load=True): # noqa: FBT002
3001 """Download trumpet dataset.
3002
3003 Parameters
3004 ----------
3005 load : bool, default: True
3006 Load the dataset after downloading it when ``True``. Set this
3007 to ``False`` and only the filename will be returned.
3008
3009 Returns
3010 -------
3011 output : pyvista.PolyData | str
3012 DataSet or filename depending on ``load``.
3013
3014 Examples
3015 --------
3016 >>> from pyvista import examples
3017 >>> dataset = examples.download_trumpet()
3018 >>> dataset.plot()
3019
3020 .. seealso::
3021
3022 :ref:`Trumpet Dataset <trumpet_dataset>`
3023 See this dataset in the Dataset Gallery for more info.
3024
3025 :ref:`Guitar Dataset <guitar_dataset>`
3026
3027 """
3028 return _download_dataset(_dataset_trumpet, load=load)
3029
3030
3031 _dataset_trumpet = _SingleFileDownloadableDatasetLoader('trumpet.obj')
3032
3033
3034 @_deprecate_positional_args
3035 def download_face(load=True): # noqa: FBT002
3036 """Download face dataset.
3037
3038 Parameters
3039 ----------
3040 load : bool, default: True
3041 Load the dataset after downloading it when ``True``. Set this
3042 to ``False`` and only the filename will be returned.
3043
3044 Returns
3045 -------
3046 output : pyvista.PolyData | str
3047 DataSet or filename depending on ``load``.
3048
3049 Examples
3050 --------
3051 >>> from pyvista import examples
3052 >>> dataset = examples.download_face()
3053 >>> dataset.plot()
3054
3055 .. seealso::
3056
3057 :ref:`Face Dataset <face_dataset>`
3058 See this dataset in the Dataset Gallery for more info.
3059
3060 :ref:`Face2 Dataset <face2_dataset>`
3061
3062 :ref:`decimate_example`
3063 Example using this dataset.
3064
3065 """
3066 # TODO: there is a texture with this
3067 return _download_dataset(_dataset_face, load=load)
3068
3069
3070 _dataset_face = _SingleFileDownloadableDatasetLoader('fran_cut.vtk')
3071
3072
3073 @_deprecate_positional_args
3074 def download_sky_box_nz(load=True): # noqa: FBT002
3075 """Download skybox-nz dataset.
3076
3077 Parameters
3078 ----------
3079 load : bool, default: True
3080 Load the dataset after downloading it when ``True``. Set this
3081 to ``False`` and only the filename will be returned.
3082
3083 Returns
3084 -------
3085 output : pyvista.ImageData | str
3086 DataSet or filename depending on ``load``.
3087
3088 Examples
3089 --------
3090 >>> from pyvista import examples
3091 >>> dataset = examples.download_sky_box_nz()
3092 >>> dataset.plot(rgba=True, cpos='xy')
3093
3094 .. seealso::
3095
3096 :ref:`Sky Box Nz Dataset <sky_box_nz_dataset>`
3097 See this dataset in the Dataset Gallery for more info.
3098
3099 :ref:`Sky Box Nz Texture Dataset <sky_box_nz_texture_dataset>`
3100
3101 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
3102
3103 """
3104 return _download_dataset(_dataset_sky_box_nz, load=load)
3105
3106
3107 _dataset_sky_box_nz = _SingleFileDownloadableDatasetLoader('skybox-nz.jpg')
3108
3109
3110 @_deprecate_positional_args
3111 def download_sky_box_nz_texture(load=True): # noqa: FBT002
3112 """Download skybox-nz texture.
3113
3114 Parameters
3115 ----------
3116 load : bool, default: True
3117 Load the dataset after downloading it when ``True``. Set this
3118 to ``False`` and only the filename will be returned.
3119
3120 Returns
3121 -------
3122 output : pyvista.Texture | str
3123 DataSet or filename depending on ``load``.
3124
3125 Examples
3126 --------
3127 >>> from pyvista import examples
3128 >>> dataset = examples.download_sky_box_nz_texture()
3129 >>> dataset.plot(cpos='xy')
3130
3131 .. seealso::
3132
3133 :ref:`Sky Box Nz Texture Dataset <sky_box_nz_texture_dataset>`
3134 See this dataset in the Dataset Gallery for more info.
3135
3136 :ref:`Sky Box Nz Dataset <sky_box_nz_dataset>`
3137
3138 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
3139
3140 """
3141 return _download_dataset(_dataset_sky_box_nz_texture, load=load)
3142
3143
3144 _dataset_sky_box_nz_texture = _SingleFileDownloadableDatasetLoader(
3145 'skybox-nz.jpg',
3146 read_func=read_texture,
3147 )
3148
3149
3150 @_deprecate_positional_args
3151 def download_disc_quads(load=True): # noqa: FBT002
3152 """Download disc quads dataset.
3153
3154 Parameters
3155 ----------
3156 load : bool, default: True
3157 Load the dataset after downloading it when ``True``. Set this
3158 to ``False`` and only the filename will be returned.
3159
3160 Returns
3161 -------
3162 output : pyvista.UnstructuredGrid | str
3163 DataSet or filename depending on ``load``.
3164
3165 Examples
3166 --------
3167 >>> from pyvista import examples
3168 >>> dataset = examples.download_disc_quads()
3169 >>> dataset.plot(show_edges=True)
3170
3171 .. seealso::
3172
3173 :ref:`Disc Quads Dataset <disc_quads_dataset>`
3174 See this dataset in the Dataset Gallery for more info.
3175
3176 """
3177 return _download_dataset(_dataset_disc_quads, load=load)
3178
3179
3180 _dataset_disc_quads = _SingleFileDownloadableDatasetLoader('Disc_BiQuadraticQuads_0_0.vtu')
3181
3182
3183 @_deprecate_positional_args
3184 def download_honolulu(load=True): # noqa: FBT002
3185 """Download honolulu dataset.
3186
3187 Parameters
3188 ----------
3189 load : bool, default: True
3190 Load the dataset after downloading it when ``True``. Set this
3191 to ``False`` and only the filename will be returned.
3192
3193 Returns
3194 -------
3195 output : pyvista.PolyData | str
3196 DataSet or filename depending on ``load``.
3197
3198 Examples
3199 --------
3200 >>> from pyvista import examples
3201 >>> dataset = examples.download_honolulu()
3202 >>> dataset.plot(
3203 ... scalars=dataset.points[:, 2],
3204 ... show_scalar_bar=False,
3205 ... cmap='gist_earth',
3206 ... clim=[-50, 800],
3207 ... )
3208
3209 .. seealso::
3210
3211 :ref:`Honolulu Dataset <honolulu_dataset>`
3212 See this dataset in the Dataset Gallery for more info.
3213
3214 """
3215 return _download_dataset(_dataset_honolulu, load=load)
3216
3217
3218 _dataset_honolulu = _SingleFileDownloadableDatasetLoader('honolulu.vtk')
3219
3220
3221 @_deprecate_positional_args
3222 def download_motor(load=True): # noqa: FBT002
3223 """Download motor dataset.
3224
3225 Parameters
3226 ----------
3227 load : bool, default: True
3228 Load the dataset after downloading it when ``True``. Set this
3229 to ``False`` and only the filename will be returned.
3230
3231 Returns
3232 -------
3233 output : pyvista.PolyData | str
3234 DataSet or filename depending on ``load``.
3235
3236 Examples
3237 --------
3238 >>> from pyvista import examples
3239 >>> dataset = examples.download_motor()
3240 >>> dataset.plot()
3241
3242 .. seealso::
3243
3244 :ref:`Motor Dataset <motor_dataset>`
3245 See this dataset in the Dataset Gallery for more info.
3246
3247 """
3248 return _download_dataset(_dataset_motor, load=load)
3249
3250
3251 _dataset_motor = _SingleFileDownloadableDatasetLoader('motor.g')
3252
3253
3254 @_deprecate_positional_args
3255 def download_tri_quadratic_hexahedron(load=True): # noqa: FBT002
3256 """Download tri quadratic hexahedron dataset.
3257
3258 Parameters
3259 ----------
3260 load : bool, default: True
3261 Load the dataset after downloading it when ``True``. Set this
3262 to ``False`` and only the filename will be returned.
3263
3264 Returns
3265 -------
3266 output : pyvista.UnstructuredGrid | str
3267 DataSet or filename depending on ``load``.
3268
3269 Examples
3270 --------
3271 >>> from pyvista import examples
3272 >>> dataset = examples.download_tri_quadratic_hexahedron()
3273 >>> dataset.plot()
3274
3275 Show non-linear subdivision.
3276
3277 >>> surf = dataset.extract_surface(algorithm=None, nonlinear_subdivision=5)
3278 >>> surf.plot(smooth_shading=True)
3279
3280 .. seealso::
3281
3282 :ref:`Tri Quadratic Hexahedron Dataset <tri_quadratic_hexahedron_dataset>`
3283 See this dataset in the Dataset Gallery for more info.
3284
3285 """
3286 return _download_dataset(_dataset_tri_quadratic_hexahedron, load=load)
3287
3288
3289 def _tri_quadratic_hexahedron_load_func(dataset):
3290 dataset.clear_data()
3291 return dataset
3292
3293
3294 _dataset_tri_quadratic_hexahedron = _SingleFileDownloadableDatasetLoader(
3295 'TriQuadraticHexahedron.vtu',
3296 load_func=_tri_quadratic_hexahedron_load_func,
3297 )
3298
3299
3300 @_deprecate_positional_args
3301 def download_human(load=True): # noqa: FBT002
3302 """Download human dataset.
3303
3304 Parameters
3305 ----------
3306 load : bool, default: True
3307 Load the dataset after downloading it when ``True``. Set this
3308 to ``False`` and only the filename will be returned.
3309
3310 Returns
3311 -------
3312 output : pyvista.PolyData | str
3313 DataSet or filename depending on ``load``.
3314
3315 Examples
3316 --------
3317 >>> from pyvista import examples
3318 >>> dataset = examples.download_human()
3319 >>> dataset.plot(scalars='Color', rgb=True)
3320
3321 .. seealso::
3322
3323 :ref:`Human Dataset <human_dataset>`
3324 See this dataset in the Dataset Gallery for more info.
3325
3326 """
3327 return _download_dataset(_dataset_human, load=load)
3328
3329
3330 _dataset_human = _SingleFileDownloadableDatasetLoader('Human.vtp')
3331
3332
3333 @_deprecate_positional_args
3334 def download_vtk(load=True): # noqa: FBT002
3335 """Download vtk dataset.
3336
3337 Parameters
3338 ----------
3339 load : bool, default: True
3340 Load the dataset after downloading it when ``True``. Set this
3341 to ``False`` and only the filename will be returned.
3342
3343 Returns
3344 -------
3345 output : pyvista.PolyData | str
3346 DataSet or filename depending on ``load``.
3347
3348 Examples
3349 --------
3350 >>> from pyvista import examples
3351 >>> dataset = examples.download_vtk()
3352 >>> dataset.plot(cpos='xy', line_width=5)
3353
3354 .. seealso::
3355
3356 :ref:`Vtk Dataset <vtk_dataset>`
3357 See this dataset in the Dataset Gallery for more info.
3358
3359 :ref:`Vtk Logo Dataset <vtk_logo_dataset>`
3360
3361 """
3362 return _download_dataset(_dataset_vtk, load=load)
3363
3364
3365 _dataset_vtk = _SingleFileDownloadableDatasetLoader('vtk.vtp')
3366
3367
3368 @_deprecate_positional_args
3369 def download_spider(load=True): # noqa: FBT002
3370 """Download spider dataset.
3371
3372 Parameters
3373 ----------
3374 load : bool, default: True
3375 Load the dataset after downloading it when ``True``. Set this
3376 to ``False`` and only the filename will be returned.
3377
3378 Returns
3379 -------
3380 output : pyvista.PolyData | str
3381 DataSet or filename depending on ``load``.
3382
3383 Examples
3384 --------
3385 >>> from pyvista import examples
3386 >>> dataset = examples.download_spider()
3387 >>> dataset.plot()
3388
3389 .. seealso::
3390
3391 :ref:`Spider Dataset <spider_dataset>`
3392 See this dataset in the Dataset Gallery for more info.
3393
3394 """
3395 return _download_dataset(_dataset_spider, load=load)
3396
3397
3398 _dataset_spider = _SingleFileDownloadableDatasetLoader('spider.ply')
3399
3400
3401 @_deprecate_positional_args
3402 def download_carotid(load=True): # noqa: FBT002
3403 """Download carotid dataset.
3404
3405 Parameters
3406 ----------
3407 load : bool, default: True
3408 Load the dataset after downloading it when ``True``. Set this
3409 to ``False`` and only the filename will be returned.
3410
3411 Returns
3412 -------
3413 output : pyvista.ImageData | str
3414 DataSet or filename depending on ``load``.
3415
3416 Examples
3417 --------
3418 >>> from pyvista import examples
3419 >>> import pyvista as pv
3420 >>> cpos = pv.CameraPosition(
3421 ... position=(220.96, -24.38, -69.96),
3422 ... focal_point=(135.86, 106.55, 17.72),
3423 ... viewup=(-0.25, 0.42, -0.87),
3424 ... )
3425 >>> dataset = examples.download_carotid()
3426 >>> dataset.plot(volume=True, cpos=cpos)
3427
3428 .. seealso::
3429
3430 :ref:`Carotid Dataset <carotid_dataset>`
3431 See this dataset in the Dataset Gallery for more info.
3432
3433 :ref:`medical_dataset_gallery`
3434 Browse other medical datasets.
3435
3436 This dataset is used in the following examples:
3437
3438 * :ref:`glyph_example`
3439 * :ref:`gradients_example`
3440 * :ref:`streamlines_example`
3441 * :ref:`plane_widget_example`
3442 * :ref:`compare_threshold_filters_example`
3443
3444 """
3445 return _download_dataset(_dataset_carotid, load=load)
3446
3447
3448 def _carotid_load_func(mesh):
3449 mesh.set_active_scalars('scalars')
3450 mesh.set_active_vectors('vectors')
3451 return mesh
3452
3453
3454 _dataset_carotid = _SingleFileDownloadableDatasetLoader(
3455 'carotid.vtk', load_func=_carotid_load_func
3456 )
3457
3458
3459 @_deprecate_positional_args
3460 def download_blow(load=True): # noqa: FBT002
3461 """Download blow dataset.
3462
3463 Parameters
3464 ----------
3465 load : bool, default: True
3466 Load the dataset after downloading it when ``True``. Set this
3467 to ``False`` and only the filename will be returned.
3468
3469 Returns
3470 -------
3471 output : pyvista.UnstructuredGrid | str
3472 DataSet or filename depending on ``load``.
3473
3474 Examples
3475 --------
3476 >>> from pyvista import examples
3477 >>> import pyvista as pv
3478 >>> cpos = pv.CameraPosition(
3479 ... position=(71.96, 86.1, 28.45),
3480 ... focal_point=(3.5, 12.0, 1.0),
3481 ... viewup=(-0.18, -0.19, 0.96),
3482 ... )
3483 >>> dataset = examples.download_blow()
3484 >>> dataset.plot(
3485 ... scalars='displacement1',
3486 ... component=1,
3487 ... cpos=cpos,
3488 ... show_scalar_bar=False,
3489 ... smooth_shading=True,
3490 ... )
3491
3492 .. seealso::
3493
3494 :ref:`Blow Dataset <blow_dataset>`
3495 See this dataset in the Dataset Gallery for more info.
3496
3497 """
3498 return _download_dataset(_dataset_blow, load=load)
3499
3500
3501 _dataset_blow = _SingleFileDownloadableDatasetLoader('blow.vtk')
3502
3503
3504 @_deprecate_positional_args
3505 def download_shark(load=True): # noqa: FBT002
3506 """Download shark dataset.
3507
3508 Parameters
3509 ----------
3510 load : bool, default: True
3511 Load the dataset after downloading it when ``True``. Set this
3512 to ``False`` and only the filename will be returned.
3513
3514 Returns
3515 -------
3516 output : pyvista.PolyData | str
3517 DataSet or filename depending on ``load``.
3518
3519 Examples
3520 --------
3521 >>> from pyvista import examples
3522 >>> import pyvista as pv
3523 >>> cpos = pv.CameraPosition(
3524 ... position=(-2.3195e02, -3.3930e01, 1.2981e02),
3525 ... focal_point=(-8.7100e00, 1.9000e-01, -1.1740e01),
3526 ... viewup=(-1.4000e-01, 9.9000e-01, 2.0000e-02),
3527 ... )
3528 >>> dataset = examples.download_shark()
3529 >>> dataset.plot(cpos=cpos, smooth_shading=True)
3530
3531 .. seealso::
3532
3533 :ref:`Shark Dataset <shark_dataset>`
3534 See this dataset in the Dataset Gallery for more info.
3535
3536 :ref:`Great White Shark Dataset <great_white_shark_dataset>`
3537 Similar dataset.
3538
3539 :ref:`Grey Nurse Shark Dataset <grey_nurse_shark_dataset>`
3540 Similar dataset.
3541
3542 """
3543 return _download_dataset(_dataset_shark, load=load)
3544
3545
3546 _dataset_shark = _SingleFileDownloadableDatasetLoader('shark.ply')
3547
3548
3549 @_deprecate_positional_args
3550 def download_great_white_shark(load=True): # noqa: FBT002
3551 """Download great white shark dataset.
3552
3553 .. versionadded:: 0.45
3554
3555 .. note::
3556
3557 The origin and license of this model could not be definitively
3558 established. The file was imported from the `VTK Examples test
3559 data repository
3560 <https://gitlab.kitware.com/vtk/vtk-examples/-/blob/master/src/Testing/Data/greatWhite.stl>`_,
3561 which does not document its source. Use with caution in
3562 redistributed or commercial contexts.
3563
3564 Parameters
3565 ----------
3566 load : bool, default: True
3567 Load the dataset after downloading it when ``True``. Set this
3568 to ``False`` and only the filename will be returned.
3569
3570 Returns
3571 -------
3572 output : pyvista.PolyData | str
3573 DataSet or filename depending on ``load``.
3574
3575 Examples
3576 --------
3577 >>> from pyvista import examples
3578 >>> import pyvista as pv
3579 >>> cpos = pv.CameraPosition(
3580 ... position=(9.0, 1.0, 21.0),
3581 ... focal_point=(-1.0, 2.0, -2.0),
3582 ... viewup=(0.0, 1.0, 0.0),
3583 ... )
3584 >>> dataset = examples.download_great_white_shark()
3585 >>> dataset.plot(cpos=cpos, smooth_shading=True)
3586
3587 .. seealso::
3588
3589 :ref:`Great White Shark Dataset <great_white_shark_dataset>`
3590 See this dataset in the Dataset Gallery for more info.
3591
3592 :ref:`Shark Dataset <shark_dataset>`
3593 Similar dataset.
3594
3595 :ref:`Grey Nurse Shark Dataset <grey_nurse_shark_dataset>`
3596 Similar dataset.
3597
3598 """
3599 return _download_dataset(_dataset_great_white_shark, load=load)
3600
3601
3602 _dataset_great_white_shark = _SingleFileDownloadableDatasetLoader(
3603 'great_white_shark/greatWhite.stl'
3604 )
3605
3606
3607 @_deprecate_positional_args
3608 def download_grey_nurse_shark(load=True): # noqa: FBT002
3609 """Download grey nurse shark dataset.
3610
3611 .. versionadded:: 0.45
3612
3613 Model by `rogerpeng1 on Thingiverse
3614 <https://www.thingiverse.com/thing:137954>`_, licensed under
3615 `Creative Commons Attribution-ShareAlike (CC BY-SA 3.0)
3616 <https://creativecommons.org/licenses/by-sa/3.0/>`_.
3617
3618 .. note::
3619
3620 The ShareAlike clause requires derivative works to be distributed
3621 under the same license. Incorporating this mesh into a proprietary
3622 or differently-licensed work may be restricted.
3623
3624 Required attribution: *Grey Nurse Shark by rogerpeng1
3625 (thingiverse.com/thing:137954), licensed under CC BY-SA.*
3626
3627 Parameters
3628 ----------
3629 load : bool, default: True
3630 Load the dataset after downloading it when ``True``. Set this
3631 to ``False`` and only the filename will be returned.
3632
3633 Returns
3634 -------
3635 output : pyvista.PolyData | str
3636 DataSet or filename depending on ``load``.
3637
3638 Examples
3639 --------
3640 >>> from pyvista import examples
3641 >>> import pyvista as pv
3642 >>> cpos = pv.CameraPosition(
3643 ... position=(-200, -100, -16.0),
3644 ... focal_point=(-20.0, 20.0, -2.00),
3645 ... viewup=(0.00, 0.00, 1.00),
3646 ... )
3647 >>> dataset = examples.download_grey_nurse_shark()
3648 >>> dataset.plot(cpos=cpos, smooth_shading=True)
3649
3650 .. seealso::
3651
3652 :ref:`Grey Nurse Shark Dataset <grey_nurse_shark_dataset>`
3653 See this dataset in the Dataset Gallery for more info.
3654
3655 :ref:`Shark Dataset <shark_dataset>`
3656 Similar dataset.
3657
3658 :ref:`Great White Shark Dataset <great_white_shark_dataset>`
3659 Similar dataset.
3660
3661 """
3662 return _download_dataset(_dataset_grey_nurse_shark, load=load)
3663
3664
3665 _dataset_grey_nurse_shark = _SingleFileDownloadableDatasetLoader(
3666 'grey_nurse_shark/Grey_Nurse_Shark.stl'
3667 )
3668
3669
3670 @_deprecate_positional_args
3671 def download_dragon(load=True): # noqa: FBT002
3672 """Download dragon dataset.
3673
3674 Parameters
3675 ----------
3676 load : bool, default: True
3677 Load the dataset after downloading it when ``True``. Set this
3678 to ``False`` and only the filename will be returned.
3679
3680 Returns
3681 -------
3682 output : pyvista.PolyData | str
3683 DataSet or filename depending on ``load``.
3684
3685 Examples
3686 --------
3687 >>> from pyvista import examples
3688 >>> dataset = examples.download_dragon()
3689 >>> dataset.plot(cpos='xy')
3690
3691 .. seealso::
3692
3693 :ref:`Dragon Dataset <dragon_dataset>`
3694 See this dataset in the Dataset Gallery for more info.
3695
3696 This dataset is used in the following examples:
3697
3698 * :ref:`floors_example`
3699 * :ref:`orbit_example`
3700 * :ref:`silhouette_example`
3701 * :ref:`shadows_example`
3702
3703 """
3704 return _download_dataset(_dataset_dragon, load=load)
3705
3706
3707 _dataset_dragon = _SingleFileDownloadableDatasetLoader('dragon.ply')
3708
3709
3710 @_deprecate_positional_args
3711 def download_armadillo(load=True): # noqa: FBT002
3712 """Download armadillo dataset.
3713
3714 Parameters
3715 ----------
3716 load : bool, default: True
3717 Load the dataset after downloading it when ``True``. Set this
3718 to ``False`` and only the filename will be returned.
3719
3720 Returns
3721 -------
3722 output : pyvista.PolyData | str
3723 DataSet or filename depending on ``load``.
3724
3725 Examples
3726 --------
3727 Plot the armadillo dataset. Use a custom camera position.
3728
3729 >>> from pyvista import examples
3730 >>> import pyvista as pv
3731 >>> cpos = pv.CameraPosition(
3732 ... position=(161.5, 82.1, -330.2),
3733 ... focal_point=(-4.3, 24.5, -1.6),
3734 ... viewup=(-0.1, 1, 0.12),
3735 ... )
3736 >>> dataset = examples.download_armadillo()
3737 >>> dataset.plot(cpos=cpos)
3738
3739 .. seealso::
3740
3741 :ref:`Armadillo Dataset <armadillo_dataset>`
3742 See this dataset in the Dataset Gallery for more info.
3743
3744 """
3745 return _download_dataset(_dataset_armadillo, load=load)
3746
3747
3748 _dataset_armadillo = _SingleFileDownloadableDatasetLoader('Armadillo.ply')
3749
3750
3751 @_deprecate_positional_args
3752 def download_gears(load=True): # noqa: FBT002
3753 """Download gears dataset.
3754
3755 Parameters
3756 ----------
3757 load : bool, default: True
3758 Load the dataset after downloading it when ``True``. Set this
3759 to ``False`` and only the filename will be returned.
3760
3761 Returns
3762 -------
3763 output : pyvista.PolyData | str
3764 DataSet or filename depending on ``load``.
3765
3766 Examples
3767 --------
3768 Download the dataset, split the bodies, and color each one.
3769
3770 >>> import numpy as np
3771 >>> from pyvista import examples
3772 >>> dataset = examples.download_gears()
3773 >>> bodies = dataset.split_bodies()
3774 >>> for i, body in enumerate(bodies):
3775 ... bid = np.empty(body.n_points)
3776 ... bid[:] = i
3777 ... body.point_data['Body ID'] = bid
3778 >>> bodies.plot(cmap='jet')
3779
3780 .. seealso::
3781
3782 :ref:`Gears Dataset <gears_dataset>`
3783 See this dataset in the Dataset Gallery for more info.
3784
3785 """
3786 return _download_dataset(_dataset_gears, load=load)
3787
3788
3789 _dataset_gears = _SingleFileDownloadableDatasetLoader('gears.stl')
3790
3791
3792 @_deprecate_positional_args
3793 def download_torso(load=True): # noqa: FBT002
3794 """Download torso dataset.
3795
3796 Parameters
3797 ----------
3798 load : bool, default: True
3799 Load the dataset after downloading it when ``True``. Set this
3800 to ``False`` and only the filename will be returned.
3801
3802 Returns
3803 -------
3804 output : pyvista.PolyData | str
3805 DataSet or filename depending on ``load``.
3806
3807 Examples
3808 --------
3809 >>> from pyvista import examples
3810 >>> dataset = examples.download_torso()
3811 >>> dataset.plot(cpos='xz')
3812
3813 .. seealso::
3814
3815 :ref:`Torso Dataset <torso_dataset>`
3816 See this dataset in the Dataset Gallery for more info.
3817
3818 """
3819 return _download_dataset(_dataset_torso, load=load)
3820
3821
3822 _dataset_torso = _SingleFileDownloadableDatasetLoader('Torso.vtp')
3823
3824
3825 @_deprecate_positional_args
3826 def download_kitchen(split=False, load=True): # noqa: FBT002
3827 """Download structured grid of kitchen with velocity field.
3828
3829 Use the ``split`` argument to extract all of the furniture in the
3830 kitchen.
3831
3832 Parameters
3833 ----------
3834 split : bool, default: False
3835 Optionally split the furniture and return a
3836 :class:`pyvista.MultiBlock`.
3837
3838 load : bool, default: True
3839 Load the dataset after downloading it when ``True``. Set this
3840 to ``False`` and only the filename will be returned.
3841
3842 Returns
3843 -------
3844 output : pyvista.StructuredGrid | str
3845 DataSet or filename depending on ``load``.
3846
3847 Examples
3848 --------
3849 >>> import pyvista as pv
3850 >>> from pyvista import examples
3851 >>> dataset = examples.download_kitchen()
3852 >>> point_a = (0.08, 2.50, 0.71)
3853 >>> point_b = (0.08, 4.50, 0.71)
3854 >>> line = pv.Line(point_a, point_b, resolution=39)
3855 >>> streamlines = dataset.streamlines_from_source(line, max_length=200)
3856 >>> streamlines.plot(show_grid=True)
3857
3858 .. seealso::
3859
3860 :ref:`Kitchen Dataset <kitchen_dataset>`
3861 See this dataset in the Dataset Gallery for more info.
3862
3863 This dataset is used in the following examples:
3864
3865 * :ref:`plot_over_line_example`
3866 * :ref:`line_widget_example`
3867
3868 """
3869 if load and split:
3870 return _download_dataset(__kitchen_split, load=load)
3871 else:
3872 return _download_dataset(_dataset_kitchen, load=load)
3873
3874
3875 def _kitchen_split_load_func(mesh):
3876 extents = {
3877 'door': (27, 27, 14, 18, 0, 11),
3878 'window1': (0, 0, 9, 18, 6, 12),
3879 'window2': (5, 12, 23, 23, 6, 12),
3880 'klower1': (17, 17, 0, 11, 0, 6),
3881 'klower2': (19, 19, 0, 11, 0, 6),
3882 'klower3': (17, 19, 0, 0, 0, 6),
3883 'klower4': (17, 19, 11, 11, 0, 6),
3884 'klower5': (17, 19, 0, 11, 0, 0),
3885 'klower6': (17, 19, 0, 7, 6, 6),
3886 'klower7': (17, 19, 9, 11, 6, 6),
3887 'hood1': (17, 17, 0, 11, 11, 16),
3888 'hood2': (19, 19, 0, 11, 11, 16),
3889 'hood3': (17, 19, 0, 0, 11, 16),
3890 'hood4': (17, 19, 11, 11, 11, 16),
3891 'hood5': (17, 19, 0, 11, 16, 16),
3892 'cookingPlate': (17, 19, 7, 9, 6, 6),
3893 'furniture': (17, 19, 7, 9, 11, 11),
3894 }
3895 kitchen = pv.MultiBlock()
3896 for key, extent in extents.items():
3897 alg = _vtk.vtkStructuredGridGeometryFilter()
3898 alg.SetInputDataObject(mesh)
3899 alg.SetExtent(extent) # type: ignore[call-overload]
3900 alg.Update()
3901 result = _get_output(alg)
3902 kitchen[key] = result
3903 return kitchen
3904
3905
3906 _dataset_kitchen = _SingleFileDownloadableDatasetLoader('kitchen.vtk')
3907 __kitchen_split = _SingleFileDownloadableDatasetLoader(
3908 'kitchen.vtk',
3909 load_func=_kitchen_split_load_func,
3910 )
3911
3912
3913 @_deprecate_positional_args
3914 def download_tetra_dc_mesh(load=True): # noqa: FBT002
3915 """Download two meshes defining an electrical inverse problem.
3916
3917 This contains a high resolution forward modeled mesh and a coarse
3918 inverse modeled mesh.
3919
3920 Parameters
3921 ----------
3922 load : bool, default: True
3923 Load the dataset after downloading it when ``True``. Set this
3924 to ``False`` and only the filename will be returned.
3925
3926 Returns
3927 -------
3928 pyvista.MultiBlock
3929 DataSet containing the high resolution forward modeled mesh
3930 and a coarse inverse modeled mesh.
3931
3932 Examples
3933 --------
3934 >>> from pyvista import examples
3935 >>> fine, coarse = examples.download_tetra_dc_mesh()
3936 >>> coarse.plot()
3937
3938 .. seealso::
3939
3940 :ref:`Tetra Dc Mesh Dataset <tetra_dc_mesh_dataset>`
3941 See this dataset in the Dataset Gallery for more info.
3942
3943 """
3944 return _download_dataset(_dataset_tetra_dc_mesh, load=load)
3945
3946
3947 def _tetra_dc_mesh_files_func():
3948 def _fwd_load_func(mesh):
3949 mesh.set_active_scalars('Resistivity(log10)-fwd')
3950 return mesh
3951
3952 def _inv_load_func(mesh):
3953 mesh.set_active_scalars('Resistivity(log10)')
3954 return mesh
3955
3956 fwd = _SingleFileDownloadableDatasetLoader(
3957 'dc-inversion.zip',
3958 target_file='mesh-forward.vtu',
3959 load_func=_fwd_load_func,
3960 )
3961 inv = _SingleFileDownloadableDatasetLoader(
3962 'dc-inversion.zip',
3963 target_file='mesh-inverse.vtu',
3964 load_func=_inv_load_func,
3965 )
3966 return fwd, inv
3967
3968
3969 _dataset_tetra_dc_mesh = _MultiFileDownloadableDatasetLoader(
3970 _tetra_dc_mesh_files_func,
3971 load_func=functools.partial(_load_as_multiblock, names=['forward', 'inverse']),
3972 )
3973
3974
3975 @_deprecate_positional_args
3976 def download_model_with_variance(load=True): # noqa: FBT002
3977 """Download model with variance dataset.
3978
3979 Parameters
3980 ----------
3981 load : bool, default: True
3982 Load the dataset after downloading it when ``True``. Set this
3983 to ``False`` and only the filename will be returned.
3984
3985 Returns
3986 -------
3987 output : pyvista.UnstructuredGrid | str
3988 DataSet or filename depending on ``load``.
3989
3990 Examples
3991 --------
3992 >>> from pyvista import examples
3993 >>> dataset = examples.download_model_with_variance()
3994 >>> dataset.plot()
3995
3996 .. seealso::
3997
3998 :ref:`Model With Variance Dataset <model_with_variance_dataset>`
3999 See this dataset in the Dataset Gallery for more info.
4000
4001 :ref:`opacity_example`
4002 Example using this dataset.
4003
4004 """
4005 return _download_dataset(_dataset_model_with_variance, load=load)
4006
4007
4008 _dataset_model_with_variance = _SingleFileDownloadableDatasetLoader('model_with_variance.vtu')
4009
4010
4011 @_deprecate_positional_args
4012 def download_thermal_probes(load=True): # noqa: FBT002
4013 """Download thermal probes dataset.
4014
4015 Parameters
4016 ----------
4017 load : bool, default: True
4018 Load the dataset after downloading it when ``True``. Set this
4019 to ``False`` and only the filename will be returned.
4020
4021 Returns
4022 -------
4023 output : pyvista.PolyData | str
4024 DataSet or filename depending on ``load``.
4025
4026 Examples
4027 --------
4028 >>> from pyvista import examples
4029 >>> dataset = examples.download_thermal_probes()
4030 >>> dataset.plot(render_points_as_spheres=True, point_size=5, cpos='xy')
4031
4032 .. seealso::
4033
4034 :ref:`Thermal Probes Dataset <thermal_probes_dataset>`
4035 See this dataset in the Dataset Gallery for more info.
4036
4037 :ref:`interpolate_example`
4038 Example using this dataset.
4039
4040 """
4041 return _download_dataset(_dataset_thermal_probes, load=load)
4042
4043
4044 _dataset_thermal_probes = _SingleFileDownloadableDatasetLoader('probes.vtp')
4045
4046
4047 @_deprecate_positional_args
4048 def download_carburetor(load=True): # noqa: FBT002
4049 """Download scan of a carburetor.
4050
4051 Parameters
4052 ----------
4053 load : bool, default: True
4054 Load the dataset after downloading it when ``True``. Set this
4055 to ``False`` and only the filename will be returned.
4056
4057 Returns
4058 -------
4059 output : pyvista.PolyData | str
4060 DataSet or filename depending on ``load``.
4061
4062 Examples
4063 --------
4064 >>> from pyvista import examples
4065 >>> dataset = examples.download_carburetor()
4066 >>> dataset.plot()
4067
4068 .. seealso::
4069
4070 :ref:`Carburetor Dataset <carburetor_dataset>`
4071 See this dataset in the Dataset Gallery for more info.
4072
4073 """
4074 return _download_dataset(_dataset_carburetor, load=load)
4075
4076
4077 _dataset_carburetor = _SingleFileDownloadableDatasetLoader('carburetor.ply')
4078
4079
4080 @_deprecate_positional_args
4081 def download_turbine_blade(load=True): # noqa: FBT002
4082 """Download scan of a turbine blade.
4083
4084 Parameters
4085 ----------
4086 load : bool, default: True
4087 Load the dataset after downloading it when ``True``. Set this
4088 to ``False`` and only the filename will be returned.
4089
4090 Returns
4091 -------
4092 output : pyvista.PolyData | str
4093 DataSet or filename depending on ``load``.
4094
4095 Examples
4096 --------
4097 >>> from pyvista import examples
4098 >>> dataset = examples.download_turbine_blade()
4099 >>> dataset.plot()
4100
4101 .. seealso::
4102
4103 :ref:`Turbine Blade Dataset <turbine_blade_dataset>`
4104 See this dataset in the Dataset Gallery for more info.
4105
4106 """
4107 return _download_dataset(_dataset_turbine_blade, load=load)
4108
4109
4110 _dataset_turbine_blade = _SingleFileDownloadableDatasetLoader('turbineblade.ply')
4111
4112
4113 @_deprecate_positional_args
4114 def download_pine_roots(load=True): # noqa: FBT002
4115 """Download pine roots dataset.
4116
4117 Parameters
4118 ----------
4119 load : bool, default: True
4120 Load the dataset after downloading it when ``True``. Set this
4121 to ``False`` and only the filename will be returned.
4122
4123 Returns
4124 -------
4125 output : pyvista.PolyData | str
4126 DataSet or filename depending on ``load``.
4127
4128 Examples
4129 --------
4130 >>> from pyvista import examples
4131 >>> dataset = examples.download_pine_roots()
4132 >>> dataset.plot()
4133
4134 .. seealso::
4135
4136 :ref:`Pine Roots Dataset <pine_roots_dataset>`
4137 See this dataset in the Dataset Gallery for more info.
4138
4139 :ref:`connectivity_example`
4140 Example using this dataset.
4141
4142 """
4143 return _download_dataset(_dataset_pine_roots, load=load)
4144
4145
4146 _dataset_pine_roots = _SingleFileDownloadableDatasetLoader('pine_root.tri')
4147
4148
4149 @_deprecate_positional_args
4150 def download_crater_topo(load=True): # noqa: FBT002
4151 """Download crater dataset.
4152
4153 Parameters
4154 ----------
4155 load : bool, default: True
4156 Load the dataset after downloading it when ``True``. Set this
4157 to ``False`` and only the filename will be returned.
4158
4159 Returns
4160 -------
4161 output : pyvista.ImageData | str
4162 DataSet or filename depending on ``load``.
4163
4164 Examples
4165 --------
4166 .. pyvista-plot::
4167 :force_static:
4168
4169 >>> from pyvista import examples
4170 >>> dataset = examples.download_crater_topo()
4171 >>> dataset.plot(cmap='gist_earth', cpos='xy')
4172
4173 .. seealso::
4174
4175 :ref:`Crater Topo Dataset <crater_topo_dataset>`
4176 See this dataset in the Dataset Gallery for more info.
4177
4178 This dataset is used in the following examples:
4179
4180 * :ref:`terrain_following_mesh_example`
4181 * :ref:`topo_map_example`
4182
4183 """
4184 return _download_dataset(_dataset_crater_topo, load=load)
4185
4186
4187 _dataset_crater_topo = _SingleFileDownloadableDatasetLoader('Ruapehu_mag_dem_15m_NZTM.vtk')
4188
4189
4190 @_deprecate_positional_args
4191 def download_crater_imagery(load=True): # noqa: FBT002
4192 """Download crater texture.
4193
4194 Parameters
4195 ----------
4196 load : bool, default: True
4197 Load the dataset after downloading it when ``True``. Set this
4198 to ``False`` and only the filename will be returned.
4199
4200 Returns
4201 -------
4202 output : pyvista.Texture | str
4203 DataSet or filename depending on ``load``.
4204
4205 Examples
4206 --------
4207 >>> from pyvista import examples
4208 >>> import pyvista as pv
4209 >>> cpos = pv.CameraPosition(
4210 ... position=(66.0, 73.0, -382.6),
4211 ... focal_point=(66.0, 73.0, 0.0),
4212 ... viewup=(-0.0, -1.0, 0.0),
4213 ... )
4214 >>> texture = examples.download_crater_imagery()
4215 >>> texture.plot(cpos=cpos)
4216
4217 .. seealso::
4218
4219 :ref:`Crater Imagery Dataset <crater_imagery_dataset>`
4220 See this dataset in the Dataset Gallery for more info.
4221
4222 :ref:`topo_map_example`
4223 Example using this dataset.
4224
4225 """
4226 return _download_dataset(_dataset_crater_imagery, load=load)
4227
4228
4229 _dataset_crater_imagery = _SingleFileDownloadableDatasetLoader(
4230 'BJ34_GeoTifv1-04_crater_clip.tif',
4231 read_func=read_texture,
4232 )
4233
4234
4235 @_deprecate_positional_args
4236 def download_dolfin(load=True): # noqa: FBT002
4237 """Download dolfin mesh.
4238
4239 Parameters
4240 ----------
4241 load : bool, default: True
4242 Load the dataset after downloading it when ``True``. Set this
4243 to ``False`` and only the filename will be returned.
4244
4245 Returns
4246 -------
4247 output : pyvista.UnstructuredGrid | str
4248 DataSet or filename depending on ``load``.
4249
4250 Examples
4251 --------
4252 >>> from pyvista import examples
4253 >>> dataset = examples.download_dolfin()
4254 >>> dataset.plot(cpos='xy', show_edges=True)
4255
4256 .. seealso::
4257
4258 :ref:`Dolfin Dataset <dolfin_dataset>`
4259 See this dataset in the Dataset Gallery for more info.
4260
4261 :ref:`read_dolfin_example`
4262
4263 """
4264 return _download_dataset(_dataset_dolfin, load=load)
4265
4266
4267 _dataset_dolfin = _SingleFileDownloadableDatasetLoader(
4268 'dolfin_fine.xml',
4269 read_func=functools.partial(read, file_format='dolfin-xml'),
4270 )
4271
4272
4273 @_deprecate_positional_args
4274 def download_damavand_volcano(load=True): # noqa: FBT002
4275 """Download damavand volcano model.
4276
4277 Parameters
4278 ----------
4279 load : bool, default: True
4280 Load the dataset after downloading it when ``True``. Set this
4281 to ``False`` and only the filename will be returned.
4282
4283 Returns
4284 -------
4285 output : pyvista.ImageData | str
4286 DataSet or filename depending on ``load``.
4287
4288 Examples
4289 --------
4290 Load the dataset.
4291
4292 >>> from pyvista import examples
4293 >>> import pyvista as pv
4294 >>> dataset = examples.download_damavand_volcano()
4295
4296 Use :meth:`~pyvista.ImageDataFilters.resample` to downsample it before plotting.
4297
4298 >>> dataset = dataset.resample(0.5)
4299 >>> dataset.dimensions
4300 (140, 116, 85)
4301
4302 Plot it.
4303
4304 >>> cpos = pv.CameraPosition(
4305 ... position=(4.66316700e04, 4.32796241e06, -3.82467050e05),
4306 ... focal_point=(5.52532740e05, 3.98017300e06, -2.47450000e04),
4307 ... viewup=(4.10000000e-01, -2.90000000e-01, -8.60000000e-01),
4308 ... )
4309 >>> dataset.plot(cpos=cpos, cmap='reds', show_scalar_bar=False, volume=True)
4310
4311 .. seealso::
4312
4313 :ref:`Damavand Volcano Dataset <damavand_volcano_dataset>`
4314 See this dataset in the Dataset Gallery for more info.
4315
4316 :ref:`volume_rendering_example`
4317 Example using this dataset.
4318
4319 """
4320 return _download_dataset(_dataset_damavand_volcano, load=load)
4321
4322
4323 def _damavand_volcano_load_func(volume):
4324 volume.rename_array('None', 'data')
4325 return volume
4326
4327
4328 _dataset_damavand_volcano = _SingleFileDownloadableDatasetLoader(
4329 'damavand-volcano.vtk',
4330 load_func=_damavand_volcano_load_func,
4331 )
4332
4333
4334 @_deprecate_positional_args
4335 def download_delaunay_example(load=True): # noqa: FBT002
4336 """Download a pointset for the Delaunay example.
4337
4338 Parameters
4339 ----------
4340 load : bool, default: True
4341 Load the dataset after downloading it when ``True``. Set this
4342 to ``False`` and only the filename will be returned.
4343
4344 Returns
4345 -------
4346 output : pyvista.PolyData | str
4347 DataSet or filename depending on ``load``.
4348
4349 Examples
4350 --------
4351 >>> from pyvista import examples
4352 >>> dataset = examples.download_delaunay_example()
4353 >>> dataset.plot(show_edges=True)
4354
4355 .. seealso::
4356
4357 :ref:`Delaunay Example Dataset <delaunay_example_dataset>`
4358 See this dataset in the Dataset Gallery for more info.
4359
4360 """
4361 return _download_dataset(_dataset_delaunay_example, load=load)
4362
4363
4364 _dataset_delaunay_example = _SingleFileDownloadableDatasetLoader('250.vtk')
4365
4366
4367 @_deprecate_positional_args
4368 def download_embryo(load=True): # noqa: FBT002
4369 """Download a volume of an embryo.
4370
4371 Parameters
4372 ----------
4373 load : bool, default: True
4374 Load the dataset after downloading it when ``True``. Set this
4375 to ``False`` and only the filename will be returned.
4376
4377 Returns
4378 -------
4379 output : pyvista.ImageData | str
4380 DataSet or filename depending on ``load``.
4381
4382 Examples
4383 --------
4384 >>> from pyvista import examples
4385 >>> dataset = examples.download_embryo()
4386 >>> dataset.plot(volume=True)
4387
4388 .. seealso::
4389
4390 :ref:`Embryo Dataset <embryo_dataset>`
4391 See this dataset in the Dataset Gallery for more info.
4392
4393 :ref:`medical_dataset_gallery`
4394 Browse other medical datasets.
4395
4396 This dataset is used in the following examples:
4397
4398 * :ref:`contouring_example`
4399 * :ref:`resampling_example`
4400 * :ref:`slice_orthogonal_example`
4401
4402 """
4403 return _download_dataset(_dataset_embryo, load=load)
4404
4405
4406 def _embryo_load_func(dataset):
4407 # cleanup artifact
4408 mask = dataset['SLCImage'] == 255
4409 dataset['SLCImage'][mask] = 0
4410 return dataset
4411
4412
4413 _dataset_embryo = _SingleFileDownloadableDatasetLoader('embryo.slc', load_func=_embryo_load_func)
4414
4415
4416 @_deprecate_positional_args
4417 def download_antarctica_velocity(load=True): # noqa: FBT002
4418 """Download the antarctica velocity simulation results.
4419
4420 Parameters
4421 ----------
4422 load : bool, default: True
4423 Load the dataset after downloading it when ``True``. Set this
4424 to ``False`` and only the filename will be returned.
4425
4426 Returns
4427 -------
4428 output : pyvista.PolyData | str
4429 DataSet or filename depending on ``load``.
4430
4431 Examples
4432 --------
4433 >>> from pyvista import examples
4434 >>> dataset = examples.download_antarctica_velocity()
4435 >>> dataset.plot(cpos='xy', clim=[1e-3, 1e4], cmap='Blues', log_scale=True)
4436
4437 .. seealso::
4438
4439 :ref:`Antarctica Velocity Dataset <antarctica_velocity_dataset>`
4440 See this dataset in the Dataset Gallery for more info.
4441
4442 :ref:`antarctica_example`
4443 Example using this dataset.
4444
4445 """
4446 return _download_dataset(_dataset_antarctica_velocity, load=load)
4447
4448
4449 _dataset_antarctica_velocity = _SingleFileDownloadableDatasetLoader('antarctica_velocity.vtp')
4450
4451
4452 @_deprecate_positional_args
4453 def download_room_surface_mesh(load=True): # noqa: FBT002
4454 """Download the room surface mesh.
4455
4456 This mesh is for demonstrating the difference that depth peeling can
4457 provide when rendering translucent geometries.
4458
4459 This mesh is courtesy of `Sam Potter <https://github.com/sampotter>`_.
4460
4461 Parameters
4462 ----------
4463 load : bool, default: True
4464 Load the dataset after downloading it when ``True``. Set this
4465 to ``False`` and only the filename will be returned.
4466
4467 Returns
4468 -------
4469 output : pyvista.PolyData | str
4470 DataSet or filename depending on ``load``.
4471
4472 Examples
4473 --------
4474 >>> from pyvista import examples
4475 >>> dataset = examples.download_room_surface_mesh()
4476 >>> dataset.plot()
4477
4478 .. seealso::
4479
4480 :ref:`Room Surface Mesh Dataset <room_surface_mesh_dataset>`
4481 See this dataset in the Dataset Gallery for more info.
4482
4483 :ref:`depth_peeling_example`
4484 Example using this dataset.
4485
4486 """
4487 return _download_dataset(_dataset_room_surface_mesh, load=load)
4488
4489
4490 _dataset_room_surface_mesh = _SingleFileDownloadableDatasetLoader('room_surface_mesh.obj')
4491
4492
4493 @_deprecate_positional_args
4494 def download_beach(load=True): # noqa: FBT002
4495 """Download the beach NRRD image.
4496
4497 Parameters
4498 ----------
4499 load : bool, default: True
4500 Load the dataset after downloading it when ``True``. Set this
4501 to ``False`` and only the filename will be returned.
4502
4503 Returns
4504 -------
4505 output : pyvista.ImageData | str
4506 DataSet or filename depending on ``load``.
4507
4508 Examples
4509 --------
4510 >>> from pyvista import examples
4511 >>> dataset = examples.download_beach()
4512 >>> dataset.plot(rgba=True, cpos='xy')
4513
4514 .. seealso::
4515
4516 :ref:`Beach Dataset <beach_dataset>`
4517 See this dataset in the Dataset Gallery for more info.
4518
4519 """
4520 return _download_dataset(_dataset_beach, load=load)
4521
4522
4523 _dataset_beach = _SingleFileDownloadableDatasetLoader('beach.nrrd')
4524
4525
4526 @_deprecate_positional_args
4527 def download_rgba_texture(load=True): # noqa: FBT002
4528 """Download a texture with an alpha channel.
4529
4530 Parameters
4531 ----------
4532 load : bool, default: True
4533 Load the dataset after downloading it when ``True``. Set this
4534 to ``False`` and only the filename will be returned.
4535
4536 Returns
4537 -------
4538 output : pyvista.Texture | str
4539 DataSet or filename depending on ``load``.
4540
4541 Examples
4542 --------
4543 >>> from pyvista import examples
4544 >>> dataset = examples.download_rgba_texture()
4545 >>> dataset.plot(cpos='xy')
4546
4547 .. seealso::
4548
4549 :ref:`Rgba Texture Dataset <rgba_texture_dataset>`
4550 See this dataset in the Dataset Gallery for more info.
4551
4552 :ref:`texture_example`
4553 Example using this dataset.
4554
4555 """
4556 return _download_dataset(_dataset_rgba_texture, load=load)
4557
4558
4559 _dataset_rgba_texture = _SingleFileDownloadableDatasetLoader(
4560 'alphachannel.png',
4561 read_func=read_texture,
4562 )
4563
4564
4565 @_deprecate_positional_args
4566 def download_vtk_logo(load=True): # noqa: FBT002
4567 """Download a texture of the VTK logo.
4568
4569 Parameters
4570 ----------
4571 load : bool, default: True
4572 Load the dataset after downloading it when ``True``. Set this
4573 to ``False`` and only the filename will be returned.
4574
4575 Returns
4576 -------
4577 output : pyvista.Texture | str
4578 DataSet or filename depending on ``load``.
4579
4580 Examples
4581 --------
4582 >>> from pyvista import examples
4583 >>> dataset = examples.download_vtk_logo()
4584 >>> dataset.plot(cpos='xy')
4585
4586 .. seealso::
4587
4588 :ref:`Vtk Logo Dataset <vtk_logo_dataset>`
4589 See this dataset in the Dataset Gallery for more info.
4590
4591 :ref:`Vtk Dataset <vtk_dataset>`
4592
4593 """
4594 return _download_dataset(_dataset_vtk_logo, load=load)
4595
4596
4597 _dataset_vtk_logo = _SingleFileDownloadableDatasetLoader('vtk.png', read_func=read_texture)
4598
4599
4600 @_deprecate_positional_args
4601 def download_sky_box_cube_map(load=True): # noqa: FBT002
4602 """Download a skybox cube map texture.
4603
4604 Parameters
4605 ----------
4606 load : bool, default: True
4607 Load the dataset after downloading it when ``True``. Set this
4608 to ``False`` and only the filename will be returned.
4609
4610 Returns
4611 -------
4612 pyvista.Texture
4613 Texture containing a skybox.
4614
4615 Examples
4616 --------
4617 >>> from pyvista import examples
4618 >>> import pyvista as pv
4619 >>> pl = pv.Plotter()
4620 >>> dataset = examples.download_sky_box_cube_map()
4621 >>> _ = pl.add_actor(dataset.to_skybox())
4622 >>> pl.set_environment_texture(dataset)
4623 >>> pl.show()
4624
4625 .. seealso::
4626
4627 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
4628 See this dataset in the Dataset Gallery for more info.
4629
4630 :ref:`Cubemap Space 4k Dataset <cubemap_space_4k_dataset>`
4631
4632 :ref:`Cubemap Space 16k Dataset <cubemap_space_16k_dataset>`
4633
4634 :ref:`Cubemap Park Dataset <cubemap_park_dataset>`
4635
4636 :ref:`pbr_example`
4637 Example using this dataset.
4638
4639 """
4640 return _download_dataset(_dataset_sky_box_cube_map, load=load)
4641
4642
4643 def _sky_box_cube_map_files_func():
4644 posx = _DownloadableFile(
4645 'skybox2-posx.jpg',
4646 )
4647 negx = _DownloadableFile('skybox2-negx.jpg')
4648 posy = _DownloadableFile('skybox2-posy.jpg')
4649 negy = _DownloadableFile('skybox2-negy.jpg')
4650 posz = _DownloadableFile('skybox2-posz.jpg')
4651 negz = _DownloadableFile('skybox2-negz.jpg')
4652 return posx, negx, posy, negy, posz, negz
4653
4654
4655 _dataset_sky_box_cube_map = _MultiFileDownloadableDatasetLoader(
4656 files_func=_sky_box_cube_map_files_func,
4657 load_func=_load_as_cubemap,
4658 )
4659
4660
4661 @_deprecate_positional_args
4662 def download_cubemap_park(load=True): # noqa: FBT002
4663 """Download a cubemap of a park.
4664
4665 Downloaded from http://www.humus.name/index.php?page=Textures
4666 by David Eck, and converted to a smaller 512x512 size for use
4667 with WebGL in his free, on-line textbook at
4668 http://math.hws.edu/graphicsbook
4669
4670 This work is licensed under a Creative Commons Attribution 3.0 Unported
4671 License.
4672
4673 Parameters
4674 ----------
4675 load : bool, default: True
4676 Load the dataset after downloading it when ``True``. Set this
4677 to ``False`` and only the filename will be returned.
4678
4679 Returns
4680 -------
4681 pyvista.Texture
4682 Texture containing a skybox.
4683
4684 Examples
4685 --------
4686 >>> from pyvista import examples
4687 >>> import pyvista as pv
4688 >>> pl = pv.Plotter(lighting=None)
4689 >>> dataset = examples.download_cubemap_park()
4690 >>> _ = pl.add_actor(dataset.to_skybox())
4691 >>> pl.set_environment_texture(dataset, is_srgb=True)
4692 >>> pl.camera_position = 'xy'
4693 >>> pl.camera.zoom(0.4)
4694 >>> _ = pl.add_mesh(pv.Sphere(), pbr=True, roughness=0.1, metallic=0.5)
4695 >>> pl.show()
4696
4697 .. seealso::
4698
4699 :ref:`Cubemap Park Dataset <cubemap_park_dataset>`
4700 See this dataset in the Dataset Gallery for more info.
4701
4702 :ref:`Cubemap Space 4k Dataset <cubemap_space_4k_dataset>`
4703
4704 :ref:`Cubemap Space 16k Dataset <cubemap_space_16k_dataset>`
4705
4706 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
4707
4708 """
4709 return _download_dataset(_dataset_cubemap_park, load=load)
4710
4711
4712 _dataset_cubemap_park = _SingleFileDownloadableDatasetLoader(
4713 'cubemap_park/cubemap_park.zip',
4714 target_file='',
4715 read_func=_load_as_cubemap,
4716 )
4717
4718
4719 @_deprecate_positional_args
4720 def download_cubemap_space_4k(load=True): # noqa: FBT002
4721 """Download the 4k space cubemap.
4722
4723 This cubemap was generated by downloading the 4k image from: `Deep Star
4724 Maps 2020 <https://svs.gsfc.nasa.gov/4851>`_ and converting it using
4725 https://jaxry.github.io/panorama-to-cubemap/
4726
4727 See `data/cubemap_space
4728 <https://github.com/pyvista/data/tree/master/Data/cubemap_space#readme>`_
4729 for more details.
4730
4731 Parameters
4732 ----------
4733 load : bool, default: True
4734 Load the dataset after downloading it when ``True``. Set this
4735 to ``False`` and only the filename will be returned.
4736
4737 Returns
4738 -------
4739 pyvista.Texture
4740 Texture containing a skybox.
4741
4742 Examples
4743 --------
4744 Display the cubemap as both an environment texture and an actor.
4745
4746 >>> import pyvista as pv
4747 >>> from pyvista import examples
4748 >>> cubemap = examples.download_cubemap_space_4k()
4749 >>> pl = pv.Plotter(lighting=None)
4750 >>> _ = pl.add_actor(cubemap.to_skybox())
4751 >>> pl.set_environment_texture(cubemap, is_srgb=True)
4752 >>> pl.camera.zoom(0.4)
4753 >>> _ = pl.add_mesh(pv.Sphere(), pbr=True, roughness=0.24, metallic=1.0)
4754 >>> pl.show()
4755
4756 .. seealso::
4757
4758 :ref:`Cubemap Space 4k Dataset <cubemap_space_4k_dataset>`
4759 See this dataset in the Dataset Gallery for more info.
4760
4761 :ref:`Cubemap Space 16k Dataset <cubemap_space_16k_dataset>`
4762
4763 :ref:`Cubemap Park Dataset <cubemap_park_dataset>`
4764
4765 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
4766
4767 """
4768 return _download_dataset(_dataset_cubemap_space_4k, load=load)
4769
4770
4771 _dataset_cubemap_space_4k = _SingleFileDownloadableDatasetLoader(
4772 'cubemap_space/4k.zip',
4773 target_file='',
4774 read_func=_load_as_cubemap,
4775 )
4776
4777
4778 @_deprecate_positional_args
4779 def download_cubemap_space_16k(load=True): # noqa: FBT002
4780 """Download the 16k space cubemap.
4781
4782 This cubemap was generated by downloading the 16k image from: `Deep Star
4783 Maps 2020 <https://svs.gsfc.nasa.gov/4851>`_ and converting it using
4784 https://jaxry.github.io/panorama-to-cubemap/
4785
4786 See `data/cubemap_space
4787 <https://github.com/pyvista/data/tree/master/Data/cubemap_space#readme>`_ for
4788 more details.
4789
4790 Parameters
4791 ----------
4792 load : bool, default: True
4793 Load the dataset after downloading it when ``True``. Set this
4794 to ``False`` and only the filename will be returned.
4795
4796 Returns
4797 -------
4798 pyvista.Texture
4799 Texture containing a skybox.
4800
4801 Notes
4802 -----
4803 This is a 38MB file and may take a while to download.
4804
4805 Examples
4806 --------
4807 Display the cubemap as both an environment texture and an actor. Note that
4808 here we're displaying the 4k as the 16k is a bit too expensive to display
4809 in the documentation.
4810
4811 >>> import pyvista as pv
4812 >>> from pyvista import examples
4813 >>> cubemap = examples.download_cubemap_space_4k()
4814 >>> pl = pv.Plotter(lighting=None)
4815 >>> _ = pl.add_actor(cubemap.to_skybox())
4816 >>> pl.set_environment_texture(cubemap, is_srgb=True)
4817 >>> pl.camera.zoom(0.4)
4818 >>> _ = pl.add_mesh(pv.Sphere(), pbr=True, roughness=0.24, metallic=1.0)
4819 >>> pl.show()
4820
4821 .. seealso::
4822
4823 :ref:`Cubemap Space 16k Dataset <cubemap_space_16k_dataset>`
4824 See this dataset in the Dataset Gallery for more info.
4825
4826 :ref:`Cubemap Space 4k Dataset <cubemap_space_4k_dataset>`
4827
4828 :ref:`Cubemap Park Dataset <cubemap_park_dataset>`
4829
4830 :ref:`Sky Box Cube Map Dataset <sky_box_cube_map_dataset>`
4831
4832 """
4833 return _download_dataset(_dataset_cubemap_space_16k, load=load)
4834
4835
4836 _dataset_cubemap_space_16k = _SingleFileDownloadableDatasetLoader(
4837 'cubemap_space/16k.zip',
4838 target_file='',
4839 read_func=_load_as_cubemap,
4840 )
4841
4842
4843 @_deprecate_positional_args
4844 def download_backward_facing_step(load=True): # noqa: FBT002
4845 """Download an ensight gold case of a fluid simulation.
4846
4847 Parameters
4848 ----------
4849 load : bool, default: True
4850 Load the dataset after downloading it when ``True``. Set this
4851 to ``False`` and only the filename will be returned.
4852
4853 Returns
4854 -------
4855 output : pyvista.MultiBlock | str
4856 DataSet or filename depending on ``load``.
4857
4858 Examples
4859 --------
4860 >>> from pyvista import examples
4861 >>> dataset = examples.download_backward_facing_step()
4862 >>> dataset.plot()
4863
4864 .. seealso::
4865
4866 :ref:`Backward Facing Step Dataset <backward_facing_step_dataset>`
4867 See this dataset in the Dataset Gallery for more info.
4868
4869 """
4870 return _download_dataset(_dataset_backward_facing_step, load=load)
4871
4872
4873 _dataset_backward_facing_step = _SingleFileDownloadableDatasetLoader(
4874 'EnSight.zip',
4875 target_file='foam_case_0_0_0_0.case',
4876 )
4877
4878
4879 @_deprecate_positional_args
4880 def download_gpr_data_array(load=True): # noqa: FBT002
4881 """Download GPR example data array.
4882
4883 Parameters
4884 ----------
4885 load : bool, default: True
4886 Load the dataset after downloading it when ``True``. Set this
4887 to ``False`` and only the filename will be returned.
4888
4889 Returns
4890 -------
4891 output : numpy.ndarray | str
4892 Array or filename depending on ``load``.
4893
4894 Examples
4895 --------
4896 >>> from pyvista import examples
4897 >>> dataset = examples.download_gpr_data_array() # doctest:+SKIP
4898 >>> dataset # doctest:+SKIP
4899 array([[nan, nan, nan, ..., nan, nan, nan],
4900 [nan, nan, nan, ..., nan, nan, nan],
4901 [nan, nan, nan, ..., nan, nan, nan],
4902 ...,
4903 [ 0., 0., 0., ..., 0., 0., 0.],
4904 [ 0., 0., 0., ..., 0., 0., 0.],
4905 [ 0., 0., 0., ..., 0., 0., 0.]])
4906
4907 .. seealso::
4908
4909 :ref:`Gpr Data Array Dataset <gpr_data_array_dataset>`
4910 See this dataset in the Dataset Gallery for more info.
4911
4912 :ref:`Gpr Path Dataset <gpr_path_dataset>`
4913
4914 :ref:`create_draped_surface_example`
4915 Example using this dataset.
4916
4917 """
4918 return _download_dataset(_dataset_gpr_data_array, load=load)
4919
4920
4921 _dataset_gpr_data_array = _SingleFileDownloadableDatasetLoader(
4922 'gpr-example/data.npy',
4923 read_func=np.load,
4924 )
4925
4926
4927 @_deprecate_positional_args
4928 def download_gpr_path(load=True): # noqa: FBT002
4929 """Download GPR example path.
4930
4931 Parameters
4932 ----------
4933 load : bool, default: True
4934 Load the dataset after downloading it when ``True``. Set this
4935 to ``False`` and only the filename will be returned.
4936
4937 Returns
4938 -------
4939 output : pyvista.PolyData | str
4940 DataSet or filename depending on ``load``.
4941
4942 Examples
4943 --------
4944 >>> from pyvista import examples
4945 >>> dataset = examples.download_gpr_path()
4946 >>> dataset.plot()
4947
4948 .. seealso::
4949
4950 :ref:`Gpr Path Dataset <gpr_path_dataset>`
4951 See this dataset in the Dataset Gallery for more info.
4952
4953 :ref:`Gpr Data Array Dataset <gpr_data_array_dataset>`
4954
4955 :ref:`create_draped_surface_example`
4956 Example using this dataset.
4957
4958 """
4959 return _download_dataset(_dataset_gpr_path, load=load)
4960
4961
4962 _dataset_gpr_path = _SingleFileDownloadableDatasetLoader(
4963 'gpr-example/path.txt',
4964 read_func=functools.partial(np.loadtxt, skiprows=1),
4965 load_func=pv.PolyData, # type: ignore[arg-type]
4966 )
4967
4968
4969 @_deprecate_positional_args
4970 def download_woman(load=True): # noqa: FBT002
4971 """Download scan of a woman.
4972
4973 Originally obtained from Laser Design.
4974
4975 Parameters
4976 ----------
4977 load : bool, default: True
4978 Load the dataset after downloading it when ``True``. Set this
4979 to ``False`` and only the filename will be returned.
4980
4981 Returns
4982 -------
4983 output : pyvista.PolyData | str
4984 DataSet or filename depending on ``load``.
4985
4986 Examples
4987 --------
4988 >>> from pyvista import examples
4989 >>> import pyvista as pv
4990 >>> dataset = examples.download_woman()
4991 >>> cpos = pv.CameraPosition(
4992 ... position=(-2600.0, 1970.6, 1836.9),
4993 ... focal_point=(48.5, -20.3, 843.9),
4994 ... viewup=(0.23, -0.168, 0.958),
4995 ... )
4996 >>> dataset.plot(cpos=cpos)
4997
4998 .. seealso::
4999
5000 :ref:`Woman Dataset <woman_dataset>`
5001 See this dataset in the Dataset Gallery for more info.
5002
5003 """
5004 return _download_dataset(_dataset_woman, load=load)
5005
5006
5007 _dataset_woman = _SingleFileDownloadableDatasetLoader('woman.stl')
5008
5009
5010 @_deprecate_positional_args
5011 def download_lobster(load=True): # noqa: FBT002
5012 """Download scan of a lobster.
5013
5014 Originally obtained from Laser Design.
5015
5016 Parameters
5017 ----------
5018 load : bool, default: True
5019 Load the dataset after downloading it when ``True``. Set this
5020 to ``False`` and only the filename will be returned.
5021
5022 Returns
5023 -------
5024 output : pyvista.PolyData | str
5025 DataSet or filename depending on ``load``.
5026
5027 Examples
5028 --------
5029 >>> from pyvista import examples
5030 >>> dataset = examples.download_lobster()
5031 >>> dataset.plot()
5032
5033 .. seealso::
5034
5035 :ref:`Lobster Dataset <lobster_dataset>`
5036 See this dataset in the Dataset Gallery for more info.
5037
5038 """
5039 return _download_dataset(_dataset_lobster, load=load)
5040
5041
5042 _dataset_lobster = _SingleFileDownloadableDatasetLoader('lobster.ply')
5043
5044
5045 @_deprecate_positional_args
5046 def download_face2(load=True): # noqa: FBT002
5047 """Download scan of a man's face.
5048
5049 Originally obtained from Laser Design.
5050
5051 Parameters
5052 ----------
5053 load : bool, default: True
5054 Load the dataset after downloading it when ``True``. Set this
5055 to ``False`` and only the filename will be returned.
5056
5057 Returns
5058 -------
5059 output : pyvista.PolyData | str
5060 DataSet or filename depending on ``load``.
5061
5062 Examples
5063 --------
5064 >>> from pyvista import examples
5065 >>> dataset = examples.download_face2()
5066 >>> dataset.plot()
5067
5068 .. seealso::
5069
5070 :ref:`Face2 Dataset <face2_dataset>`
5071 See this dataset in the Dataset Gallery for more info.
5072
5073 :ref:`Face Dataset <face_dataset>`
5074
5075 """
5076 return _download_dataset(_dataset_face2, load=load)
5077
5078
5079 _dataset_face2 = _SingleFileDownloadableDatasetLoader('man_face.stl')
5080
5081
5082 @_deprecate_positional_args
5083 def download_urn(load=True): # noqa: FBT002
5084 """Download scan of a burial urn.
5085
5086 Originally obtained from Laser Design.
5087
5088 Parameters
5089 ----------
5090 load : bool, default: True
5091 Load the dataset after downloading it when ``True``. Set this
5092 to ``False`` and only the filename will be returned.
5093
5094 Returns
5095 -------
5096 output : pyvista.PolyData | str
5097 DataSet or filename depending on ``load``.
5098
5099 Examples
5100 --------
5101 >>> from pyvista import examples
5102 >>> import pyvista as pv
5103 >>> cpos = pv.CameraPosition(
5104 ... position=(-7.123e02, 5.715e02, 8.601e02),
5105 ... focal_point=(4.700e00, 2.705e02, -1.010e01),
5106 ... viewup=(2.000e-01, 1.000e00, -2.000e-01),
5107 ... )
5108 >>> dataset = examples.download_urn()
5109 >>> dataset.plot(cpos=cpos)
5110
5111 .. seealso::
5112
5113 :ref:`Urn Dataset <urn_dataset>`
5114 See this dataset in the Dataset Gallery for more info.
5115
5116 """
5117 return _download_dataset(_dataset_urn, load=load)
5118
5119
5120 _dataset_urn = _SingleFileDownloadableDatasetLoader('urn.stl')
5121
5122
5123 @_deprecate_positional_args
5124 def download_pepper(load=True): # noqa: FBT002
5125 """Download scan of a pepper (capsicum).
5126
5127 Originally obtained from Laser Design.
5128
5129 Parameters
5130 ----------
5131 load : bool, default: True
5132 Load the dataset after downloading it when ``True``. Set this
5133 to ``False`` and only the filename will be returned.
5134
5135 Returns
5136 -------
5137 output : pyvista.PolyData | str
5138 DataSet or filename depending on ``load``.
5139
5140 Examples
5141 --------
5142 >>> from pyvista import examples
5143 >>> dataset = examples.download_pepper()
5144 >>> dataset.plot()
5145
5146 .. seealso::
5147
5148 :ref:`Pepper Dataset <pepper_dataset>`
5149 See this dataset in the Dataset Gallery for more info.
5150
5151 """
5152 return _download_dataset(_dataset_pepper, load=load)
5153
5154
5155 _dataset_pepper = _SingleFileDownloadableDatasetLoader('pepper.ply')
5156
5157
5158 @_deprecate_positional_args
5159 def download_drill(load=True): # noqa: FBT002
5160 """Download scan of a power drill.
5161
5162 Originally obtained from Laser Design.
5163
5164 Parameters
5165 ----------
5166 load : bool, default: True
5167 Load the dataset after downloading it when ``True``. Set this
5168 to ``False`` and only the filename will be returned.
5169
5170 Returns
5171 -------
5172 output : pyvista.PolyData | str
5173 DataSet or filename depending on ``load``.
5174
5175 Examples
5176 --------
5177 >>> from pyvista import examples
5178 >>> dataset = examples.download_drill()
5179 >>> dataset.plot()
5180
5181 .. seealso::
5182
5183 :ref:`Drill Dataset <drill_dataset>`
5184 See this dataset in the Dataset Gallery for more info.
5185
5186 """
5187 # Silence warning: unexpected data at end of line in OBJ file
5188 with pv.vtk_verbosity('off'):
5189 return _download_dataset(_dataset_drill, load=load)
5190
5191
5192 _dataset_drill = _SingleFileDownloadableDatasetLoader('drill.obj')
5193
5194
5195 @_deprecate_positional_args
5196 def download_action_figure(load=True, *, high_resolution=False): # noqa: FBT002
5197 """Download scan of an action figure.
5198
5199 Originally obtained from Laser Design.
5200
5201 .. versionchanged:: 0.45
5202
5203 A decimated version of this dataset with 31 thousand cells is now returned.
5204 Previously, a high-resolution version with 630 thousand cells was returned.
5205 Use ``high_resolution=True`` for the high-resolution version.
5206
5207 Parameters
5208 ----------
5209 load : bool, default: True
5210 Load the dataset after downloading it when ``True``. Set this
5211 to ``False`` and only the filename will be returned.
5212
5213 high_resolution : bool, default: False
5214 Set this to ``True`` to return a high-resolution version of this dataset.
5215 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
5216 is returned with 95% reduction.
5217
5218 .. versionadded:: 0.45
5219
5220 Returns
5221 -------
5222 output : pyvista.PolyData | str
5223 DataSet or filename depending on ``load``.
5224
5225 Examples
5226 --------
5227 Show the action figure example. This also demonstrates how to use
5228 physically based rendering and lighting to make a good looking
5229 plot.
5230
5231 >>> import pyvista as pv
5232 >>> from pyvista import examples
5233 >>> dataset = examples.download_action_figure()
5234 >>> _ = dataset.clean(inplace=True)
5235 >>> pl = pv.Plotter(lighting=None)
5236 >>> pl.add_light(pv.Light(position=(30, 10, 10)))
5237 >>> _ = pl.add_mesh(
5238 ... dataset,
5239 ... color='w',
5240 ... smooth_shading=True,
5241 ... pbr=True,
5242 ... metallic=0.3,
5243 ... roughness=0.5,
5244 ... )
5245 >>> pl.camera_position = pv.CameraPosition(
5246 ... position=(32.3, 116.3, 220.6),
5247 ... focal_point=(-0.05, 3.8, 33.8),
5248 ... viewup=(-0.017, 0.86, -0.51),
5249 ... )
5250 >>> pl.show()
5251
5252 .. seealso::
5253
5254 :ref:`Action Figure Dataset <action_figure_dataset>`
5255 See this dataset in the Dataset Gallery for more info.
5256
5257 """
5258 if high_resolution:
5259 return _download_dataset(__dataset_action_figure_high_res, load=load)
5260 return _download_dataset(_dataset_action_figure, load=load)
5261
5262
5263 _dataset_action_figure = _SingleFileDownloadableDatasetLoader('tigerfighter_decimated.obj')
5264 __dataset_action_figure_high_res = _SingleFileDownloadableDatasetLoader('tigerfighter.obj')
5265
5266
5267 @_deprecate_positional_args
5268 def download_notch_stress(load=True): # noqa: FBT002
5269 """Download the FEA stress result from a notched beam.
5270
5271 Parameters
5272 ----------
5273 load : bool, default: True
5274 Load the dataset after downloading it when ``True``. Set this
5275 to ``False`` and only the filename will be returned.
5276
5277 Returns
5278 -------
5279 output : pyvista.UnstructuredGrid | str
5280 DataSet or filename depending on ``load``.
5281
5282 Examples
5283 --------
5284 >>> from pyvista import examples
5285 >>> dataset = examples.download_notch_stress()
5286 >>> dataset.plot(cmap='bwr')
5287
5288 .. seealso::
5289
5290 :ref:`Notch Stress Dataset <notch_stress_dataset>`
5291 See this dataset in the Dataset Gallery for more info.
5292
5293 :ref:`Notch Displacement Dataset <notch_displacement_dataset>`
5294
5295 :ref:`Aero Bracket Dataset <aero_bracket_dataset>`
5296
5297 :ref:`Fea Bracket Dataset <fea_bracket_dataset>`
5298
5299 :ref:`Fea Hertzian Contact Cylinder Dataset <fea_hertzian_contact_cylinder_dataset>`
5300
5301 """
5302 return _download_dataset(_dataset_notch_stress, load=load)
5303
5304
5305 _dataset_notch_stress = _SingleFileDownloadableDatasetLoader('notch_stress_fixed.vtk')
5306
5307
5308 @_deprecate_positional_args
5309 def download_notch_displacement(load=True): # noqa: FBT002
5310 """Download the FEA displacement result from a notched beam.
5311
5312 Parameters
5313 ----------
5314 load : bool, default: True
5315 Load the dataset after downloading it when ``True``. Set this
5316 to ``False`` and only the filename will be returned.
5317
5318 Returns
5319 -------
5320 output : pyvista.UnstructuredGrid | str
5321 DataSet or filename depending on ``load``.
5322
5323 Examples
5324 --------
5325 >>> from pyvista import examples
5326 >>> dataset = examples.download_notch_displacement()
5327 >>> dataset.plot(cmap='bwr')
5328
5329 .. seealso::
5330
5331 :ref:`Notch Displacement Dataset <notch_displacement_dataset>`
5332 See this dataset in the Dataset Gallery for more info.
5333
5334 :ref:`Notch Stress Dataset <notch_stress_dataset>`
5335
5336 :ref:`Aero Bracket Dataset <aero_bracket_dataset>`
5337
5338 :ref:`Fea Bracket Dataset <fea_bracket_dataset>`
5339
5340 :ref:`Fea Hertzian Contact Cylinder Dataset <fea_hertzian_contact_cylinder_dataset>`
5341
5342 """
5343 return _download_dataset(_dataset_notch_displacement, load=load)
5344
5345
5346 _dataset_notch_displacement = _SingleFileDownloadableDatasetLoader('notch_disp.vtu')
5347
5348
5349 @_deprecate_positional_args
5350 def download_louis_louvre(load=True): # noqa: FBT002
5351 """Download the Louis XIV de France statue at the Louvre, Paris.
5352
5353 Statue found in the Napoléon Courtyard of Louvre Palace. It is a
5354 copy in plomb of the original statue in Versailles, made by
5355 Bernini and Girardon.
5356
5357 Originally downloaded from `sketchfab <https://sketchfab.com/3d-models/louis-xiv-de-france-louvre-paris-a0cc0e7eee384c99838dff2857b8158c>`_
5358
5359 Parameters
5360 ----------
5361 load : bool, default: True
5362 Load the dataset after downloading it when ``True``. Set this
5363 to ``False`` and only the filename will be returned.
5364
5365 Returns
5366 -------
5367 output : pyvista.PolyData | str
5368 DataSet or filename depending on ``load``.
5369
5370 Examples
5371 --------
5372 Plot the Louis XIV statue with custom lighting and camera angle.
5373
5374 >>> from pyvista import examples
5375 >>> import pyvista as pv
5376 >>> dataset = examples.download_louis_louvre()
5377 >>> pl = pv.Plotter(lighting=None)
5378 >>> _ = pl.add_mesh(dataset, smooth_shading=True)
5379 >>> pl.add_light(pv.Light(position=(10, -10, 10)))
5380 >>> pl.camera_position = pv.CameraPosition(
5381 ... position=(-6.71, -14.55, 15.17),
5382 ... focal_point=(1.44, 2.54, 9.84),
5383 ... viewup=(0.16, 0.22, 0.96),
5384 ... )
5385 >>> pl.show()
5386
5387 .. seealso::
5388
5389 :ref:`Louis Louvre Dataset <louis_louvre_dataset>`
5390 See this dataset in the Dataset Gallery for more info.
5391
5392 :ref:`pbr_example`
5393 Example using this dataset.
5394
5395 """
5396 return _download_dataset(_dataset_louis_louvre, load=load)
5397
5398
5399 _dataset_louis_louvre = _SingleFileDownloadableDatasetLoader('louis.ply')
5400
5401
5402 @_deprecate_positional_args
5403 def download_cylinder_crossflow(load=True): # noqa: FBT002
5404 """Download CFD result for cylinder in cross flow at Re=35.
5405
5406 Parameters
5407 ----------
5408 load : bool, default: True
5409 Load the dataset after downloading it when ``True``. Set this
5410 to ``False`` and only the filename will be returned.
5411
5412 Returns
5413 -------
5414 output : pyvista.MultiBlock | str
5415 DataSet or filename depending on ``load``.
5416
5417 Examples
5418 --------
5419 >>> from pyvista import examples
5420 >>> dataset = examples.download_cylinder_crossflow()
5421 >>> dataset.plot(cpos='xy', cmap='blues', rng=[-200, 500])
5422
5423 .. seealso::
5424
5425 :ref:`Cylinder Crossflow Dataset <cylinder_crossflow_dataset>`
5426 See this dataset in the Dataset Gallery for more info.
5427
5428 :ref:`streamlines_2D_example`
5429 Example using this dataset.
5430
5431 """
5432 return _download_dataset(_dataset_cylinder_crossflow, load=load)
5433
5434
5435 def _cylinder_crossflow_files_func():
5436 case = _SingleFileDownloadableDatasetLoader('EnSight/CylinderCrossflow/cylinder_Re35.case')
5437 geo = _DownloadableFile('EnSight/CylinderCrossflow/cylinder_Re35.geo')
5438 scl1 = _DownloadableFile('EnSight/CylinderCrossflow/cylinder_Re35.scl1')
5439 scl2 = _DownloadableFile('EnSight/CylinderCrossflow/cylinder_Re35.scl2')
5440 vel = _DownloadableFile('EnSight/CylinderCrossflow/cylinder_Re35.vel')
5441 return case, geo, scl1, scl2, vel
5442
5443
5444 _dataset_cylinder_crossflow = _MultiFileDownloadableDatasetLoader(
5445 files_func=_cylinder_crossflow_files_func,
5446 )
5447
5448
5449 @_deprecate_positional_args
5450 def download_naca(load=True): # noqa: FBT002
5451 """Download NACA airfoil dataset in EnSight format.
5452
5453 Parameters
5454 ----------
5455 load : bool, default: True
5456 Load the dataset after downloading it when ``True``. Set this
5457 to ``False`` and only the filename will be returned.
5458
5459 Returns
5460 -------
5461 output : pyvista.MultiBlock | str
5462 DataSet or filename depending on ``load``.
5463
5464 Examples
5465 --------
5466 Plot the density of the air surrounding the NACA airfoil using the
5467 ``"jet"`` color map.
5468
5469 >>> from pyvista import examples
5470 >>> import pyvista as pv
5471 >>> cpos = pv.CameraPosition(
5472 ... position=(-0.22, 0.0, 2.52),
5473 ... focal_point=(0.43, 0.0, 0.0),
5474 ... viewup=(0.0, 1.0, 0.0),
5475 ... )
5476 >>> dataset = examples.download_naca()
5477 >>> dataset.plot(cpos=cpos, cmap='jet')
5478
5479 .. seealso::
5480
5481 :ref:`Naca Dataset <naca_dataset>`
5482 See this dataset in the Dataset Gallery for more info.
5483
5484 :ref:`reader_example`
5485 Example using this dataset.
5486
5487 """
5488 return _download_dataset(_dataset_naca, load=load)
5489
5490
5491 def _naca_files_func():
5492 case = _SingleFileDownloadableDatasetLoader('EnSight/naca.bin.case')
5493 dens1 = _DownloadableFile('EnSight/naca.gold.bin.DENS_1')
5494 dens3 = _DownloadableFile('EnSight/naca.gold.bin.DENS_3')
5495 geo = _DownloadableFile('EnSight/naca.gold.bin.geo')
5496 return case, dens1, dens3, geo
5497
5498
5499 _dataset_naca = _MultiFileDownloadableDatasetLoader(files_func=_naca_files_func)
5500
5501
5502 @_deprecate_positional_args
5503 def download_lshape(load=True): # noqa: FBT002
5504 """Download LShape dataset in EnSight format.
5505
5506 Parameters
5507 ----------
5508 load : bool, default: True
5509 Load the dataset after downloading it when ``True``. Set this
5510 to ``False`` and only the filename will be returned.
5511
5512 Returns
5513 -------
5514 output : pyvista.MultiBlock | str
5515 DataSet or filename depending on ``load``.
5516
5517 Examples
5518 --------
5519 Load and plot the dataset.
5520
5521 >>> from pyvista import examples
5522 >>> mesh = examples.download_lshape()['all']
5523 >>> warped = mesh.warp_by_vector(factor=30)
5524 >>> warped.plot(scalars='displacement')
5525
5526 .. seealso::
5527
5528 :ref:`Lshape Dataset <lshape_dataset>`
5529 See this dataset in the Dataset Gallery for more info.
5530
5531 """
5532 return _download_dataset(_dataset_lshape, load=load)
5533
5534
5535 def _lshape_files_func():
5536 def read_func(filename):
5537 reader = pv.get_reader(filename)
5538 reader.set_active_time_set(1)
5539 reader.set_active_time_value(1.0)
5540 return reader.read()
5541
5542 case = _SingleFileDownloadableDatasetLoader('EnSight/LShape.case', read_func=read_func)
5543 geo = _DownloadableFile('EnSight/LShape_geometry.geo')
5544 var = _DownloadableFile('EnSight/LShape_displacement.var')
5545 return case, geo, var
5546
5547
5548 _dataset_lshape = _MultiFileDownloadableDatasetLoader(files_func=_lshape_files_func)
5549
5550
5551 @_deprecate_positional_args
5552 def download_wavy(load=True): # noqa: FBT002
5553 """Download PVD file of a 2D wave.
5554
5555 Parameters
5556 ----------
5557 load : bool, default: True
5558 Load the dataset after downloading it when ``True``. Set this
5559 to ``False`` and only the filename will be returned.
5560
5561 Returns
5562 -------
5563 output : pyvista.MultiBlock | str
5564 DataSet or filename depending on ``load``.
5565
5566 Examples
5567 --------
5568 >>> from pyvista import examples
5569 >>> dataset = examples.download_wavy()
5570 >>> dataset.plot()
5571
5572 .. seealso::
5573
5574 :ref:`Wavy Dataset <wavy_dataset>`
5575 See this dataset in the Dataset Gallery for more info.
5576
5577 :ref:`reader_example`
5578 Example using this dataset.
5579
5580 """
5581 return _download_dataset(_dataset_wavy, load=load)
5582
5583
5584 _dataset_wavy = _SingleFileDownloadableDatasetLoader('PVD/wavy.zip', target_file='unzip/wavy.pvd')
5585
5586
5587 @_deprecate_positional_args
5588 def download_single_sphere_animation(load=True): # noqa: FBT002
5589 """Download PVD file for single sphere.
5590
5591 Parameters
5592 ----------
5593 load : bool, default: True
5594 Load the dataset after downloading it when ``True``. Set this
5595 to ``False`` and only the filename will be returned.
5596
5597 Returns
5598 -------
5599 output : pyvista.MultiBlock | str
5600 DataSet or filename depending on ``load``.
5601
5602 Examples
5603 --------
5604 >>> import os
5605 >>> from tempfile import mkdtemp
5606 >>> import pyvista as pv
5607 >>> from pyvista import examples
5608 >>> filename = examples.download_single_sphere_animation(load=False)
5609 >>> reader = pv.PVDReader(filename)
5610
5611 Write the gif to a temporary directory. Normally you would write to a local
5612 path.
5613
5614 >>> gif_filename = os.path.join(mkdtemp(), 'single_sphere.gif')
5615
5616 Generate the animation.
5617
5618 >>> pl = pv.Plotter()
5619 >>> pl.open_gif(gif_filename)
5620 >>> for time_value in reader.time_values:
5621 ... reader.set_active_time_value(time_value)
5622 ... mesh = reader.read()
5623 ... _ = pl.add_mesh(mesh, smooth_shading=True)
5624 ... _ = pl.add_text(f'Time: {time_value:.0f}', color='black')
5625 ... pl.write_frame()
5626 ... pl.clear()
5627 ... pl.enable_lightkit()
5628 >>> pl.close()
5629
5630 .. seealso::
5631
5632 :ref:`Single Sphere Animation Dataset <single_sphere_animation_dataset>`
5633 See this dataset in the Dataset Gallery for more info.
5634
5635 :ref:`Dual Sphere Animation Dataset <dual_sphere_animation_dataset>`
5636
5637 """
5638 return _download_dataset(_dataset_single_sphere_animation, load=load)
5639
5640
5641 _dataset_single_sphere_animation = _SingleFileDownloadableDatasetLoader(
5642 'PVD/paraview/singleSphereAnimation.zip',
5643 target_file='singleSphereAnimation.pvd',
5644 )
5645
5646
5647 @_deprecate_positional_args
5648 def download_dual_sphere_animation(load=True): # noqa: FBT002
5649 """Download PVD file for double sphere.
5650
5651 Parameters
5652 ----------
5653 load : bool, default: True
5654 Load the dataset after downloading it when ``True``. Set this
5655 to ``False`` and only the filename will be returned.
5656
5657 Returns
5658 -------
5659 output : pyvista.MultiBlock | str
5660 DataSet or filename depending on ``load``.
5661
5662 Examples
5663 --------
5664 >>> import os
5665 >>> from tempfile import mkdtemp
5666 >>> import pyvista as pv
5667 >>> from pyvista import examples
5668 >>> filename = examples.download_dual_sphere_animation(load=False)
5669 >>> reader = pv.PVDReader(filename)
5670
5671 Write the gif to a temporary directory. Normally you would write to a local
5672 path.
5673
5674 >>> gif_filename = os.path.join(mkdtemp(), 'dual_sphere.gif')
5675
5676 Generate the animation.
5677
5678 >>> pl = pv.Plotter()
5679 >>> pl.open_gif(gif_filename)
5680 >>> for time_value in reader.time_values:
5681 ... reader.set_active_time_value(time_value)
5682 ... mesh = reader.read()
5683 ... _ = pl.add_mesh(mesh, smooth_shading=True)
5684 ... _ = pl.add_text(f'Time: {time_value:.0f}', color='black')
5685 ... pl.write_frame()
5686 ... pl.clear()
5687 ... pl.enable_lightkit()
5688 >>> pl.close()
5689
5690 .. seealso::
5691
5692 :ref:`Dual Sphere Animation Dataset <dual_sphere_animation_dataset>`
5693 See this dataset in the Dataset Gallery for more info.
5694
5695 :ref:`Single Sphere Animation Dataset <single_sphere_animation_dataset>`
5696
5697 """
5698 return _download_dataset(_dataset_dual_sphere_animation, load=load)
5699
5700
5701 _dataset_dual_sphere_animation = _SingleFileDownloadableDatasetLoader(
5702 'PVD/paraview/dualSphereAnimation.zip',
5703 target_file='dualSphereAnimation.pvd',
5704 )
5705
5706
5707 @_deprecate_positional_args
5708 def download_cavity(load=True): # noqa: FBT002
5709 """Download cavity OpenFOAM example.
5710
5711 Retrieved from
5712 `Kitware VTK Data <https://data.kitware.com/#collection/55f17f758d777f6ddc7895b7/folder/5afd932e8d777f15ebe1b183>`_.
5713
5714 Parameters
5715 ----------
5716 load : bool, default: True
5717 Load the dataset after downloading it when ``True``. Set this
5718 to ``False`` and only the filename will be returned.
5719
5720 Returns
5721 -------
5722 output : pyvista.MultiBlock | str
5723 DataSet or filename depending on ``load``.
5724
5725 Examples
5726 --------
5727 >>> from pyvista import examples
5728 >>> dataset = examples.download_cavity() # doctest:+SKIP
5729
5730 .. seealso::
5731
5732 :ref:`Cavity Dataset <cavity_dataset>`
5733 See this dataset in the Dataset Gallery for more info.
5734
5735 :ref:`openfoam_example`
5736 Full example using this dataset.
5737
5738 """
5739 return _download_dataset(_dataset_cavity, load=load)
5740
5741
5742 _dataset_cavity = _SingleFileDownloadableDatasetLoader(
5743 'OpenFOAM.zip',
5744 target_file='cavity/case.foam',
5745 )
5746
5747
5748 @_deprecate_positional_args
5749 def download_openfoam_tubes(load=True): # noqa: FBT002
5750 """Download tubes OpenFOAM example.
5751
5752 Data generated from public SimScale examples at `SimScale Project Library -
5753 Turbo <https://www.simscale.com/projects/ayarnoz/turbo/>`_.
5754
5755 Licensing for this dataset is granted to freely and without restriction
5756 reproduce, distribute, publish according to the `SimScale Terms and
5757 Conditions <https://www.simscale.com/terms-and-conditions/>`_.
5758
5759 Parameters
5760 ----------
5761 load : bool, default: True
5762 Load the dataset after downloading it when ``True``. Set this
5763 to ``False`` and only the filename will be returned.
5764
5765 Returns
5766 -------
5767 output : pyvista.MultiBlock | str
5768 DataSet or filename depending on ``load``.
5769
5770 Examples
5771 --------
5772 Plot the outline of the dataset along with a cross section of the flow velocity.
5773
5774 >>> import pyvista as pv
5775 >>> from pyvista import examples
5776 >>> dataset = examples.download_openfoam_tubes()
5777 >>> air = dataset[0]
5778 >>> y_slice = air.slice('y')
5779 >>> pl = pv.Plotter()
5780 >>> _ = pl.add_mesh(
5781 ... y_slice,
5782 ... scalars='U',
5783 ... lighting=False,
5784 ... scalar_bar_args={'title': 'Flow Velocity'},
5785 ... )
5786 >>> _ = pl.add_mesh(air, color='w', opacity=0.25)
5787 >>> pl.enable_anti_aliasing()
5788 >>> pl.show()
5789
5790 .. seealso::
5791
5792 :ref:`Openfoam Tubes Dataset <openfoam_tubes_dataset>`
5793 See this dataset in the Dataset Gallery for more info.
5794
5795 :ref:`openfoam_tubes_example`
5796 Full example using this dataset.
5797
5798 """
5799 return _download_dataset(_dataset_openfoam_tubes, load=load)
5800
5801
5802 def _openfoam_tubes_read_func(filename):
5803 reader = pv.OpenFOAMReader(filename)
5804 reader.set_active_time_value(1000)
5805 return reader.read()
5806
5807
5808 _dataset_openfoam_tubes = _SingleFileDownloadableDatasetLoader(
5809 'fvm/turbo_incompressible/Turbo-Incompressible_3-Run_1-SOLUTION_FIELDS.zip',
5810 target_file='case.foam',
5811 read_func=_openfoam_tubes_read_func,
5812 )
5813
5814
5815 @_deprecate_positional_args
5816 def download_lucy(load=True): # noqa: FBT002
5817 """Download the lucy angel mesh.
5818
5819 Original downloaded from the `The Stanford 3D Scanning Repository
5820 <http://graphics.stanford.edu/data/3Dscanrep/>`_ and decimated to
5821 approximately 100k triangle.
5822
5823 Parameters
5824 ----------
5825 load : bool, default: True
5826 Load the dataset after downloading it when ``True``. Set this
5827 to ``False`` and only the filename will be returned.
5828
5829 Returns
5830 -------
5831 output : pyvista.PolyData | str
5832 DataSet or filename depending on ``load``.
5833
5834 Examples
5835 --------
5836 Plot the Lucy Angel dataset with custom lighting.
5837
5838 >>> from pyvista import examples
5839 >>> import pyvista as pv
5840 >>> dataset = examples.download_lucy()
5841
5842 Create a light at the "flame".
5843
5844 >>> flame_light = pv.Light(
5845 ... color=[0.886, 0.345, 0.133],
5846 ... position=[550, 140, 950],
5847 ... intensity=1.5,
5848 ... positional=True,
5849 ... cone_angle=90,
5850 ... attenuation_values=(0.001, 0.005, 0),
5851 ... )
5852
5853 Create a scene light.
5854
5855 >>> scene_light = pv.Light(intensity=0.2)
5856
5857 >>> pl = pv.Plotter(lighting=None)
5858 >>> _ = pl.add_mesh(dataset, smooth_shading=True)
5859 >>> pl.add_light(flame_light)
5860 >>> pl.add_light(scene_light)
5861 >>> pl.background_color = 'k'
5862 >>> pl.show()
5863
5864 .. seealso::
5865
5866 :ref:`Lucy Dataset <lucy_dataset>`
5867 See this dataset in the Dataset Gallery for more info.
5868
5869 :ref:`jupyter_plotting`
5870 Example using this dataset.
5871
5872 """
5873 return _download_dataset(_dataset_lucy, load=load)
5874
5875
5876 _dataset_lucy = _SingleFileDownloadableDatasetLoader('lucy.ply')
5877
5878
5879 @_deprecate_positional_args
5880 def download_pump_bracket(load=True): # noqa: FBT002
5881 """Download the pump bracket example dataset.
5882
5883 Data generated from public SimScale examples at `SimScale Project Library -
5884 Turbo <https://www.simscale.com/projects/STR/bracket/>`_.
5885
5886 Licensing for this dataset is granted freely and without restriction to
5887 reproduce, distribute, and publish according to the `SimScale Terms and
5888 Conditions <https://www.simscale.com/terms-and-conditions/>`_.
5889
5890 Parameters
5891 ----------
5892 load : bool, default: True
5893 Load the dataset after downloading it when ``True``. Set this
5894 to ``False`` and only the filename will be returned.
5895
5896 Returns
5897 -------
5898 output : UnstructuredGrid | str
5899 DataSet or filename depending on ``load``.
5900
5901 Examples
5902 --------
5903 Load the dataset.
5904
5905 >>> import pyvista as pv
5906 >>> from pyvista import examples
5907 >>> dataset = examples.download_pump_bracket()
5908 >>> dataset
5909 UnstructuredGrid (...)
5910 N Cells: 124806
5911 N Points: 250487
5912 X Bounds: -5.000e-01, 5.000e-01
5913 Y Bounds: -4.000e-01, 0.000e+00
5914 Z Bounds: -2.500e-02, 2.500e-02
5915 N Arrays: 10
5916
5917 Plot the displacement of the 4th mode shape as scalars.
5918
5919 >>> cpos = pv.CameraPosition(
5920 ... position=(0.744, -0.502, -0.830),
5921 ... focal_point=(0.0520, -0.160, 0.0743),
5922 ... viewup=(-0.180, -0.958, 0.224),
5923 ... )
5924 >>> dataset.plot(
5925 ... scalars='disp_3',
5926 ... cpos=cpos,
5927 ... show_scalar_bar=False,
5928 ... ambient=0.2,
5929 ... anti_aliasing='fxaa',
5930 ... )
5931
5932 .. seealso::
5933
5934 :ref:`Pump Bracket Dataset <pump_bracket_dataset>`
5935 See this dataset in the Dataset Gallery for more info.
5936
5937 :ref:`pump_bracket_example`
5938 Full example using this dataset.
5939
5940 """
5941 return _download_dataset(_dataset_pump_bracket, load=load)
5942
5943
5944 _dataset_pump_bracket = _SingleFileDownloadableDatasetLoader(
5945 'fea/pump_bracket/pump_bracket.zip',
5946 target_file='pump_bracket.vtk',
5947 )
5948
5949
5950 @_deprecate_positional_args
5951 def download_electronics_cooling(load=True): # noqa: FBT002
5952 """Download the electronics cooling example datasets.
5953
5954 Data generated from public SimScale examples at `SimScale Project Library -
5955 Turbo <https://www.simscale.com/projects/ayarnoz/turbo/>`_.
5956
5957 Licensing for this dataset is granted to freely and without restriction
5958 reproduce, distribute, publish according to the `SimScale Terms and
5959 Conditions <https://www.simscale.com/terms-and-conditions/>`_.
5960
5961 Parameters
5962 ----------
5963 load : bool, default: True
5964 Load the dataset after downloading it when ``True``. Set this
5965 to ``False`` and only the filename will be returned.
5966
5967 Returns
5968 -------
5969 output : tuple[PolyData, UnstructuredGrid] | list[str]
5970 DataSets or filenames depending on ``load``.
5971
5972 Examples
5973 --------
5974 Load the datasets and plot the air velocity through the electronics.
5975
5976 >>> import pyvista as pv
5977 >>> from pyvista import examples
5978 >>> structure, air = examples.download_electronics_cooling()
5979
5980 Show the type and bounds of the datasets.
5981
5982 >>> structure, air
5983 (PolyData (...)
5984 N Cells: 344270
5985 N Points: 187992
5986 N Strips: 0
5987 X Bounds: -3.000e-03, 1.530e-01
5988 Y Bounds: -3.000e-03, 2.030e-01
5989 Z Bounds: -9.000e-03, 4.200e-02
5990 N Arrays: 4, UnstructuredGrid (...)
5991 N Cells: 1749992
5992 N Points: 610176
5993 X Bounds: -1.388e-18, 1.500e-01
5994 Y Bounds: -3.000e-03, 2.030e-01
5995 Z Bounds: -6.000e-03, 4.400e-02
5996 N Arrays: 10)
5997
5998 >>> z_slice = air.clip('z', value=-0.005)
5999 >>> pl = pv.Plotter()
6000 >>> pl.enable_ssao(radius=0.01)
6001 >>> _ = pl.add_mesh(
6002 ... z_slice,
6003 ... scalars='U',
6004 ... lighting=False,
6005 ... scalar_bar_args={'title': 'Velocity'},
6006 ... )
6007 >>> _ = pl.add_mesh(
6008 ... structure,
6009 ... color='w',
6010 ... smooth_shading=True,
6011 ... split_sharp_edges=True,
6012 ... )
6013 >>> pl.camera_position = 'xy'
6014 >>> pl.camera.roll = 90
6015 >>> pl.enable_anti_aliasing('fxaa')
6016 >>> pl.show()
6017
6018 .. seealso::
6019
6020 :ref:`Electronics Cooling Dataset <electronics_cooling_dataset>`
6021 See this dataset in the Dataset Gallery for more info.
6022
6023 :ref:`openfoam_cooling_example`
6024 Full example using this dataset.
6025
6026 """
6027 return _download_dataset(_dataset_electronics_cooling, load=load)
6028
6029
6030 def _electronics_cooling_files_func():
6031 _structure = _SingleFileDownloadableDatasetLoader(
6032 'fvm/cooling_electronics/datasets.zip',
6033 target_file='structure.vtp',
6034 )
6035 _air = _SingleFileDownloadableDatasetLoader(
6036 'fvm/cooling_electronics/datasets.zip',
6037 target_file='air.vtu',
6038 )
6039 return _structure, _air
6040
6041
6042 _dataset_electronics_cooling = _MultiFileDownloadableDatasetLoader(
6043 _electronics_cooling_files_func,
6044 load_func=_load_as_multiblock,
6045 )
6046
6047
6048 @_deprecate_positional_args
6049 def download_can_crushed_hdf(load=True): # noqa: FBT002
6050 """Download the crushed can dataset.
6051
6052 File obtained from `Kitware <https://www.kitware.com/>`_. Used
6053 for testing hdf files.
6054
6055 Originally built using VTK v9.2.0rc from:
6056
6057 ``VTK/build/ExternalTesting/can-vtu.hdf``
6058
6059 Parameters
6060 ----------
6061 load : bool, default: True
6062 Load the dataset after downloading it when ``True``. Set this
6063 to ``False`` and only the filename will be returned.
6064
6065 Returns
6066 -------
6067 output : pyvista.UnstructuredGrid | str
6068 Crushed can dataset or path depending on the value of ``load``.
6069
6070 Examples
6071 --------
6072 Plot the crushed can dataset.
6073
6074 >>> from pyvista import examples
6075 >>> import pyvista as pv
6076 >>> dataset = examples.download_can_crushed_hdf()
6077 >>> dataset.plot(smooth_shading=True)
6078
6079 .. seealso::
6080
6081 :ref:`Can Crushed Hdf Dataset <can_crushed_hdf_dataset>`
6082 See this dataset in the Dataset Gallery for more info.
6083
6084 :ref:`Can Crushed Vtu Dataset <can_crushed_vtu_dataset>`
6085
6086 """
6087 return _download_dataset(_dataset_can_crushed_hdf, load=load)
6088
6089
6090 _dataset_can_crushed_hdf = _SingleFileDownloadableDatasetLoader('hdf/can-vtu.hdf')
6091
6092
6093 @_deprecate_positional_args
6094 def download_can_crushed_vtu(load=True): # noqa: FBT002
6095 """Download the crushed can dataset.
6096
6097 File obtained from `Kitware <https://www.kitware.com/>`_. Used
6098 for testing vtu files.
6099
6100 Originally from VTKDataFiles-9.3.0.tar.gz.
6101
6102 Parameters
6103 ----------
6104 load : bool, default: True
6105 Load the dataset after downloading it when ``True``. Set this
6106 to ``False`` and only the filename will be returned.
6107
6108 Returns
6109 -------
6110 output : pyvista.UnstructuredGrid | str
6111 Crushed can dataset or path depending on the value of ``load``.
6112
6113 Examples
6114 --------
6115 Plot the crushed can dataset.
6116
6117 >>> from pyvista import examples
6118 >>> import pyvista as pv
6119 >>> dataset = examples.download_can_crushed_vtu()
6120 >>> dataset.plot(smooth_shading=True)
6121
6122 .. seealso::
6123
6124 :ref:`Can Crushed Vtu Dataset <can_crushed_vtu_dataset>`
6125 See this dataset in the Dataset Gallery for more info.
6126
6127 :ref:`Can Crushed Hdf Dataset <can_crushed_hdf_dataset>`
6128
6129 """
6130 return _download_dataset(_dataset_can_crushed_vtu, load=load)
6131
6132
6133 _dataset_can_crushed_vtu = _SingleFileDownloadableDatasetLoader('can.vtu')
6134
6135
6136 @_deprecate_positional_args
6137 def download_cgns_structured(load=True): # noqa: FBT002
6138 """Download the structured CGNS dataset mesh.
6139
6140 Originally downloaded from `CFD General Notation System Example Files
6141 <https://cgns.org/current/examples.html#constricting-channel>`_
6142
6143 Parameters
6144 ----------
6145 load : bool, default: True
6146 Load the dataset after downloading it when ``True``. Set this
6147 to ``False`` and only the filename will be returned.
6148
6149 Returns
6150 -------
6151 output : pyvista.MultiBlock | str
6152 Structured, 12 block, 3-D constricting channel, with example use of
6153 Family_t for BCs (ADF type). If ``load`` is ``False``, then the path of the
6154 example CGNS file is returned.
6155
6156 Examples
6157 --------
6158 Plot the example CGNS dataset.
6159
6160 >>> from pyvista import examples
6161 >>> import pyvista as pv
6162 >>> dataset = examples.download_cgns_structured()
6163 >>> dataset[0].plot(scalars='Density')
6164
6165 .. seealso::
6166
6167 :ref:`Cgns Structured Dataset <cgns_structured_dataset>`
6168 See this dataset in the Dataset Gallery for more info.
6169
6170 :ref:`Cgns Multi Dataset <cgns_multi_dataset>`
6171
6172 """
6173 return _download_dataset(_dataset_cgns_structured, load=load)
6174
6175
6176 _dataset_cgns_structured = _SingleFileDownloadableDatasetLoader('cgns/sqnz_s.adf.cgns')
6177
6178
6179 @_deprecate_positional_args
6180 def download_tecplot_ascii(load=True): # noqa: FBT002
6181 """Download the single block ASCII Tecplot dataset.
6182
6183 Originally downloaded from Paul Bourke's
6184 `Sample file <http://paulbourke.net/dataformats/tp/sample.tp>`_
6185
6186 Parameters
6187 ----------
6188 load : bool, default: True
6189 Load the dataset after downloading it when ``True``. Set this
6190 to ``False`` and only the filename will be returned.
6191
6192 Returns
6193 -------
6194 output : pyvista.MultiBlock | str
6195 Multiblock format with only 1 data block, simple geometric shape.
6196 If ``load`` is ``False``, then the path of the example Tecplot file
6197 is returned.
6198
6199 Examples
6200 --------
6201 Plot the example Tecplot dataset.
6202
6203 >>> from pyvista import examples
6204 >>> import pyvista as pv
6205 >>> dataset = examples.download_tecplot_ascii()
6206 >>> dataset.plot()
6207
6208 .. seealso::
6209
6210 :ref:`Tecplot Ascii Dataset <tecplot_ascii_dataset>`
6211 See this dataset in the Dataset Gallery for more info.
6212
6213 """
6214 return _download_dataset(_dataset_tecplot_ascii, load=load)
6215
6216
6217 _dataset_tecplot_ascii = _SingleFileDownloadableDatasetLoader('tecplot_ascii.dat')
6218
6219
6220 @_deprecate_positional_args
6221 def download_cgns_multi(load=True): # noqa: FBT002
6222 """Download a multielement airfoil with a cell centered solution.
6223
6224 Originally downloaded from `CFD General Notation System Example Files
6225 <https://cgns.org/current/examples.html#d-multielement-airfoil>`_
6226
6227 Parameters
6228 ----------
6229 load : bool, default: True
6230 Load the dataset after downloading it when ``True``. Set this
6231 to ``False`` and only the filename will be returned.
6232
6233 Returns
6234 -------
6235 output : pyvista.MultiBlock | str
6236 Structured, 4 blocks, 2D (2 planes in third dimension) multielement
6237 airfoil, with cell centered solution. If ``load`` is ``False``, then the path of the
6238 example CGNS file is returned.
6239
6240 Examples
6241 --------
6242 Plot the airfoil dataset. Merge the multi-block and then plot the airfoil's
6243 ``"ViscosityEddy"``. Convert the cell data to point data as in this
6244 dataset, the solution is stored within the cells.
6245
6246 >>> from pyvista import examples
6247 >>> import pyvista as pv
6248 >>> dataset = examples.download_cgns_multi()
6249 >>> ugrid = dataset.combine()
6250 >>> ugrid = ugrid = ugrid.cell_data_to_point_data()
6251 >>> ugrid.plot(
6252 ... cmap='bwr',
6253 ... scalars='ViscosityEddy',
6254 ... zoom=4,
6255 ... cpos='xz',
6256 ... show_scalar_bar=False,
6257 ... )
6258
6259 .. seealso::
6260
6261 :ref:`Cgns Multi Dataset <cgns_multi_dataset>`
6262 See this dataset in the Dataset Gallery for more info.
6263
6264 :ref:`Cgns Structured Dataset <cgns_structured_dataset>`
6265
6266 """
6267 return _download_dataset(_dataset_cgns_multi, load=load)
6268
6269
6270 def _cgns_multi_read_func(filename):
6271 reader = pv.get_reader(filename)
6272 # Disable reading the boundary patch. This generates messages like
6273 # "Skipping BC_t node: BC_t type 'BCFarfield' not supported yet."
6274 reader.load_boundary_patch = False
6275 return reader.read()
6276
6277
6278 _dataset_cgns_multi = _SingleFileDownloadableDatasetLoader(
6279 'cgns/multi.cgns',
6280 read_func=_cgns_multi_read_func,
6281 )
6282
6283
6284 @_deprecate_positional_args
6285 def download_dicom_stack(
6286 load: bool = True, # noqa: FBT001, FBT002
6287 ) -> ImageData | str:
6288 """Download TCIA DICOM stack volume.
6289
6290 Original download from the `The Cancer Imaging Archive (TCIA)
6291 <https://www.cancerimagingarchive.net/>`_. This is part of the
6292 Clinical Proteomic Tumor Analysis Consortium Sarcomas (CPTAC-SAR)
6293 collection.
6294
6295 The CPTAC-SAR collection is distributed under the `Creative Commons
6296 Attribution 3.0 Unported License (CC BY 3.0)
6297 <https://creativecommons.org/licenses/by/3.0/>`_. Use of this dataset
6298 requires attribution (see the citations below) and is subject to the
6299 `TCIA Data Usage Policy
6300 <https://www.cancerimagingarchive.net/data-usage-policies-and-restrictions/>`_,
6301 which prohibits using the data to identify or contact the individual
6302 participants.
6303
6304 Parameters
6305 ----------
6306 load : bool, default: True
6307 Load the dataset after downloading it when ``True``. Set this
6308 to ``False`` and only the filename will be returned.
6309
6310 Returns
6311 -------
6312 output : pyvista.ImageData | str
6313 DataSet or path depending on ``load``.
6314
6315 References
6316 ----------
6317 * **Data Citation**
6318
6319 National Cancer Institute Clinical Proteomic Tumor Analysis Consortium
6320 (CPTAC). (2018). Radiology Data from the Clinical Proteomic Tumor
6321 Analysis Consortium Sarcomas [CPTAC-SAR] collection [Data set]. The
6322 Cancer Imaging Archive. DOI: 10.7937/TCIA.2019.9bt23r95
6323
6324 * **Acknowledgement**
6325
6326 Data used in this publication were generated by the National Cancer Institute Clinical
6327 Proteomic Tumor Analysis Consortium (CPTAC).
6328
6329 * **TCIA Citation**
6330
6331 Clark K, Vendt B, Smith K, Freymann J, Kirby J, Koppel P, Moore S, Phillips S,
6332 Maffitt D, Pringle M, Tarbox L, Prior F. The Cancer Imaging Archive (TCIA):
6333 Maintaining and Operating a Public Information Repository, Journal of Digital Imaging,
6334 Volume 26, Number 6, December, 2013, pp 1045-1057. doi: 10.1007/s10278-013-9622-7
6335
6336 Examples
6337 --------
6338 >>> from pyvista import examples
6339 >>> dataset = examples.download_dicom_stack()
6340 >>> dataset.plot(volume=True, zoom=3, show_scalar_bar=False)
6341
6342 .. seealso::
6343
6344 :ref:`Dicom Stack Dataset <dicom_stack_dataset>`
6345 See this dataset in the Dataset Gallery for more info.
6346
6347 :ref:`medical_dataset_gallery`
6348 Browse other medical datasets.
6349
6350 """
6351 return _download_dataset(_dataset_dicom_stack, load=load)
6352
6353
6354 _dataset_dicom_stack = _SingleFileDownloadableDatasetLoader(
6355 'DICOM_Stack/data.zip',
6356 target_file='data',
6357 )
6358
6359
6360 @_deprecate_positional_args
6361 def download_parched_canal_4k(load=True): # noqa: FBT002
6362 """Download parched canal 4k dataset.
6363
6364 Parameters
6365 ----------
6366 load : bool, default: True
6367 Load the dataset after downloading it when ``True``. Set this
6368 to ``False`` and only the filename will be returned.
6369
6370 Returns
6371 -------
6372 output : pyvista.Texture | str
6373 DataSet or filename depending on ``load``.
6374
6375 Examples
6376 --------
6377 .. pyvista-plot::
6378 :force_static:
6379
6380 >>> from pyvista import examples
6381 >>> texture = examples.download_parched_canal_4k()
6382 >>> texture.dimensions
6383 (4096, 2048)
6384
6385 Use :meth:`~pyvista.ImageDataFilters.resample` to downsample the texture's
6386 underlying image before plotting.
6387
6388 >>> _ = texture.to_image().resample(0.25, inplace=True)
6389 >>> texture.dimensions
6390 (1024, 512)
6391
6392 >>> texture.plot(cpos='xy')
6393
6394 .. seealso::
6395
6396 :ref:`Parched Canal 4k Dataset <parched_canal_4k_dataset>`
6397 See this dataset in the Dataset Gallery for more info.
6398
6399 :ref:`Dikhololo Night Dataset <dikhololo_night_dataset>`
6400 Another HDR texture.
6401
6402 """
6403 return _download_dataset(_dataset_parched_canal_4k, load=load)
6404
6405
6406 _dataset_parched_canal_4k = _SingleFileDownloadableDatasetLoader(
6407 'parched_canal_4k.hdr',
6408 read_func=read_texture,
6409 )
6410
6411
6412 @_deprecate_positional_args
6413 def download_cells_nd(load=True): # noqa: FBT002
6414 """Download example AVS UCD dataset.
6415
6416 Parameters
6417 ----------
6418 load : bool, default: True
6419 Load the dataset after downloading it when ``True``. Set this
6420 to ``False`` and only the filename will be returned.
6421
6422 Returns
6423 -------
6424 output : pyvista.UnstructuredGrid | str
6425 DataSet or filename depending on ``load``.
6426
6427 Examples
6428 --------
6429 >>> from pyvista import examples
6430 >>> dataset = examples.download_cells_nd()
6431 >>> dataset.plot(cpos='xy')
6432
6433 .. seealso::
6434
6435 :ref:`Cells Nd Dataset <cells_nd_dataset>`
6436 See this dataset in the Dataset Gallery for more info.
6437
6438 """
6439 return _download_dataset(_dataset_cells_nd, load=load)
6440
6441
6442 _dataset_cells_nd = _SingleFileDownloadableDatasetLoader('cellsnd.ascii.inp')
6443
6444
6445 @_deprecate_positional_args
6446 def download_moonlanding_image(load=True): # noqa: FBT002
6447 """Download the Moon landing image.
6448
6449 This is a noisy image originally obtained from `Scipy Lecture Notes
6450 <https://scipy-lectures.org/index.html>`_ and can be used to demonstrate a
6451 low pass filter.
6452
6453 See the `scipy-lectures license
6454 <http://scipy-lectures.org/preface.html#license>`_ for more details
6455 regarding this image's use and distribution.
6456
6457 Parameters
6458 ----------
6459 load : bool, default: True
6460 Load the dataset after downloading it when ``True``. Set this
6461 to ``False`` and only the filename will be returned.
6462
6463 Returns
6464 -------
6465 output : pyvista.ImageData | str
6466 ``DataSet`` or filename depending on ``load``.
6467
6468 Examples
6469 --------
6470 >>> from pyvista import examples
6471 >>> dataset = examples.download_moonlanding_image()
6472 >>> dataset.plot(
6473 ... cpos='xy',
6474 ... cmap='gray',
6475 ... background='w',
6476 ... show_scalar_bar=False,
6477 ... )
6478
6479 .. seealso::
6480
6481 :ref:`Moonlanding Image Dataset <moonlanding_image_dataset>`
6482 See this dataset in the Dataset Gallery for more info.
6483
6484 :ref:`image_fft_example`
6485 Full example using this dataset.
6486
6487 """
6488 return _download_dataset(_dataset_moonlanding_image, load=load)
6489
6490
6491 _dataset_moonlanding_image = _SingleFileDownloadableDatasetLoader('moonlanding.png')
6492
6493
6494 @_deprecate_positional_args
6495 def download_angular_sector(load=True): # noqa: FBT002
6496 """Download the angular sector dataset.
6497
6498 Parameters
6499 ----------
6500 load : bool, default: True
6501 Load the dataset after downloading it when ``True``. Set this
6502 to ``False`` and only the filename will be returned.
6503
6504 Returns
6505 -------
6506 output : pyvista.UnstructuredGrid | str
6507 DataSet or filename depending on ``load``.
6508
6509 Examples
6510 --------
6511 >>> from pyvista import examples
6512 >>> dataset = examples.download_angular_sector()
6513 >>> dataset.plot(scalars='PointId')
6514
6515 .. seealso::
6516
6517 :ref:`Angular Sector Dataset <angular_sector_dataset>`
6518 See this dataset in the Dataset Gallery for more info.
6519
6520 """
6521 return _download_dataset(_dataset_angular_sector, load=load)
6522
6523
6524 _dataset_angular_sector = _SingleFileDownloadableDatasetLoader('AngularSector.vtk')
6525
6526
6527 @_deprecate_positional_args
6528 def download_mount_damavand(load=True): # noqa: FBT002
6529 """Download the Mount Damavand dataset.
6530
6531 Visualize 3D models of Damavand Volcano, Alborz, Iran. This is a 2D map
6532 with the altitude embedded as ``'z'`` cell data within the
6533 :class:`pyvista.PolyData`.
6534
6535 Originally posted at `banesullivan/damavand-volcano
6536 <https://github.com/banesullivan/damavand-volcano>`_.
6537
6538 Parameters
6539 ----------
6540 load : bool, default: True
6541 Load the dataset after downloading it when ``True``. Set this
6542 to ``False`` and only the filename will be returned.
6543
6544 Returns
6545 -------
6546 output : pyvista.PolyData | str
6547 DataSet or filename depending on ``load``.
6548
6549 Examples
6550 --------
6551 Download the Damavand dataset and plot it after warping it by its altitude.
6552
6553 >>> from pyvista import examples
6554 >>> dataset = examples.download_mount_damavand()
6555 >>> dataset = dataset.cell_data_to_point_data()
6556 >>> dataset = dataset.warp_by_scalar('z', factor=2)
6557 >>> dataset.plot(cmap='gist_earth', show_scalar_bar=False)
6558
6559 .. seealso::
6560
6561 :ref:`Mount Damavand Dataset <mount_damavand_dataset>`
6562 See this dataset in the Dataset Gallery for more info.
6563
6564 """
6565 return _download_dataset(_dataset_mount_damavand, load=load)
6566
6567
6568 _dataset_mount_damavand = _SingleFileDownloadableDatasetLoader('AOI.Damavand.32639.vtp')
6569
6570
6571 @_deprecate_positional_args
6572 def download_particles_lethe(load=True): # noqa: FBT002
6573 """Download a particles dataset generated by `lethe <https://github.com/lethe-cfd/lethe>`_ .
6574
6575 See `PyVista discussions #1984
6576 <https://github.com/pyvista/pyvista/discussions/1984>`_
6577
6578 Parameters
6579 ----------
6580 load : bool, default: True
6581 Load the dataset after downloading it when ``True``. Set this
6582 to ``False`` and only the filename will be returned.
6583
6584 Returns
6585 -------
6586 output : pyvista.UnstructuredGrid | str
6587 DataSet or filename depending on ``load``.
6588
6589 Examples
6590 --------
6591 Download the particles dataset and plot it after generating glyphs.
6592
6593 >>> from pyvista import examples
6594 >>> particles = examples.download_particles_lethe()
6595 >>> particles.plot(
6596 ... render_points_as_spheres=True,
6597 ... style='points',
6598 ... scalars='Velocity',
6599 ... background='w',
6600 ... scalar_bar_args={'color': 'k'},
6601 ... cmap='bwr',
6602 ... )
6603
6604 .. seealso::
6605
6606 :ref:`Particles Lethe Dataset <particles_lethe_dataset>`
6607 See this dataset in the Dataset Gallery for more info.
6608
6609 """
6610 return _download_dataset(_dataset_particles_lethe, load=load)
6611
6612
6613 _dataset_particles_lethe = _SingleFileDownloadableDatasetLoader(
6614 'lethe/result_particles.20000.0000.vtu',
6615 )
6616
6617
6618 @_deprecate_positional_args
6619 def download_gif_simple(load=True): # noqa: FBT002
6620 """Download a simple three frame GIF.
6621
6622 Parameters
6623 ----------
6624 load : bool, default: True
6625 Load the dataset after downloading it when ``True``. Set this
6626 to ``False`` and only the filename will be returned.
6627
6628 Returns
6629 -------
6630 output : pyvista.ImageData | str
6631 DataSet or filename depending on ``load``.
6632
6633 Examples
6634 --------
6635 Download and plot the first frame of a simple GIF.
6636
6637 >>> from pyvista import examples
6638 >>> grid = examples.download_gif_simple()
6639 >>> grid.plot(
6640 ... scalars='frame0',
6641 ... rgb=True,
6642 ... background='w',
6643 ... show_scalar_bar=False,
6644 ... cpos='xy',
6645 ... )
6646
6647 Plot the second frame.
6648
6649 >>> grid.plot(
6650 ... scalars='frame1',
6651 ... rgb=True,
6652 ... background='w',
6653 ... show_scalar_bar=False,
6654 ... cpos='xy',
6655 ... )
6656
6657 .. seealso::
6658
6659 :ref:`Gif Simple Dataset <gif_simple_dataset>`
6660 See this dataset in the Dataset Gallery for more info.
6661
6662 """
6663 return _download_dataset(_dataset_gif_simple, load=load)
6664
6665
6666 _dataset_gif_simple = _SingleFileDownloadableDatasetLoader('gifs/sample.gif')
6667
6668
6669 @_deprecate_positional_args
6670 def download_cloud_dark_matter(load=True): # noqa: FBT002
6671 """Download particles from a simulated dark matter halo.
6672
6673 This dataset contains 32,314 particles.
6674
6675 Parameters
6676 ----------
6677 load : bool, default: True
6678 Load the dataset after downloading it when ``True``. Set this
6679 to ``False`` and only the filename will be returned.
6680
6681 Returns
6682 -------
6683 output : pyvista.PointSet | str
6684 DataSet or filename depending on ``load``.
6685
6686 Examples
6687 --------
6688 Download the dark matter cloud and display its representation.
6689
6690 >>> import numpy as np
6691 >>> from pyvista import examples
6692 >>> pc = examples.download_cloud_dark_matter()
6693 >>> pc
6694 PointSet (...)
6695 N Cells: 0
6696 N Points: 32314
6697 X Bounds: 7.451e+01, 7.892e+01
6698 Y Bounds: 1.616e+01, 2.275e+01
6699 Z Bounds: 8.900e+01, 9.319e+01
6700 N Arrays: 0
6701
6702 Plot the point cloud. Color based on the distance from the center of the
6703 cloud.
6704
6705 >>> pc.plot(
6706 ... scalars=np.linalg.norm(pc.points - pc.center, axis=1),
6707 ... style='points_gaussian',
6708 ... opacity=0.5,
6709 ... point_size=1.5,
6710 ... show_scalar_bar=False,
6711 ... zoom=2,
6712 ... )
6713
6714 .. seealso::
6715
6716 :ref:`Cloud Dark Matter Dataset <cloud_dark_matter_dataset>`
6717 See this dataset in the Dataset Gallery for more info.
6718
6719 :ref:`Cloud Dark Matter Dense Dataset <cloud_dark_matter_dense_dataset>`
6720
6721 :ref:`point_clouds_example`
6722 Full example using this dataset
6723
6724 """
6725 return _download_dataset(_dataset_cloud_dark_matter, load=load)
6726
6727
6728 _dataset_cloud_dark_matter = _SingleFileDownloadableDatasetLoader(
6729 'point-clouds/findus23/halo_low_res.npy',
6730 read_func=np.load,
6731 load_func=pv.PointSet,
6732 )
6733
6734
6735 @_deprecate_positional_args
6736 def download_cloud_dark_matter_dense(load=True): # noqa: FBT002
6737 """Download a particles from a simulated dark matter halo.
6738
6739 This dataset contains 2,062,256 particles.
6740
6741 Parameters
6742 ----------
6743 load : bool, default: True
6744 Load the dataset after downloading it when ``True``. Set this
6745 to ``False`` and only the filename will be returned.
6746
6747 Returns
6748 -------
6749 output : pyvista.PointSet | str
6750 DataSet or filename depending on ``load``.
6751
6752 Examples
6753 --------
6754 Download the dark matter cloud and display its representation.
6755
6756 >>> import numpy as np
6757 >>> from pyvista import examples
6758 >>> pc = examples.download_cloud_dark_matter_dense()
6759 >>> pc
6760 PointSet (...)
6761 N Cells: 0
6762 N Points: 2062256
6763 X Bounds: 7.462e+01, 7.863e+01
6764 Y Bounds: 1.604e+01, 2.244e+01
6765 Z Bounds: 8.893e+01, 9.337e+01
6766 N Arrays: 0
6767
6768 Plot the point cloud. Color based on the distance from the center of the
6769 cloud.
6770
6771 >>> pc.plot(
6772 ... scalars=np.linalg.norm(pc.points - pc.center, axis=1),
6773 ... style='points_gaussian',
6774 ... opacity=0.030,
6775 ... point_size=2.0,
6776 ... show_scalar_bar=False,
6777 ... zoom=2,
6778 ... )
6779
6780 .. seealso::
6781
6782 :ref:`Cloud Dark Matter Dense Dataset <cloud_dark_matter_dense_dataset>`
6783 See this dataset in the Dataset Gallery for more info.
6784
6785 :ref:`Cloud Dark Matter Dataset <cloud_dark_matter_dataset>`
6786
6787 :ref:`point_clouds_example`
6788 More details on how to plot point clouds.
6789
6790 """
6791 return _download_dataset(_dataset_cloud_dark_matter_dense, load=load)
6792
6793
6794 _dataset_cloud_dark_matter_dense = _SingleFileDownloadableDatasetLoader(
6795 'point-clouds/findus23/halo_high_res.npy',
6796 read_func=np.load,
6797 load_func=pv.PointSet,
6798 )
6799
6800
6801 @_deprecate_positional_args
6802 def download_stars_cloud_hyg(load=True): # noqa: FBT002
6803 """Download a point cloud of stars as computed by the HYG Database.
6804
6805 See `HYG-Database <https://github.com/astronexus/HYG-Database>`_ for more
6806 details.
6807
6808 This data set is licensed by a Creative Commons Attribution-ShareAlike
6809 license. For more details, read the `Creative Commons page
6810 <https://creativecommons.org/licenses/by-sa/2.5/>`_
6811
6812 See the `README.md
6813 <https://github.com/pyvista/data/blob/master/Data/point-clouds/hyg-database/README.md>`_
6814 for more details for how the star colors were computed.
6815
6816 Distances are in parsecs from Earth.
6817
6818 Parameters
6819 ----------
6820 load : bool, default: True
6821 Load the dataset after downloading it when ``True``. Set this
6822 to ``False`` and only the filename will be returned.
6823
6824 Returns
6825 -------
6826 output : pyvista.PolyData | str
6827 DataSet or filename depending on ``load``.
6828
6829 Examples
6830 --------
6831 Download and plot a point cloud of stars within 3,000 light years. Stars
6832 are colored according to their RGBA colors.
6833
6834 >>> import numpy as np
6835 >>> from pyvista import examples
6836 >>> stars = examples.download_stars_cloud_hyg()
6837 >>> stars.plot(
6838 ... style='points_gaussian',
6839 ... background='k',
6840 ... point_size=0.5,
6841 ... scalars='_rgba',
6842 ... render_points_as_spheres=False,
6843 ... zoom=3.0,
6844 ... )
6845
6846 >>> stars
6847 PolyData (...)
6848 N Cells: 107857
6849 N Points: 107857
6850 N Strips: 0
6851 X Bounds: -9.755e+02, 9.774e+02
6852 Y Bounds: -9.620e+02, 9.662e+02
6853 Z Bounds: -9.788e+02, 9.702e+02
6854 N Arrays: 3
6855
6856 .. seealso::
6857
6858 :ref:`Stars Cloud Hyg Dataset <stars_cloud_hyg_dataset>`
6859 See this dataset in the Dataset Gallery for more info.
6860
6861 :ref:`point_clouds_example`
6862 More details on how to plot point clouds.
6863
6864 """
6865 return _download_dataset(_dataset_stars_cloud_hyg, load=load)
6866
6867
6868 _dataset_stars_cloud_hyg = _SingleFileDownloadableDatasetLoader(
6869 'point-clouds/hyg-database/stars.vtp',
6870 )
6871
6872
6873 @_deprecate_positional_args
6874 def download_fea_bracket(load=True): # noqa: FBT002
6875 """Download the finite element solution of a bracket.
6876
6877 Contains von-mises equivalent cell stress assuming a vertical (y-axis) load.
6878
6879 Parameters
6880 ----------
6881 load : bool, default: True
6882 Load the dataset after downloading it when ``True``. Set this
6883 to ``False`` and only the filename will be returned.
6884
6885 Returns
6886 -------
6887 output : pyvista.UnstructuredGrid | str
6888 DataSet or filename depending on ``load``.
6889
6890 Examples
6891 --------
6892 Download and plot equivalent cell stress.
6893
6894 >>> from pyvista import examples
6895 >>> grid = examples.download_fea_bracket()
6896 >>> grid.plot()
6897
6898 Plot the point stress using the ``'jet'`` color map. Convert the cell data
6899 to point data.
6900
6901 >>> from pyvista import examples
6902 >>> grid = examples.download_fea_bracket()
6903 >>> grid = grid.cell_data_to_point_data()
6904 >>> grid.plot(smooth_shading=True, split_sharp_edges=True, cmap='jet')
6905
6906 .. seealso::
6907
6908 :ref:`Fea Bracket Dataset <fea_bracket_dataset>`
6909 See this dataset in the Dataset Gallery for more info.
6910
6911 :ref:`Fea Hertzian Contact Cylinder Dataset <fea_hertzian_contact_cylinder_dataset>`
6912
6913 :ref:`Aero Bracket Dataset <aero_bracket_dataset>`
6914
6915 :ref:`Notch Stress Dataset <notch_stress_dataset>`
6916
6917 :ref:`Notch Displacement Dataset <notch_displacement_dataset>`
6918
6919 """
6920 return _download_dataset(_dataset_fea_bracket, load=load)
6921
6922
6923 _dataset_fea_bracket = _SingleFileDownloadableDatasetLoader('fea/kiefer/dataset.vtu')
6924
6925
6926 @_deprecate_positional_args
6927 def download_fea_hertzian_contact_cylinder(load=True): # noqa: FBT002
6928 """Download a hertzian contact finite element solution.
6929
6930 Hertzian contact is referred to the frictionless contact between two
6931 bodies. Spherical contact is a special case of the Hertz contact, which is
6932 between two spheres, or as in the case of this dataset, between a sphere
6933 and the surface of a half space (flat plane).
6934
6935 Parameters
6936 ----------
6937 load : bool, default: True
6938 Load the dataset after downloading it when ``True``. Set this
6939 to ``False`` and only the filename will be returned.
6940
6941 Returns
6942 -------
6943 output : pyvista.UnstructuredGrid | str
6944 DataSet or filename depending on ``load``.
6945
6946 Examples
6947 --------
6948 Plot by part ID.
6949
6950 >>> import numpy as np
6951 >>> import pyvista as pv
6952 >>> from pyvista import examples
6953 >>> grid = examples.download_fea_hertzian_contact_cylinder()
6954 >>> grid.plot(scalars='PartID', cmap=['green', 'blue'], show_scalar_bar=False)
6955
6956 Plot the absolute value of the component stress in the Z direction.
6957
6958 >>> pl = pv.Plotter()
6959 >>> z_stress = np.abs(grid['Stress'][:, 2])
6960 >>> _ = pl.add_mesh(
6961 ... grid,
6962 ... scalars=z_stress,
6963 ... clim=[0, 1.2e9],
6964 ... cmap='jet',
6965 ... lighting=True,
6966 ... show_edges=False,
6967 ... ambient=0.2,
6968 ... )
6969 >>> pl.camera_position = 'xz'
6970 >>> pl.camera.zoom(1.4)
6971 >>> pl.show()
6972
6973 .. seealso::
6974
6975 :ref:`Fea Hertzian Contact Cylinder Dataset <fea_hertzian_contact_cylinder_dataset>`
6976 See this dataset in the Dataset Gallery for more info.
6977
6978 :ref:`fea_hertzian_contact_pressure_example`
6979
6980 :ref:`Fea Bracket Dataset <fea_bracket_dataset>`
6981
6982 :ref:`Aero Bracket Dataset <aero_bracket_dataset>`
6983
6984 :ref:`Notch Stress Dataset <notch_stress_dataset>`
6985
6986 :ref:`Notch Displacement Dataset <notch_displacement_dataset>`
6987
6988
6989 """
6990 return _download_dataset(_dataset_fea_hertzian_contact_cylinder, load=load)
6991
6992
6993 _dataset_fea_hertzian_contact_cylinder = _SingleFileDownloadableDatasetLoader(
6994 'fea/hertzian_contact_cylinder/Hertzian_cylinder_on_plate.zip',
6995 target_file='bfac9fd1-e982-4825-9a95-9e5d8c5b4d3e_result_1.pvtu',
6996 )
6997
6998
6999 @_deprecate_positional_args
7000 def download_black_vase(load=True, *, high_resolution=False): # noqa: FBT002
7001 """Download a black vase scan created by Ivan Nikolov.
7002
7003 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7004 Close-range SfM Software Performance under Varying Capturing Conditions
7005 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7006
7007 Original datasets are under the CC BY 4.0 license.
7008
7009 For more details, see `Ivan Nikolov Datasets
7010 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7011
7012 .. versionchanged:: 0.45
7013
7014 A decimated version of this dataset with 31 thousand cells is now returned.
7015 Previously, a high-resolution version with 3.1 million cells was returned.
7016 Use ``high_resolution=True`` for the high-resolution version.
7017
7018 Parameters
7019 ----------
7020 load : bool, default: True
7021 Load the dataset after downloading it when ``True``. Set this
7022 to ``False`` and only the filename will be returned.
7023
7024 high_resolution : bool, default: False
7025 Set this to ``True`` to return a high-resolution version of this dataset.
7026 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7027 is returned with 99% reduction.
7028
7029 .. versionadded:: 0.45
7030
7031 Returns
7032 -------
7033 output : pyvista.PolyData | str
7034 DataSet or filename depending on ``load``.
7035
7036 Examples
7037 --------
7038 Download and plot the dataset.
7039
7040 >>> from pyvista import examples
7041 >>> mesh = examples.download_black_vase()
7042 >>> mesh.plot()
7043
7044 Return the statistics of the dataset.
7045
7046 >>> mesh
7047 PolyData (...)
7048 N Cells: 31366
7049 N Points: 17337
7050 N Strips: 0
7051 X Bounds: -1.091e+02, 1.533e+02
7052 Y Bounds: -1.200e+02, 1.416e+02
7053 Z Bounds: 1.667e+01, 4.078e+02
7054 N Arrays: 0
7055
7056 .. seealso::
7057
7058 :ref:`Black Vase Dataset <black_vase_dataset>`
7059 See this dataset in the Dataset Gallery for more info.
7060
7061 """
7062 if high_resolution:
7063 return _download_dataset(__dataset_black_vase_high_res, load=load)
7064 return _download_dataset(_dataset_black_vase, load=load)
7065
7066
7067 _dataset_black_vase = _SingleFileDownloadableDatasetLoader(
7068 'ivan-nikolov/blackVase_decimated.vtp',
7069 )
7070 __dataset_black_vase_high_res = _SingleFileDownloadableDatasetLoader(
7071 'ivan-nikolov/blackVase.zip',
7072 target_file='blackVase.vtp',
7073 )
7074
7075
7076 @_deprecate_positional_args
7077 def download_ivan_angel(load=True, *, high_resolution=False): # noqa: FBT002
7078 """Download a scan of an angel statue created by Ivan Nikolov.
7079
7080 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7081 Close-range SfM Software Performance under Varying Capturing Conditions
7082 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7083
7084 Original datasets are under the CC BY 4.0 license.
7085
7086 For more details, see `Ivan Nikolov Datasets
7087 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7088
7089 .. versionchanged:: 0.45
7090
7091 A decimated version of this dataset with 36 thousand cells is now returned.
7092 Previously, a high-resolution version with 3.6 million cells was returned.
7093 Use ``high_resolution=True`` for the high-resolution version.
7094
7095 Parameters
7096 ----------
7097 load : bool, default: True
7098 Load the dataset after downloading it when ``True``. Set this
7099 to ``False`` and only the filename will be returned.
7100
7101 high_resolution : bool, default: False
7102 Set this to ``True`` to return a high-resolution version of this dataset.
7103 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7104 is returned with 99% reduction.
7105
7106 .. versionadded:: 0.45
7107
7108 Returns
7109 -------
7110 output : pyvista.PolyData | str
7111 DataSet or filename depending on ``load``.
7112
7113 Examples
7114 --------
7115 Download and plot the dataset.
7116
7117 >>> from pyvista import examples
7118 >>> import pyvista as pv
7119 >>> mesh = examples.download_ivan_angel()
7120 >>> cpos = pv.CameraPosition(
7121 ... position=(-476.14, -393.73, 282.14),
7122 ... focal_point=(-15.00, 11.25, 44.08),
7123 ... viewup=(0.26, 0.24, 0.93),
7124 ... )
7125 >>> mesh.plot(cpos=cpos)
7126
7127 Return the statistics of the dataset.
7128
7129 >>> mesh
7130 PolyData (...)
7131 N Cells: 35804
7132 N Points: 18412
7133 N Strips: 0
7134 X Bounds: -1.146e+02, 8.470e+01
7135 Y Bounds: -6.987e+01, 9.254e+01
7136 Z Bounds: -1.166e+02, 2.052e+02
7137 N Arrays: 0
7138
7139 .. seealso::
7140
7141 :ref:`Ivan Angel Dataset <ivan_angel_dataset>`
7142 See this dataset in the Dataset Gallery for more info.
7143
7144 """
7145 if high_resolution:
7146 return _download_dataset(__dataset_ivan_angel_high_res, load=load)
7147 return _download_dataset(_dataset_ivan_angel, load=load)
7148
7149
7150 _dataset_ivan_angel = _SingleFileDownloadableDatasetLoader(
7151 'ivan-nikolov/Angel_decimated.vtp',
7152 )
7153 __dataset_ivan_angel_high_res = _SingleFileDownloadableDatasetLoader(
7154 'ivan-nikolov/Angel.zip',
7155 target_file='Angel.vtp',
7156 )
7157
7158
7159 @_deprecate_positional_args
7160 def download_bird_bath(load=True, *, high_resolution=False): # noqa: FBT002
7161 """Download a scan of a bird bath created by Ivan Nikolov.
7162
7163 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7164 Close-range SfM Software Performance under Varying Capturing Conditions
7165 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7166
7167 Original datasets are under the CC BY 4.0 license.
7168
7169 For more details, see `Ivan Nikolov Datasets
7170 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7171
7172 .. versionchanged:: 0.45
7173
7174 A decimated version of this dataset with 35 thousand cells is now returned.
7175 Previously, a high-resolution version with 3.5 million cells was returned.
7176 Use ``high_resolution=True`` for the high-resolution version.
7177
7178 Parameters
7179 ----------
7180 load : bool, default: True
7181 Load the dataset after downloading it when ``True``. Set this
7182 to ``False`` and only the filename will be returned.
7183
7184 high_resolution : bool, default: False
7185 Set this to ``True`` to return a high-resolution version of this dataset.
7186 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7187 is returned with 99% reduction.
7188
7189 .. versionadded:: 0.45
7190
7191 Returns
7192 -------
7193 output : pyvista.PolyData | str
7194 DataSet or filename depending on ``load``.
7195
7196 Examples
7197 --------
7198 Download and plot the dataset.
7199
7200 >>> from pyvista import examples
7201 >>> mesh = examples.download_bird_bath()
7202 >>> mesh.plot()
7203
7204 Return the statistics of the dataset.
7205
7206 >>> mesh
7207 PolyData (...)
7208 N Cells: 35079
7209 N Points: 18796
7210 N Strips: 0
7211 X Bounds: -1.600e+02, 1.482e+02
7212 Y Bounds: -1.522e+02, 1.547e+02
7213 Z Bounds: -5.491e-01, 1.408e+02
7214 N Arrays: 0
7215
7216 .. seealso::
7217
7218 :ref:`Bird Bath Dataset <bird_bath_dataset>`
7219 See this dataset in the Dataset Gallery for more info.
7220
7221 """
7222 if high_resolution:
7223 return _download_dataset(__dataset_bird_bath_high_res, load=load)
7224 return _download_dataset(_dataset_bird_bath, load=load)
7225
7226
7227 _dataset_bird_bath = _SingleFileDownloadableDatasetLoader('ivan-nikolov/birdBath_decimated.vtp')
7228 __dataset_bird_bath_high_res = _SingleFileDownloadableDatasetLoader(
7229 'ivan-nikolov/birdBath.zip',
7230 target_file='birdBath.vtp',
7231 )
7232
7233
7234 @_deprecate_positional_args
7235 def download_owl(load=True, *, high_resolution=False): # noqa: FBT002
7236 """Download a scan of an owl statue created by Ivan Nikolov.
7237
7238 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7239 Close-range SfM Software Performance under Varying Capturing Conditions
7240 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7241
7242 Original datasets are under the CC BY 4.0 license.
7243
7244 For more details, see `Ivan Nikolov Datasets
7245 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7246
7247 .. versionchanged:: 0.45
7248
7249 A decimated version of this dataset with 24 thousand cells is now returned.
7250 Previously, a high-resolution version with 2.4 million cells was returned.
7251 Use ``high_resolution=True`` for the high-resolution version.
7252
7253 Parameters
7254 ----------
7255 load : bool, default: True
7256 Load the dataset after downloading it when ``True``. Set this
7257 to ``False`` and only the filename will be returned.
7258
7259 high_resolution : bool, default: False
7260 Set this to ``True`` to return a high-resolution version of this dataset.
7261 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7262 is returned with 99% reduction.
7263
7264 .. versionadded:: 0.45
7265
7266 Returns
7267 -------
7268 output : pyvista.PolyData | str
7269 DataSet or filename depending on ``load``.
7270
7271 Examples
7272 --------
7273 Download and plot the dataset.
7274
7275 >>> from pyvista import examples
7276 >>> import pyvista as pv
7277 >>> mesh = examples.download_owl()
7278 >>> cpos = pv.CameraPosition(
7279 ... position=(-315.18, -402.21, 230.71),
7280 ... focal_point=(6.06, -1.74, 101.48),
7281 ... viewup=(0.108, 0.226, 0.968),
7282 ... )
7283 >>> mesh.plot(cpos=cpos)
7284
7285 Return the statistics of the dataset.
7286
7287 >>> mesh
7288 PolyData (...)
7289 N Cells: 24407
7290 N Points: 12442
7291 N Strips: 0
7292 X Bounds: -5.834e+01, 7.048e+01
7293 Y Bounds: -7.005e+01, 6.657e+01
7294 Z Bounds: 1.814e+00, 2.013e+02
7295 N Arrays: 0
7296
7297 .. seealso::
7298
7299 :ref:`Owl Dataset <owl_dataset>`
7300 See this dataset in the Dataset Gallery for more info.
7301
7302 """
7303 if high_resolution:
7304 return _download_dataset(__dataset_owl_high_res, load=load)
7305 return _download_dataset(_dataset_owl, load=load)
7306
7307
7308 _dataset_owl = _SingleFileDownloadableDatasetLoader('ivan-nikolov/owl_decimated.vtp')
7309 __dataset_owl_high_res = _SingleFileDownloadableDatasetLoader(
7310 'ivan-nikolov/owl.zip', target_file='owl.vtp'
7311 )
7312
7313
7314 @_deprecate_positional_args
7315 def download_plastic_vase(load=True, *, high_resolution=False): # noqa: FBT002
7316 """Download a scan of a plastic vase created by Ivan Nikolov.
7317
7318 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7319 Close-range SfM Software Performance under Varying Capturing Conditions
7320 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7321
7322 Original datasets are under the CC BY 4.0 license.
7323
7324 For more details, see `Ivan Nikolov Datasets
7325 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7326
7327 .. versionchanged:: 0.45
7328
7329 A decimated version of this dataset with 36 thousand cells is now returned.
7330 Previously, a high-resolution version with 3.6 million cells was returned.
7331 Use ``high_resolution=True`` for the high-resolution version.
7332
7333 Parameters
7334 ----------
7335 load : bool, default: True
7336 Load the dataset after downloading it when ``True``. Set this
7337 to ``False`` and only the filename will be returned.
7338
7339 high_resolution : bool, default: False
7340 Set this to ``True`` to return a high-resolution version of this dataset.
7341 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7342 is returned with 99% reduction.
7343
7344 .. versionadded:: 0.45
7345
7346 Returns
7347 -------
7348 output : pyvista.PolyData | str
7349 DataSet or filename depending on ``load``.
7350
7351 Examples
7352 --------
7353 Download and plot the dataset.
7354
7355 >>> from pyvista import examples
7356 >>> mesh = examples.download_plastic_vase()
7357 >>> mesh.plot()
7358
7359 Return the statistics of the dataset.
7360
7361 >>> mesh
7362 PolyData (...)
7363 N Cells: 35708
7364 N Points: 18238
7365 N Strips: 0
7366 X Bounds: -1.364e+02, 1.928e+02
7367 Y Bounds: -1.677e+02, 1.602e+02
7368 Z Bounds: 1.209e+02, 4.090e+02
7369 N Arrays: 0
7370
7371 .. seealso::
7372
7373 :ref:`Plastic Vase Dataset <plastic_vase_dataset>`
7374 See this dataset in the Dataset Gallery for more info.
7375
7376 """
7377 if high_resolution:
7378 return _download_dataset(__dataset_plastic_vase_high_res, load=load)
7379 return _download_dataset(_dataset_plastic_vase, load=load)
7380
7381
7382 _dataset_plastic_vase = _SingleFileDownloadableDatasetLoader(
7383 'ivan-nikolov/plasticVase_decimated.vtp'
7384 )
7385 __dataset_plastic_vase_high_res = _SingleFileDownloadableDatasetLoader(
7386 'ivan-nikolov/plasticVase.zip',
7387 target_file='plasticVase.vtp',
7388 )
7389
7390
7391 @_deprecate_positional_args
7392 def download_sea_vase(load=True, *, high_resolution=False): # noqa: FBT002
7393 """Download a scan of a sea vase created by Ivan Nikolov.
7394
7395 The dataset was downloaded from `GGG-BenchmarkSfM: Dataset for Benchmarking
7396 Close-range SfM Software Performance under Varying Capturing Conditions
7397 <https://data.mendeley.com/datasets/bzxk2n78s9/4>`_
7398
7399 Original datasets are under the CC BY 4.0 license.
7400
7401 For more details, see `Ivan Nikolov Datasets
7402 <https://github.com/pyvista/data/tree/master/Data/ivan-nikolov>`_
7403
7404 .. versionchanged:: 0.45
7405
7406 A decimated version of this dataset with 35 thousand cells is now returned.
7407 Previously, a high-resolution version with 3.5 million cells was returned.
7408 Use ``high_resolution=True`` for the high-resolution version.
7409
7410 Parameters
7411 ----------
7412 load : bool, default: True
7413 Load the dataset after downloading it when ``True``. Set this
7414 to ``False`` and only the filename will be returned.
7415
7416 high_resolution : bool, default: False
7417 Set this to ``True`` to return a high-resolution version of this dataset.
7418 By default, a :meth:`decimated <pyvista.PolyDataFilters.decimate>` version
7419 is returned with 99% reduction.
7420
7421 .. versionadded:: 0.45
7422
7423 Returns
7424 -------
7425 output : pyvista.PolyData | str
7426 DataSet or filename depending on ``load``.
7427
7428 Examples
7429 --------
7430 Download and plot the dataset.
7431
7432 >>> from pyvista import examples
7433 >>> mesh = examples.download_sea_vase()
7434 >>> mesh.plot()
7435
7436 Return the statistics of the dataset.
7437
7438 >>> mesh
7439 PolyData (...)
7440 N Cells: 35483
7441 N Points: 18063
7442 N Strips: 0
7443 X Bounds: -1.664e+02, 1.463e+02
7444 Y Bounds: -1.741e+02, 1.382e+02
7445 Z Bounds: -1.497e+02, 2.992e+02
7446 N Arrays: 0
7447
7448 .. seealso::
7449
7450 :ref:`Sea Vase Dataset <sea_vase_dataset>`
7451 See this dataset in the Dataset Gallery for more info.
7452
7453 """
7454 if high_resolution:
7455 return _download_dataset(__dataset_sea_vase_high_res, load=load)
7456 return _download_dataset(_dataset_sea_vase, load=load)
7457
7458
7459 _dataset_sea_vase = _SingleFileDownloadableDatasetLoader('ivan-nikolov/seaVase_decimated.vtp')
7460 __dataset_sea_vase_high_res = _SingleFileDownloadableDatasetLoader(
7461 'ivan-nikolov/seaVase.zip',
7462 target_file='seaVase.vtp',
7463 )
7464
7465
7466 @_deprecate_positional_args
7467 def download_dikhololo_night(load=True): # noqa: FBT002
7468 """Download and read the dikholo night hdr texture example.
7469
7470 Files hosted at https://polyhaven.com/
7471
7472 Parameters
7473 ----------
7474 load : bool, default: True
7475 Load the dataset after downloading it when ``True``. Set this
7476 to ``False`` and only the filename will be returned.
7477
7478 Returns
7479 -------
7480 pyvista.Texture
7481 HDR Texture.
7482
7483 Examples
7484 --------
7485 .. pyvista-plot::
7486 :force_static:
7487
7488 >>> from pyvista import examples
7489 >>> texture = examples.download_dikhololo_night()
7490 >>> texture.dimensions
7491 (4096, 2048)
7492
7493 Use :meth:`~pyvista.ImageDataFilters.resample` to downsample the texture's
7494 underlying image before plotting.
7495
7496 >>> _ = texture.to_image().resample(0.25, inplace=True)
7497 >>> texture.dimensions
7498 (1024, 512)
7499
7500 >>> texture.plot(cpos='xy')
7501
7502 .. seealso::
7503
7504 :ref:`Dikhololo Night Dataset <dikhololo_night_dataset>`
7505 See this dataset in the Dataset Gallery for more info.
7506
7507 :ref:`Parched Canal 4k Dataset <parched_canal_4k_dataset>`
7508 Another HDR texture.
7509
7510 :ref:`load_gltf_example`
7511 See additional examples using this dataset.
7512
7513 """
7514 return _download_dataset(_dataset_dikhololo_night, load=load)
7515
7516
7517 def _dikhololo_night_load_func(texture):
7518 texture.SetColorModeToDirectScalars()
7519 texture.SetMipmap(True)
7520 texture.SetInterpolate(True)
7521 return texture
7522
7523
7524 _dataset_dikhololo_night = _SingleFileDownloadableDatasetLoader(
7525 'dikhololo_night_4k.hdr',
7526 read_func=read_texture,
7527 )
7528
7529
7530 @_deprecate_positional_args
7531 def download_cad_model_case(load=True): # noqa: FBT002
7532 """Download a CAD model of a Raspberry PI 4 case.
7533
7534 The dataset was downloaded from `Thingiverse
7535 <https://www.thingiverse.com/thing:4947746>`_
7536
7537 Original datasets are under the `Creative Commons - Attribution
7538 <https://creativecommons.org/licenses/by/4.0/>`_ license.
7539
7540 Parameters
7541 ----------
7542 load : bool, default: True
7543 Load the dataset after downloading it when ``True``. Set this
7544 to ``False`` and only the filename will be returned.
7545
7546 Returns
7547 -------
7548 output : pyvista.PolyData | str
7549 DataSet or filename depending on ``load``.
7550
7551 Examples
7552 --------
7553 Download and plot the dataset.
7554
7555 >>> from pyvista import examples
7556 >>> mesh = examples.download_cad_model_case()
7557 >>> mesh.plot()
7558
7559 Return the statistics of the dataset.
7560
7561 >>> mesh
7562 PolyData (...)
7563 N Cells: 15446
7564 N Points: 7677
7565 N Strips: 0
7566 X Bounds: -6.460e-31, 9.000e+01
7567 Y Bounds: -3.535e-32, 1.480e+02
7568 Z Bounds: 0.000e+00, 2.000e+01
7569 N Arrays: 2
7570
7571 .. seealso::
7572
7573 :ref:`Cad Model Case Dataset <cad_model_case_dataset>`
7574 See this dataset in the Dataset Gallery for more info.
7575
7576 """
7577 return _download_dataset(_dataset_cad_model_case, load=load)
7578
7579
7580 _dataset_cad_model_case = _SingleFileDownloadableDatasetLoader(
7581 'cad/4947746/Vented_Rear_Case_With_Pi_Supports.vtp',
7582 )
7583
7584
7585 @_deprecate_positional_args
7586 def download_aero_bracket(load=True): # noqa: FBT002
7587 """Download the finite element solution of an aero bracket.
7588
7589 Data generated from public SimScale examples at `SimScale Project Library -
7590 Turbo <https://www.simscale.com/projects/ayarnoz/turbo/>`_.
7591
7592 Licensing for this dataset is granted to freely and without restriction
7593 reproduce, distribute, publish according to the `SimScale Terms and
7594 Conditions <https://www.simscale.com/terms-and-conditions/>`_.
7595
7596 This project demonstrates the static stress analysis of three aircraft
7597 engine bearing bracket models considering both linear and nonlinear
7598 material definition. The models are tested with horizontal and vertical
7599 loading conditions as provided on the `GrabCAD - Airplane Bearing Bracket
7600 Challenge
7601 <https://grabcad.com/challenges/airplane-bearing-bracket-challenge/entries>`_.
7602
7603 Parameters
7604 ----------
7605 load : bool, default: True
7606 Load the dataset after downloading it when ``True``. Set this
7607 to ``False`` and only the filename will be returned.
7608
7609 Returns
7610 -------
7611 output : pyvista.UnstructuredGrid | str
7612 DataSet or filename depending on ``load``.
7613
7614 Examples
7615 --------
7616 Download the aero bracket.
7617
7618 >>> from pyvista import examples
7619 >>> import pyvista as pv
7620 >>> dataset = examples.download_aero_bracket()
7621 >>> dataset
7622 UnstructuredGrid (...)
7623 N Cells: 117292
7624 N Points: 187037
7625 X Bounds: -6.858e-03, 1.118e-01
7626 Y Bounds: -1.237e-02, 6.634e-02
7627 Z Bounds: -1.638e-02, 1.638e-02
7628 N Arrays: 3
7629
7630 Show the available point data arrays.
7631
7632 >>> dataset.point_data
7633 pyvista DataSetAttributes
7634 Association : POINT
7635 Active Scalars : None
7636 Active Vectors : None
7637 Active Texture : None
7638 Active Normals : None
7639 Contains arrays :
7640 displacement float32 (187037, 3)
7641 total nonlinear strain float32 (187037, 6)
7642 von Mises stress float32 (187037,)
7643
7644 Plot the von Mises stress.
7645
7646 >>> cpos = pv.CameraPosition(
7647 ... position=(-0.0503, 0.132, -0.179),
7648 ... focal_point=(0.0505, 0.0185, -0.00201),
7649 ... viewup=(0.275, 0.872, 0.405),
7650 ... )
7651 >>> dataset.plot(
7652 ... smooth_shading=True,
7653 ... split_sharp_edges=True,
7654 ... scalars='von Mises stress',
7655 ... cmap='bwr',
7656 ... cpos=cpos,
7657 ... anti_aliasing='fxaa',
7658 ... )
7659
7660 .. seealso::
7661
7662 :ref:`Aero Bracket Dataset <aero_bracket_dataset>`
7663 See this dataset in the Dataset Gallery for more info.
7664
7665 :ref:`Notch Stress Dataset <notch_stress_dataset>`
7666
7667 :ref:`Notch Displacement Dataset <notch_displacement_dataset>`
7668
7669 :ref:`Fea Bracket Dataset <fea_bracket_dataset>`
7670
7671 :ref:`Fea Hertzian Contact Cylinder Dataset <fea_hertzian_contact_cylinder_dataset>`
7672
7673 """
7674 return _download_dataset(_dataset_aero_bracket, load=load)
7675
7676
7677 _dataset_aero_bracket = _SingleFileDownloadableDatasetLoader('fea/aero_bracket/aero_bracket.vtu')
7678
7679
7680 @_deprecate_positional_args
7681 def download_coil_magnetic_field(load=True): # noqa: FBT002
7682 """Download the magnetic field of a coil.
7683
7684 These examples were generated from the following `script
7685 <https://github.com/pyvista/data/tree/master/Data/magpylib/>`_.
7686
7687 Parameters
7688 ----------
7689 load : bool, default: True
7690 Load the dataset after downloading it when ``True``. Set this
7691 to ``False`` and only the filename will be returned.
7692
7693 Returns
7694 -------
7695 output : pyvista.ImageData or str
7696 DataSet or filename depending on ``load``.
7697
7698 Examples
7699 --------
7700 Download the magnetic field dataset and generate streamlines from the field.
7701
7702 >>> import pyvista as pv
7703 >>> from pyvista import examples
7704 >>> grid = examples.download_coil_magnetic_field()
7705 >>> seed = pv.Disc(inner=1, outer=5.2, r_res=3, c_res=12)
7706 >>> strl = grid.streamlines_from_source(
7707 ... seed,
7708 ... vectors='B',
7709 ... max_length=180,
7710 ... initial_step_length=0.1,
7711 ... integration_direction='both',
7712 ... )
7713 >>> strl.plot(
7714 ... cmap='plasma',
7715 ... render_lines_as_tubes=True,
7716 ... line_width=2,
7717 ... lighting=False,
7718 ... zoom=2,
7719 ... )
7720
7721 Plot the magnet field strength in the Z direction.
7722
7723 >>> import numpy as np
7724 >>> import pyvista as pv
7725 >>> from pyvista import examples
7726 >>> grid = examples.download_coil_magnetic_field()
7727 >>> # create coils
7728 >>> coils = []
7729 >>> for z in np.linspace(-8, 8, 16):
7730 ... coils.append(
7731 ... pv.Polygon(center=(0, 0, z), radius=5, n_sides=100, fill=False)
7732 ... )
7733 >>> coils = pv.MultiBlock(coils)
7734 >>> # plot the magnet field strength in the Z direction
7735 >>> scalars = np.abs(grid['B'][:, 2])
7736 >>> pl = pv.Plotter()
7737 >>> _ = pl.add_mesh(coils, render_lines_as_tubes=True, line_width=5, color='w')
7738 >>> vol = pl.add_volume(
7739 ... grid,
7740 ... scalars=scalars,
7741 ... cmap='plasma',
7742 ... show_scalar_bar=False,
7743 ... log_scale=True,
7744 ... opacity='sigmoid_2',
7745 ... )
7746 >>> vol.prop.interpolation_type = 'linear'
7747 >>> _ = pl.add_volume_clip_plane(
7748 ... vol,
7749 ... normal='-x',
7750 ... normal_rotation=False,
7751 ... interaction_event='always',
7752 ... widget_color=pv.Color(opacity=0.0),
7753 ... )
7754 >>> pl.enable_anti_aliasing()
7755 >>> pl.camera.zoom(2)
7756 >>> pl.show()
7757
7758 .. seealso::
7759
7760 :ref:`Coil Magnetic Field Dataset <coil_magnetic_field_dataset>`
7761 See this dataset in the Dataset Gallery for more info.
7762
7763 :ref:`magnetic_fields_example`
7764 More details on how to plot with this dataset.
7765
7766 """
7767 return _download_dataset(_dataset_coil_magnetic_field, load=load)
7768
7769
7770 _dataset_coil_magnetic_field = _SingleFileDownloadableDatasetLoader('magpylib/coil_field.vti')
7771
7772
7773 @_deprecate_positional_args
7774 def download_meshio_xdmf(load=True): # noqa: FBT002
7775 """Download xdmf file created by meshio.
7776
7777 The dataset was created by ``test_time_series`` test function in meshio.
7778
7779 Parameters
7780 ----------
7781 load : bool, default: True
7782 Load the dataset after downloading it when ``True``. Set this
7783 to ``False`` and only the filename will be returned.
7784
7785 Returns
7786 -------
7787 output : pyvista.UnstructuredGrid or str
7788 DataSet or filename depending on ``load``.
7789
7790 Examples
7791 --------
7792 >>> from pyvista import examples
7793 >>> dataset = examples.download_meshio_xdmf()
7794 >>> dataset.plot()
7795
7796 .. seealso::
7797
7798 :ref:`Meshio Xdmf Dataset <meshio_xdmf_dataset>`
7799 See this dataset in the Dataset Gallery for more info.
7800
7801 """
7802 return _download_dataset(_dataset_meshio_xdmf, load=load)
7803
7804
7805 def _meshio_xdmf_files_func():
7806 h5 = _DownloadableFile('meshio/out.h5')
7807 xdmf = _SingleFileDownloadableDatasetLoader('meshio/out.xdmf')
7808 return xdmf, h5
7809
7810
7811 _dataset_meshio_xdmf = _MultiFileDownloadableDatasetLoader(files_func=_meshio_xdmf_files_func)
7812
7813
7814 @_deprecate_positional_args
7815 def download_victorian_goblet_face_illusion(load=True): # noqa: FBT002
7816 """Download Victorian Goblet face illusion.
7817
7818 This is a replica of a Victorian goblet with an external profile
7819 which resembles that of a face.
7820
7821 Parameters
7822 ----------
7823 load : bool, default: True
7824 Load the dataset after downloading it when ``True``. Set this
7825 to ``False`` and only the filename will be returned.
7826
7827 Returns
7828 -------
7829 output : pyvista.UnstructuredGrid or str
7830 DataSet or filename depending on ``load``.
7831
7832 Examples
7833 --------
7834 >>> from pyvista import examples
7835 >>> import pyvista as pv
7836 >>> mesh = examples.download_victorian_goblet_face_illusion()
7837 >>> pl = pv.Plotter(lighting='none')
7838 >>> _ = pl.add_mesh(mesh, edge_color='gray', color='white', show_edges=True)
7839 >>> _ = pl.add_floor('-x', color='black')
7840 >>> pl.enable_parallel_projection()
7841 >>> pl.show(cpos='yz')
7842
7843 .. seealso::
7844
7845 :ref:`Victorian Goblet Face Illusion Dataset <victorian_goblet_face_illusion_dataset>`
7846 See this dataset in the Dataset Gallery for more info.
7847
7848 """
7849 return _download_dataset(_dataset_victorian_goblet_face_illusion, load=load)
7850
7851
7852 _dataset_victorian_goblet_face_illusion = _SingleFileDownloadableDatasetLoader(
7853 'Victorian_Goblet_face_illusion/Vase.stl',
7854 )
7855
7856
7857 @_deprecate_positional_args
7858 def download_reservoir(load=True): # noqa: FBT002
7859 """Download the UNISIM-II-D reservoir model.
7860
7861 UNISIM-II is a synthetic carbonate reservoir model created by
7862 UNISIM-CEPETRO-Unicamp. The dataset can be used to compare methodologies
7863 and performance of different techniques, simulators, algorithms, among others.
7864 See more at https://www.unisim.cepetro.unicamp.br/benchmarks/br/unisim-ii/overview
7865
7866 This dataset is licenced under the Database Contents License: http://opendatacommons.org/licenses/dbcl/1.0/
7867
7868 Parameters
7869 ----------
7870 load : bool, default: True
7871 Load the dataset after downloading it when ``True``. Set this
7872 to ``False`` and only the filename will be returned.
7873
7874 Returns
7875 -------
7876 output : pyvista.ExplicitStructuredGrid or str
7877 DataSet or filename depending on ``load``.
7878
7879 Examples
7880 --------
7881 Load and plot dataset.
7882
7883 >>> from pyvista import examples
7884 >>> import pyvista as pv
7885 >>> dataset = examples.download_reservoir()
7886 >>> dataset
7887 ExplicitStructuredGrid (...)
7888 N Cells: 47610
7889 N Points: 58433
7890 X Bounds: 3.104e+05, 3.177e+05
7891 Y Bounds: 7.477e+06, 7.486e+06
7892 Z Bounds: -2.472e+03, -1.577e+03
7893 N Arrays: 6
7894
7895
7896 >>> pl = pv.Plotter()
7897 >>> _ = pl.add_mesh(dataset, show_edges=True)
7898 >>> camera = pl.camera
7899 >>> camera.position = (312452, 7474760, 3507)
7900 >>> camera.focal_point = (314388, 7481520, -2287)
7901 >>> camera.up = (0.09, 0.63, 0.77)
7902 >>> camera.distance = 9112
7903 >>> camera.clipping_range = (595, 19595)
7904 >>> pl.show()
7905
7906 .. seealso::
7907
7908 :ref:`Reservoir Dataset <reservoir_dataset>`
7909 See this dataset in the Dataset Gallery for more info.
7910
7911 """
7912 return _download_dataset(_dataset_reservoir, load=load)
7913
7914
7915 def _reservoir_load_func(grid):
7916 # See loading steps from this example:
7917 # https://examples.vtk.org/site/Python/ExplicitStructuredGrid/LoadESGrid/
7918 grid.ComputeFacesConnectivityFlagsArray()
7919 grid.set_active_scalars('ConnectivityFlags')
7920
7921 # Remove misc data fields stored with the dataset
7922 grid.field_data.remove('dimensions')
7923 grid.field_data.remove('name')
7924 grid.field_data.remove('properties')
7925 grid.field_data.remove('filename')
7926
7927 return grid
7928
7929
7930 _dataset_reservoir = _SingleFileDownloadableDatasetLoader(
7931 'reservoir/UNISIM-II-D.zip',
7932 target_file='UNISIM-II-D.vtu',
7933 read_func=pv.ExplicitStructuredGrid,
7934 load_func=_reservoir_load_func,
7935 )
7936
7937
7938 @_deprecate_positional_args
7939 def download_whole_body_ct_male(
7940 load=True, # noqa: FBT002
7941 *,
7942 high_resolution=False,
7943 ):
7944 r"""Download a CT image of a male subject with 117 segmented anatomic structures.
7945
7946 This dataset is subject ``'s1397'`` from the TotalSegmentator dataset, version 2.0.1,
7947 available from `zenodo <https://zenodo.org/records/10047292>`_. See the
7948 original paper for details:
7949
7950 Jakob Wasserthal et al., TotalSegmentator: Robust Segmentation of 104 Anatomic
7951 Structures in CT Images, Radiology, Jul. 2023, doi: https://doi.org/10.1148/ryai.230024.
7952
7953 The dataset is loaded as a :class:`~pyvista.MultiBlock` with three blocks:
7954
7955 - ``'ct'``: :class:`~pyvista.ImageData` with CT data.
7956
7957 - ``'segmentations'``: :class:`~pyvista.MultiBlock` with 117 :class:`~pyvista.ImageData`
7958 blocks, each containing a binary segmentation label. The blocks are named by
7959 their anatomic structure (e.g. ``'heart'``) and are sorted alphabetically. See the
7960 examples below for a complete list label names.
7961
7962 - ``'label_map'``: :class:`~pyvista.ImageData` with a label map array. The
7963 label map is an alternative representation of the segmentation where
7964 the masks are combined into a single scalar array.
7965
7966 .. note::
7967
7968 The label map is not part of the original data source.
7969
7970 Licensed under Creative Commons Attribution 4.0 International.
7971
7972 .. versionadded:: 0.45
7973
7974 Three dictionaries are now included with the dataset's
7975 :class:`~pyvista.DataObject.user_dict` to map label names to ids and
7976 colors:
7977
7978 - ``'names_to_colors'`` : maps segment names to 8-bit RGB colors.
7979 - ``'names_to_ids'`` : maps segment names to integer ids used by the label map.
7980 - ``'ids_to_colors'`` : maps label ids to colors.
7981
7982 The label ids are the ids used by the included label map.
7983
7984 .. versionchanged:: 0.45
7985
7986 A downsampled version of this dataset with dimensions ``(160, 160, 273)``
7987 is now returned. Previously, a high-resolution version with dimensions
7988 ``(320, 320, 547)`` was returned. Use ``high_resolution=True`` for the
7989 high-resolution version.
7990
7991 Parameters
7992 ----------
7993 load : bool, default: True
7994 Load the dataset after downloading it when ``True``. Set this
7995 to ``False`` and only the filename will be returned.
7996
7997 high_resolution : bool, default: False
7998 Set this to ``True`` to return a high-resolution version of this dataset.
7999 By default, a :meth:`resampled <pyvista.ImageDataFilters.resample>` version
8000 with a ``0.5`` sampling rate is returned.
8001
8002 .. versionadded:: 0.45
8003
8004 Returns
8005 -------
8006 output : pyvista.MultiBlock or str
8007 DataSet or filename depending on ``load``.
8008
8009 Examples
8010 --------
8011 Load the dataset and get some of its properties.
8012
8013 >>> from pyvista import examples
8014 >>> import pyvista as pv
8015 >>> dataset = examples.download_whole_body_ct_male()
8016
8017 Get the CT image.
8018
8019 >>> ct_image = dataset['ct']
8020 >>> ct_image
8021 ImageData (...)
8022 N Cells: 6876432
8023 N Points: 6988800
8024 X Bounds: 7.500e-01, 4.778e+02
8025 Y Bounds: 7.500e-01, 4.778e+02
8026 Z Bounds: 7.527e-01, 8.182e+02
8027 Dimensions: 160, 160, 273
8028 Spacing: 3.000e+00, 3.000e+00, 3.005e+00
8029 N Arrays: 1
8030
8031 Get the segmentation label names and show the first three.
8032
8033 >>> segmentations = dataset['segmentations']
8034 >>> label_names = segmentations.keys()
8035 >>> label_names[:3]
8036 ['adrenal_gland_left', 'adrenal_gland_right', 'aorta']
8037
8038 Get the label map and show its data range.
8039
8040 >>> label_map = dataset['label_map']
8041 >>> label_map.get_data_range()
8042 (np.uint8(0), np.uint8(117))
8043
8044 Show the ``'names_to_colors'`` dictionary with RGB colors for each segment.
8045
8046 >>> dataset.user_dict['names_to_colors'] # doctest: +SKIP
8047
8048 Show the ``'names_to_ids'`` dictionary with a mapping from segment names to segment ids.
8049
8050 >>> dataset.user_dict['names_to_ids'] # doctest: +SKIP
8051
8052 Create a surface mesh of the segmentation labels.
8053
8054 >>> labels_mesh = label_map.contour_labels()
8055
8056 Color the surface using :func:`~pyvista.DataSetFilters.color_labels`. Use the
8057 ``'ids_to_colors'`` dictionary that's included with the dataset to map the colors.
8058
8059 >>> colored_mesh = labels_mesh.color_labels(
8060 ... colors=dataset.user_dict['ids_to_colors']
8061 ... )
8062
8063 Plot the CT image and segmentation labels together.
8064
8065 >>> pl = pv.Plotter()
8066 >>> _ = pl.add_volume(
8067 ... ct_image,
8068 ... cmap='bone',
8069 ... opacity='sigmoid_8',
8070 ... show_scalar_bar=False,
8071 ... )
8072 >>> _ = pl.add_mesh(colored_mesh)
8073 >>> pl.view_zx()
8074 >>> pl.camera.up = (0, 0, 1)
8075 >>> pl.camera.zoom(1.3)
8076 >>> pl.show()
8077
8078 .. seealso::
8079
8080 :ref:`anatomical_groups_example`
8081 Additional examples using this dataset.
8082
8083 :ref:`Whole Body Ct Male Dataset <whole_body_ct_male_dataset>`
8084 See this dataset in the Dataset Gallery for more info.
8085
8086 :ref:`Whole Body Ct Female Dataset <whole_body_ct_female_dataset>`
8087 Similar dataset of a female subject.
8088
8089 :ref:`medical_dataset_gallery`
8090 Browse other medical datasets.
8091
8092 :ref:`crop_labeled_example`
8093 Example cropping this dataset using a segmentation mask.
8094
8095 :ref:`volume_with_mask_example`
8096 See additional examples using this dataset.
8097
8098 """
8099 if high_resolution:
8100 return _download_dataset(__dataset_whole_body_ct_male_high_res, load=load)
8101 return _download_dataset(_dataset_whole_body_ct_male, load=load)
8102
8103
8104 class _WholeBodyCTUtilities:
8105 @staticmethod
8106 def import_colors_dict(module_path):
8107 # Import `colors` dict from downloaded `colors.py` module
8108 module_name = 'colors'
8109 spec = importlib.util.spec_from_file_location(module_name, module_path)
8110 if spec is not None:
8111 module = importlib.util.module_from_spec(spec)
8112 sys.modules[spec.name] = module
8113 spec.loader.exec_module(module) # type:ignore[union-attr]
8114 from colors import colors # noqa: PLC0415
8115
8116 return dict(sorted(colors.items()))
8117 else:
8118 msg = 'Unable to load colors.'
8119 raise RuntimeError(msg)
8120
8121 @staticmethod
8122 def add_metadata(dataset: MultiBlock, colors_module_path: str):
8123 # Add color and id mappings to dataset
8124 segmentations = cast('pv.MultiBlock', dataset['segmentations'])
8125 label_names = sorted(segmentations.keys())
8126 names_to_colors = _WholeBodyCTUtilities.import_colors_dict(colors_module_path)
8127 names_to_ids = {key: i + 1 for i, key in enumerate(label_names)}
8128 dataset.user_dict['names_to_colors'] = names_to_colors
8129 dataset.user_dict['names_to_ids'] = names_to_ids
8130 dataset.user_dict['ids_to_colors'] = dict(
8131 sorted({names_to_ids[name]: names_to_colors[name] for name in label_names}.items())
8132 )
8133
8134 @staticmethod
8135 def label_map_from_masks(masks: MultiBlock):
8136 # Create label map array from segmentation masks
8137 # Initialize array with background values (zeros)
8138 n_points = cast('pv.ImageData', masks[0]).n_points
8139 label_map_array = np.zeros((n_points,), dtype=np.uint8)
8140 label_names = sorted(masks.keys())
8141 for i, name in enumerate(label_names):
8142 mask = cast('pv.ImageData', masks[name])
8143 label_map_array[mask.active_scalars == 1] = i + 1
8144
8145 # Add scalars to a new image
8146 label_map_image = pv.ImageData()
8147 label_map_image.copy_structure(cast('pv.ImageData', masks[0]))
8148 label_map_image['label_map'] = label_map_array
8149 return label_map_image
8150
8151 @staticmethod
8152 def load_func(files):
8153 dataset_file, colors_module = files
8154 dataset = dataset_file.load()
8155
8156 # Create label map and add to dataset
8157 dataset['label_map'] = _WholeBodyCTUtilities.label_map_from_masks(dataset['segmentations'])
8158
8159 # Add metadata
8160 _WholeBodyCTUtilities.add_metadata(dataset, colors_module.path)
8161 return dataset
8162
8163 @staticmethod
8164 def files_func(name):
8165 # Resampled version is saved as a multiblock
8166 target_file = f'{name}.vtm' if 'resampled' in name else name
8167
8168 def func():
8169 # Multiple files needed for read, but only one gets loaded
8170 dataset = _SingleFileDownloadableDatasetLoader(
8171 f'whole_body_ct/{name}.zip',
8172 target_file=target_file,
8173 )
8174 colors = _DownloadableFile('whole_body_ct/colors.py')
8175 return dataset, colors
8176
8177 return func
8178
8179
8180 _dataset_whole_body_ct_male = _MultiFileDownloadableDatasetLoader(
8181 _WholeBodyCTUtilities.files_func('s1397_resampled'),
8182 load_func=_WholeBodyCTUtilities.load_func,
8183 )
8184 __dataset_whole_body_ct_male_high_res = _MultiFileDownloadableDatasetLoader(
8185 _WholeBodyCTUtilities.files_func('s1397'), load_func=_WholeBodyCTUtilities.load_func
8186 )
8187
8188
8189 @_deprecate_positional_args
8190 def download_whole_body_ct_female(
8191 load=True, # noqa: FBT002
8192 *,
8193 high_resolution=False,
8194 ):
8195 r"""Download a CT image of a female subject with 117 segmented anatomic structures.
8196
8197 This dataset is subject ``'s1380'`` from the TotalSegmentator dataset, version 2.0.1,
8198 available from `zenodo <https://zenodo.org/records/10047292>`_. See the
8199 original paper for details:
8200
8201 Jakob Wasserthal et al., TotalSegmentator: Robust Segmentation of 104 Anatomic
8202 Structures in CT Images, Radiology, Jul. 2023, doi: https://doi.org/10.1148/ryai.230024.
8203
8204 The dataset is loaded as a :class:`~pyvista.MultiBlock` with three blocks:
8205
8206 - ``'ct'``: :class:`~pyvista.ImageData` with CT data.
8207
8208 - ``'segmentations'``: :class:`~pyvista.MultiBlock` with 117 :class:`~pyvista.ImageData`
8209 blocks, each containing a binary segmentation label. The blocks are named by
8210 their anatomic structure (e.g. ``'heart'``) and are sorted alphabetically. See the
8211 examples below for a complete list label names.
8212
8213 - ``'label_map'``: :class:`~pyvista.ImageData` with a label map array. The
8214 label map is an alternative representation of the segmentation where
8215 the masks are combined into a single scalar array.
8216
8217 .. note::
8218
8219 The label map is not part of the original data source.
8220
8221 Licensed under Creative Commons Attribution 4.0 International.
8222
8223 .. versionadded:: 0.45
8224
8225 Three dictionaries are now included with the dataset's
8226 :class:`~pyvista.DataObject.user_dict` to map label names to ids and
8227 colors:
8228
8229 - ``'names_to_colors'`` : maps segment names to 8-bit RGB colors.
8230 - ``'names_to_ids'`` : maps segment names to integer ids used by the label map.
8231 - ``'ids_to_colors'`` : maps label ids to colors.
8232
8233 The label ids are the ids used by the included label map.
8234
8235 .. versionchanged:: 0.45
8236
8237 A downsampled version of this dataset with dimensions ``(160, 160, 273)``
8238 is now returned. Previously, a high-resolution version with dimensions
8239 ``(320, 320, 547)`` was returned. Use ``high_resolution=True`` for the
8240 high-resolution version.
8241
8242 Parameters
8243 ----------
8244 load : bool, default: True
8245 Load the dataset after downloading it when ``True``. Set this
8246 to ``False`` and only the filename will be returned.
8247
8248 high_resolution : bool, default: False
8249 Set this to ``True`` to return a high-resolution version of this dataset.
8250 By default, a :meth:`resampled <pyvista.ImageDataFilters.resample>` version
8251 with a ``0.5`` sampling rate is returned.
8252
8253 .. versionadded:: 0.45
8254
8255 Returns
8256 -------
8257 output : pyvista.MultiBlock or str
8258 DataSet or filename depending on ``load``.
8259
8260 Examples
8261 --------
8262 Load the dataset.
8263
8264 >>> from pyvista import examples
8265 >>> import pyvista as pv
8266 >>> dataset = examples.download_whole_body_ct_female()
8267
8268 Get the names of the dataset's blocks.
8269
8270 >>> dataset.keys()
8271 ['ct', 'segmentations', 'label_map']
8272
8273 Get the CT image.
8274
8275 >>> ct_image = dataset['ct']
8276 >>> ct_image
8277 ImageData (...)
8278 N Cells: 6825870
8279 N Points: 6937600
8280 X Bounds: 7.500e-01, 4.778e+02
8281 Y Bounds: 7.500e-01, 4.778e+02
8282 Z Bounds: 7.528e-01, 8.122e+02
8283 Dimensions: 160, 160, 271
8284 Spacing: 3.000e+00, 3.000e+00, 3.006e+00
8285 N Arrays: 1
8286
8287 Get the segmentation label names and show the first three.
8288
8289 >>> segmentations = dataset['segmentations']
8290 >>> label_names = segmentations.keys()
8291 >>> label_names[:3]
8292 ['adrenal_gland_left', 'adrenal_gland_right', 'aorta']
8293
8294 Get the label map and show its data range.
8295
8296 >>> label_map = dataset['label_map']
8297 >>> label_map.get_data_range()
8298 (np.uint8(0), np.uint8(117))
8299
8300 Show the ``'names_to_colors'`` dictionary with RGB colors for each segment.
8301
8302 >>> dataset.user_dict['names_to_colors'] # doctest: +SKIP
8303
8304 Show the ``'names_to_ids'`` dictionary with a mapping from segment names to segment ids.
8305
8306 >>> dataset.user_dict['names_to_ids'] # doctest: +SKIP
8307
8308 Create a surface mesh of the segmentation labels.
8309
8310 >>> labels_mesh = label_map.contour_labels()
8311
8312 Color the surface using :func:`~pyvista.DataSetFilters.color_labels`. Use the
8313 ``'ids_to_colors'`` dictionary included with the dataset to map the colors.
8314
8315 >>> colored_mesh = labels_mesh.color_labels(
8316 ... colors=dataset.user_dict['ids_to_colors']
8317 ... )
8318
8319 Plot the CT image and segmentation labels together.
8320
8321 >>> pl = pv.Plotter()
8322 >>> _ = pl.add_volume(
8323 ... ct_image,
8324 ... cmap='bone',
8325 ... opacity='sigmoid_7',
8326 ... show_scalar_bar=False,
8327 ... )
8328 >>> _ = pl.add_mesh(colored_mesh)
8329 >>> pl.view_zx()
8330 >>> pl.camera.up = (0, 0, 1)
8331 >>> pl.camera.zoom(1.3)
8332 >>> pl.show()
8333
8334 .. seealso::
8335
8336 :ref:`anatomical_groups_example`
8337 Additional examples using this dataset.
8338
8339 :ref:`Whole Body Ct Female Dataset <whole_body_ct_female_dataset>`
8340 See this dataset in the Dataset Gallery for more info.
8341
8342 :ref:`Whole Body Ct Male Dataset <whole_body_ct_male_dataset>`
8343 Similar dataset of a male subject.
8344
8345 :ref:`medical_dataset_gallery`
8346 Browse other medical datasets.
8347
8348 :ref:`crop_labeled_example`
8349 Example cropping this dataset using a segmentation mask.
8350
8351 :ref:`volume_with_mask_example`
8352 See additional examples using this dataset.
8353
8354 """
8355 if high_resolution:
8356 return _download_dataset(__dataset_whole_body_ct_female_high_res, load=load)
8357 return _download_dataset(_dataset_whole_body_ct_female, load=load)
8358
8359
8360 _dataset_whole_body_ct_female = _MultiFileDownloadableDatasetLoader(
8361 _WholeBodyCTUtilities.files_func('s1380_resampled'),
8362 load_func=_WholeBodyCTUtilities.load_func,
8363 )
8364 __dataset_whole_body_ct_female_high_res = _MultiFileDownloadableDatasetLoader(
8365 _WholeBodyCTUtilities.files_func('s1380'), load_func=_WholeBodyCTUtilities.load_func
8366 )
8367
8368
8369 @_deprecate_positional_args
8370 def download_room_cff(load=True): # noqa: FBT002
8371 """Download a room model in CFF format.
8372
8373 Parameters
8374 ----------
8375 load : bool, default: True
8376 Load the dataset after downloading it when ``True``. Set this
8377 to ``False`` and only the filename will be returned.
8378
8379 Returns
8380 -------
8381 output : pyvista.MultiBlock or tuple
8382 DataSet or tuple of filenames depending on ``load``.
8383
8384 Examples
8385 --------
8386 >>> import pyvista as pv
8387 >>> from pyvista import examples
8388 >>> blocks = examples.download_room_cff()
8389 >>> mesh = blocks[0]
8390 >>> mesh.plot(cpos='xy', scalars='SV_T')
8391
8392 .. seealso::
8393
8394 :ref:`Room Cff Dataset <room_cff_dataset>`
8395 See this dataset in the Dataset Gallery for more info.
8396
8397 """
8398 return _download_dataset(_dataset_room_cff, load=load)
8399
8400
8401 def _dataset_room_cff_files_func():
8402 cas = _SingleFileDownloadableDatasetLoader('FLUENTCFF/room.cas.h5')
8403 dat = _DownloadableFile('FLUENTCFF/room.dat.h5')
8404 return cas, dat
8405
8406
8407 _dataset_room_cff = _MultiFileDownloadableDatasetLoader(_dataset_room_cff_files_func)
8408
8409
8410 @_deprecate_positional_args
8411 def download_m4_total_density(load=True): # noqa: FBT002
8412 """Download a total density dataset of the chemistry.
8413
8414 Parameters
8415 ----------
8416 load : bool, default: True
8417 Load the dataset after downloading it when ``True``. Set this
8418 to ``False`` and only the filename will be returned.
8419
8420 Returns
8421 -------
8422 output : pyvista.ImageData | str
8423 DataSet or filename depending on ``load``.
8424
8425 Examples
8426 --------
8427 >>> import pyvista as pv
8428 >>> from pyvista import examples
8429
8430 >>> filename = examples.download_m4_total_density(load=False)
8431 >>> reader = pv.get_reader(filename)
8432 >>> reader.hb_scale = 1.1
8433 >>> reader.b_scale = 10.0
8434
8435 >>> grid = reader.read()
8436 >>> poly = reader.read(grid=False)
8437
8438 Add the outline and volume to the plotter.
8439
8440 >>> pl = pv.Plotter()
8441 >>> outline = pl.add_mesh(grid.outline(), color='black')
8442 >>> volume = pl.add_volume(grid)
8443
8444 Add atoms and bonds to the plotter.
8445
8446 >>> atoms = pl.add_mesh(poly.glyph(geom=pv.Sphere()), color='red')
8447 >>> bonds = pl.add_mesh(poly.tube(), color='white')
8448
8449 >>> pl.show(cpos='zx')
8450
8451 .. seealso::
8452
8453 :ref:`M4 Total Density Dataset <m4_total_density_dataset>`
8454 See this dataset in the Dataset Gallery for more info.
8455
8456 """
8457 return _download_dataset(_dataset_m4_total_density, load=load)
8458
8459
8460 _dataset_m4_total_density = _SingleFileDownloadableDatasetLoader('m4_TotalDensity.cube')
8461
8462
8463 @_deprecate_positional_args
8464 def download_headsq(load=True): # noqa: FBT002
8465 """Download the headsq dataset.
8466
8467 The headsq dataset is a 3D MRI scan of a human head.
8468
8469 .. versionadded:: 0.44.0
8470
8471 Parameters
8472 ----------
8473 load : bool, default: True
8474 Load the dataset after downloading it when ``True``. Set this
8475 to ``False`` and only the filename will be returned.
8476
8477 Returns
8478 -------
8479 output : pyvista.ImageData | str
8480 DataSet or filename depending on ``load``.
8481
8482 Examples
8483 --------
8484 >>> from pyvista import examples
8485 >>> mesh = examples.download_headsq()
8486 >>> mesh.plot(cpos='xy')
8487
8488 .. seealso::
8489
8490 :ref:`Headsq Dataset <headsq_dataset>`
8491 See this dataset in the Dataset Gallery for more info.
8492
8493 """
8494 return _download_dataset(_dataset_headsq, load=load)
8495
8496
8497 def _dataset_headsq_files_func():
8498 return tuple(
8499 [_SingleFileDownloadableDatasetLoader('headsq/quarter.nhdr')]
8500 + [_DownloadableFile('headsq/quarter.' + str(i)) for i in range(1, 94)],
8501 )
8502
8503
8504 _dataset_headsq = _MultiFileDownloadableDatasetLoader(_dataset_headsq_files_func)
8505
8506
8507 @_deprecate_positional_args
8508 def download_prism(load=True): # noqa: FBT002
8509 """Download a prism model.
8510
8511 .. versionadded:: 0.44.0
8512
8513 Parameters
8514 ----------
8515 load : bool, default: True
8516 Load the dataset after downloading it when ``True``. Set this
8517 to ``False`` and only the filename will be returned.
8518
8519 Returns
8520 -------
8521 output : pyvista.UnstructuredGrid | str
8522 DataSet or filename depending on ``load``.
8523
8524 Examples
8525 --------
8526 >>> from pyvista import examples
8527 >>> mesh = examples.download_prism()
8528 >>> mesh.plot()
8529
8530 .. seealso::
8531
8532 :ref:`Prism Dataset <prism_dataset>`
8533 See this dataset in the Dataset Gallery for more info.
8534
8535 """
8536 return _download_dataset(_dataset_prism, load=load)
8537
8538
8539 _dataset_prism = _SingleFileDownloadableDatasetLoader('prism.neu')
8540
8541
8542 @_deprecate_positional_args
8543 def download_t3_grid_0(load=True): # noqa: FBT002
8544 """Download a T3 grid 0 image.
8545
8546 .. versionadded:: 0.44.0
8547
8548 Parameters
8549 ----------
8550 load : bool, default: True
8551 Load the dataset after downloading it when ``True``. Set this
8552 to ``False`` and only the filename will be returned.
8553
8554 Returns
8555 -------
8556 output : pyvista.ImageData | str
8557 DataSet or filename depending on ``load``.
8558
8559 Examples
8560 --------
8561 >>> from pyvista import examples
8562 >>> mesh = examples.download_t3_grid_0()
8563 >>> mesh.plot()
8564
8565 .. seealso::
8566
8567 :ref:`T3 Grid 0 Dataset <t3_grid_0_dataset>`
8568 See this dataset in the Dataset Gallery for more info.
8569
8570 """
8571 return _download_dataset(_dataset_t3_grid_0, load=load)
8572
8573
8574 _dataset_t3_grid_0 = _SingleFileDownloadableDatasetLoader('t3_grid_0.mnc')
8575
8576
8577 @_deprecate_positional_args
8578 def download_caffeine(load=True): # noqa: FBT002
8579 """Download the caffeine molecule.
8580
8581 .. versionadded:: 0.44.0
8582
8583 Parameters
8584 ----------
8585 load : bool, default: True
8586 Load the dataset after downloading it when ``True``. Set this
8587 to ``False`` and only the filename will be returned.
8588
8589 Returns
8590 -------
8591 output : pyvista.PolyData | str
8592 DataSet or filename depending on ``load``.
8593
8594 Examples
8595 --------
8596 >>> import pyvista as pv
8597 >>> from pyvista import examples
8598 >>> filename = examples.download_caffeine(load=False)
8599 >>> reader = pv.get_reader(filename)
8600 >>> poly = reader.read()
8601
8602 Add atoms and bonds to the plotter.
8603
8604 >>> pl = pv.Plotter()
8605 >>> atoms = pl.add_mesh(poly.glyph(geom=pv.Sphere(radius=0.1)), color='red')
8606 >>> bonds = pl.add_mesh(poly.tube(radius=0.1), color='gray')
8607 >>> pl.show(cpos='xy')
8608
8609 .. seealso::
8610
8611 :ref:`Caffeine Dataset <caffeine_dataset>`
8612 See this dataset in the Dataset Gallery for more info.
8613
8614 """
8615 return _download_dataset(_dataset_caffeine, load=load)
8616
8617
8618 _dataset_caffeine = _SingleFileDownloadableDatasetLoader('caffeine.pdb')
8619
8620
8621 @_deprecate_positional_args
8622 def download_e07733s002i009(load=True): # paragma: no cover # noqa: FBT002
8623 """Download a e07733s002i009 image.
8624
8625 .. versionadded:: 0.44.0
8626
8627 Parameters
8628 ----------
8629 load : bool, default: True
8630 Load the dataset after downloading it when ``True``. Set this
8631 to ``False`` and only the filename will be returned.
8632
8633 Returns
8634 -------
8635 output : pyvista.ImageData | str
8636 DataSet or filename depending on ``load``.
8637
8638 Examples
8639 --------
8640 >>> from pyvista import examples
8641 >>> mesh = examples.download_e07733s002i009()
8642 >>> mesh.plot()
8643
8644 .. seealso::
8645
8646 :ref:`E07733s002i009 Dataset <e07733s002i009_dataset>`
8647 See this dataset in the Dataset Gallery for more info.
8648
8649 """
8650 return _download_dataset(_dataset_e07733s002i009, load=load)
8651
8652
8653 _dataset_e07733s002i009 = _SingleFileDownloadableDatasetLoader('E07733S002I009.MR')
8654
8655
8656 @_deprecate_positional_args
8657 def download_particles(load=True): # noqa: FBT002
8658 """Download a particle dataset.
8659
8660 .. versionadded:: 0.44.0
8661
8662 Parameters
8663 ----------
8664 load : bool, default: True
8665 Load the dataset after downloading it when ``True``. Set this
8666 to ``False`` and only the filename will be returned.
8667
8668 Returns
8669 -------
8670 output : pyvista.PolyData | str
8671 DataSet or filename depending on ``load``.
8672
8673 Examples
8674 --------
8675 >>> import pyvista as pv
8676 >>> from pyvista import examples
8677 >>> filename = examples.download_particles(load=False)
8678 >>> reader = pv.get_reader(filename)
8679 >>> reader.reader.SetDataByteOrderToBigEndian()
8680 >>> reader.reader.Update()
8681 >>> mesh = reader.read()
8682 >>> mesh.plot()
8683
8684 .. seealso::
8685
8686 :ref:`Particles Dataset <particles_dataset>`
8687 See this dataset in the Dataset Gallery for more info.
8688
8689 """
8690 return _download_dataset(_dataset_particles, load=load)
8691
8692
8693 _dataset_particles = _SingleFileDownloadableDatasetLoader('Particles.raw')
8694
8695
8696 @_deprecate_positional_args
8697 def download_prostar(load=True): # noqa: FBT002
8698 """Download a prostar dataset.
8699
8700 .. versionadded:: 0.44.0
8701
8702 Parameters
8703 ----------
8704 load : bool, default: True
8705 Load the dataset after downloading it when ``True``. Set this
8706 to ``False`` and only the filename will be returned.
8707
8708 Returns
8709 -------
8710 output : pyvista.UnstructuredGrid | str
8711 DataSet or filename depending on ``load``.
8712
8713 Examples
8714 --------
8715 >>> from pyvista import examples
8716 >>> mesh = examples.download_prostar()
8717 >>> mesh.plot()
8718
8719 .. seealso::
8720
8721 :ref:`Prostar Dataset <prostar_dataset>`
8722 See this dataset in the Dataset Gallery for more info.
8723
8724 """
8725 return _download_dataset(_dataset_prostar, load=load)
8726
8727
8728 def _prostar_files_func():
8729 # Multiple files needed for read, but only one gets loaded
8730 prostar_cel = _DownloadableFile('prostar.cel')
8731 prostar_vrt = _SingleFileDownloadableDatasetLoader('prostar.vrt')
8732 return prostar_vrt, prostar_cel
8733
8734
8735 _dataset_prostar = _MultiFileDownloadableDatasetLoader(_prostar_files_func)
8736
8737
8738 @_deprecate_positional_args
8739 def download_3gqp(load=True): # noqa: FBT002
8740 """Download a 3GQP dataset.
8741
8742 .. versionadded:: 0.44.0
8743
8744 Parameters
8745 ----------
8746 load : bool, default: True
8747 Load the dataset after downloading it when ``True``. Set this
8748 to ``False`` and only the filename will be returned.
8749
8750 Returns
8751 -------
8752 output : pyvista.PolyData | str
8753 DataSet or filename depending on ``load``.
8754
8755 Examples
8756 --------
8757 >>> from pyvista import examples
8758 >>> mesh = examples.download_3gqp()
8759 >>> mesh.plot()
8760
8761 .. seealso::
8762
8763 :ref:`3gqp Dataset <3gqp_dataset>`
8764 See this dataset in the Dataset Gallery for more info.
8765
8766 """
8767 return _download_dataset(_dataset_3gqp, load=load)
8768
8769
8770 _dataset_3gqp = _SingleFileDownloadableDatasetLoader('3GQP.pdb')
8771
8772
8773 @_deprecate_positional_args
8774 def download_full_head(load=True): # noqa: FBT002
8775 """Download the full head image.
8776
8777 .. versionadded:: 0.45.0
8778
8779 Parameters
8780 ----------
8781 load : bool, optional
8782 Load the dataset after downloading it when ``True``. Set this
8783 to ``False`` and only the filename will be returned.
8784
8785 Returns
8786 -------
8787 output : pyvista.ImageData | str
8788 DataSet or filename depending on ``load``.
8789
8790 Examples
8791 --------
8792 >>> from pyvista import examples
8793 >>> dataset = examples.download_full_head()
8794 >>> dataset.plot(volume=True)
8795
8796 .. seealso::
8797
8798 :ref:`Full Head Dataset <full_head_dataset>`
8799 See this dataset in the Dataset Gallery for more info.
8800
8801 """
8802 return _download_dataset(_dataset_full_head, load=load)
8803
8804
8805 def _full_head_files_func():
8806 full_head_raw = _DownloadableFile('FullHead.raw.gz')
8807 full_head_mha = _SingleFileDownloadableDatasetLoader('FullHead.mhd')
8808 return full_head_mha, full_head_raw
8809
8810
8811 _dataset_full_head = _MultiFileDownloadableDatasetLoader(_full_head_files_func)
8812
8813
8814 @_deprecate_positional_args
8815 def download_nek5000(load=True): # noqa: FBT002
8816 """Download 2D nek5000 data example.
8817
8818 .. versionadded:: 0.45.0
8819
8820 Parameters
8821 ----------
8822 load : bool, optional
8823 Load the dataset after downloading it when ``True``. Set this
8824 to ``False`` and only the filename will be returned. True requires
8825 vtk >= 9.3.
8826
8827 Returns
8828 -------
8829 output : pyvista.UnstructuredGrid | str
8830 DataSet or filename depending on ``load``.
8831
8832 Examples
8833 --------
8834 >>> from pyvista import examples
8835 >>> dataset = examples.download_nek5000()
8836 >>> dataset.plot(scalars='Velocity', cpos='xy')
8837
8838 .. seealso::
8839
8840 :ref:`Nek5000 Dataset <nek5000_dataset>`
8841 See this dataset in the Dataset Gallery for more info.
8842
8843 """
8844 # Silence info messages about 2D mesh found
8845 with pv.vtk_verbosity('off'):
8846 return _download_dataset(_dataset_nek5000, load=load)
8847
8848
8849 def _nek_5000_download():
8850 nek5000 = _SingleFileDownloadableDatasetLoader('nek5000/eddy_uv.nek5000')
8851 data_files = [_DownloadableFile(f'nek5000/eddy_uv0.f{str(i).zfill(5)}') for i in range(1, 12)]
8852 return (nek5000, *data_files)
8853
8854
8855 _dataset_nek5000 = _MultiFileDownloadableDatasetLoader(_nek_5000_download)
8856
8857
8858 @_deprecate_positional_args
8859 def download_biplane(load=True): # noqa: FBT002
8860 """Download biplane dataset.
8861
8862 .. warning::
8863 This dataset is known to cause segmentation faults on Windows.
8864
8865 Parameters
8866 ----------
8867 load : bool, default: True
8868 Load the dataset after downloading it when ``True``. Set this
8869 to ``False`` and only the filename will be returned.
8870
8871 Returns
8872 -------
8873 output : pyvista.MultiBlock | str
8874 DataSet or filename depending on ``load``.
8875
8876 Examples
8877 --------
8878 >>> import sys
8879 >>> from pyvista import examples
8880 >>> if sys.platform != 'win32': # segfaults on Windows
8881 ... dataset = examples.download_biplane()
8882 ... dataset.plot(cpos='zy', zoom=1.5)
8883
8884 .. seealso::
8885
8886 :ref:`Biplane Dataset <biplane_dataset>`
8887 See this dataset in the Dataset Gallery for more info.
8888
8889 """
8890 return _download_dataset(_dataset_biplane, load=load)
8891
8892
8893 _dataset_biplane = _SingleFileDownloadableDatasetLoader('biplane_rms_pressure_bs.exo')
8894
8895
8896 def download_yinyang(*, load=True):
8897 """Download yinyang dataset.
8898
8899 .. versionadded:: 0.46.0
8900
8901 Parameters
8902 ----------
8903 load : bool, default: True
8904 Load the dataset after downloading it when ``True``. Set this
8905 to ``False`` and only the filename will be returned.
8906
8907 Returns
8908 -------
8909 output : pyvista.ImageData | str
8910 DataSet or filename depending on ``load``.
8911
8912 Examples
8913 --------
8914 Load the image and plot it as grayscale pixel cells.
8915
8916 >>> from pyvista import examples
8917 >>> dataset = examples.download_yinyang()
8918 >>> pixel_cells = dataset.points_to_cells()
8919 >>> pixel_cells.plot(
8920 ... cmap='gray',
8921 ... clim=[0, 255],
8922 ... cpos='xy',
8923 ... zoom='tight',
8924 ... lighting=False,
8925 ... show_scalar_bar=False,
8926 ... show_axes=False,
8927 ... )
8928
8929 .. seealso::
8930
8931 :ref:`Yinyang Dataset <yinyang_dataset>`
8932 See this dataset in the Dataset Gallery for more info.
8933
8934 """
8935 return _download_dataset(_dataset_yinyang, load=load)
8936
8937
8938 _dataset_yinyang = _SingleFileDownloadableDatasetLoader('yinyang/Yinyang.png')
8939
8940
8941 def download_warping_spheres(*, load=True):
8942 """Download warping spheres dataset.
8943
8944 .. versionadded:: 0.47.0
8945
8946 Parameters
8947 ----------
8948 load : bool, default: True
8949 Load the dataset after downloading it when ``True``. Set this
8950 to ``False`` and only the filename will be returned.
8951
8952 Returns
8953 -------
8954 output : PartitionedDataSet | str
8955 Data object or filename depending on ``load``.
8956
8957 Examples
8958 --------
8959 Load the warping spheres and plot them.
8960
8961 >>> from pyvista import examples
8962 >>> import pyvista as pv
8963 >>> partitioned = examples.download_warping_spheres()
8964 >>> cpos = pv.CameraPosition(
8965 ... position=(70.0, -70.0, 0.0),
8966 ... focal_point=(7.0, 7.0, 7.0),
8967 ... viewup=(0.0, 0.0, 1.0),
8968 ... )
8969 >>> partitioned.plot(cpos=cpos)
8970
8971 .. seealso::
8972
8973 :ref:`Warping Spheres Dataset <warping_spheres_dataset>`
8974 See this dataset in the Dataset Gallery for more info.
8975
8976 """
8977 return _download_dataset(_dataset_warping_spheres, load=load)
8978
8979
8980 _dataset_warping_spheres = _SingleFileDownloadableDatasetLoader(
8981 'warping_spheres/warping_spheres.vtkhdf'
8982 )