Esempio n. 1
0
import os
import warnings

import pyvista
import numpy as np
from sphinx_gallery.sorting import FileNameSortKey

import sys

sys.path.append("../..")
from ansys.mapdl.core import __version__

# Manage errors
pyvista.set_error_output_file("errors.txt")

# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True

# must be less than or equal to the XVFB window size
pyvista.rcParams["window_size"] = np.array([1024, 768])

# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"),
                                   "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
    os.makedirs(pyvista.FIGURE_PATH)

# necessary when building the sphinx gallery
pyvista.BUILDING_GALLERY = True

# suppress annoying matplotlib bug
Esempio n. 2
0
    showprivate=True,
    notify=False,
    intro_pages=[
        'overview/why-pvgeo',
        'overview/getting-started',
        'overview/featured',
        'overview/agu-2018',
    ],
    append_material=append_material,
    extra=extra,
)

import pyvista
import numpy as np
# Manage errors
pyvista.set_error_output_file('errors.txt')
# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True  # Not necessary - simply an insurance policy
pyvista.BUILDING_GALLERY = True  # necessary when building the sphinx gallery
# Preferred plotting style for documentation
pyvista.set_plot_theme('document')

# -- Project information -----------------------------------------------------

project = 'PVGeo'
copyright = u'2018-2020, Bane Sullivan, http:://banesullivan.com'
author = 'Bane Sullivan'
html_show_copyright = False
html_show_sphinx = False

# The short X.Y version
Esempio n. 3
0
import pathlib
import os

import numpy as np
import pytest
import unittest.mock as mock

import vtk

import pyvista
from pyvista import examples as ex
from pyvista.utilities import (check_valid_vector, errors, fileio, GPUInfo,
                               helpers, Observer, cells)

# Only set this here just the once.
pyvista.set_error_output_file(
    os.path.join(os.path.dirname(__file__), 'ERROR_OUTPUT.txt'))


def test_createvectorpolydata_error():
    orig = np.random.random((3, 1))
    vec = np.random.random((3, 1))
    with pytest.raises(ValueError):
        helpers.vector_poly_data(orig, vec)


def test_createvectorpolydata_1D():
    orig = np.random.random(3)
    vec = np.random.random(3)
    vdata = helpers.vector_poly_data(orig, vec)
    assert np.any(vdata.points)
    assert np.any(vdata.point_arrays['vectors'])