How to use the orix.base.Object3d function in orix

To help you get started, we’ve selected a few orix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyxem / orix / tests / test_object3d.py View on Github external
def test_object3d(request):
    class TestObject3d(Object3d):
        dim = request.param
    return TestObject3d
github pyxem / orix / orix / quaternion / __init__.py View on Github external
Members
=======

"""
import numpy as np
from orix.base import check, Object3d
from orix.scalar import Scalar
from orix.vector import Vector3d


def check_quaternion(obj):
    return check(obj, Quaternion)


class Quaternion(Object3d):
    """Basic quaternion object.

    Quaternions support the following mathematical operations:

    - Unary negation.
    - Inversion.
    - Multiplication with other quaternions and vectors.

    Attributes
    ----------
    data : numpy.ndarray
        The numpy array containing the quaternion data.
    a, b, c, d : Scalar
        The individual elements of each vector.
    conj : Quaternion
        The conjugate of this quaternion: :math:`q^* = a - bi - cj - dk`
github pyxem / orix / orix / scalar / __init__.py View on Github external
def __init__(self, data):
        if isinstance(data, Object3d):
            self._data = data._data
        else:
            data = np.atleast_1d(data)
            self._data = data
github pyxem / orix / orix / scalar / __init__.py View on Github external
#
# You should have received a copy of the GNU General Public License
# along with orix.  If not, see .

"""Dimensionless quantities.

As well as themselves representing physical quantities, Scalars
may represent elements of higher-dimensional quantities, such as the x-component
of a vector or the rotation angle of a quaternion.

"""
import numpy as np
from orix.base import Object3d, DimensionError


class Scalar(Object3d):
    """Scalar base class.

    Scalars currently support the following mathematical operations:

        - Unary negation.
        - Addition to other scalars, numerical types, and array_like objects.
        - Subtraction to the above.
        - Multiplication to the above.
        - Element-wise boolean comparisons (``==``, ``<`` etc).
        - Unary exponentiation.

    """

    dim = 0

    def __init__(self, data):
github pyxem / orix / orix / vector / __init__.py View on Github external
spherical_region

Members
=======

"""
import numpy as np
from orix.base import check, Object3d
from orix.scalar import Scalar


def check_vector(obj):
    return check(obj, Vector3d)


class Vector3d(Object3d):
    """Vector base class.

    Vectors support the following mathematical operations:

    - Unary negation.
    - Addition to other vectors, scalars, numbers, and compatible
      array-like objects.
    - Subtraction to and from the above.
    - Multiplication to scalars, numbers, and compatible array-like objects.

    Examples
    --------
    >>> v = Vector3d((1, 2, 3))
    >>> w = Vector3d(np.array([[1, 0, 0], [0, 1, 1]]))

    >>> w.x