Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting 0.2.0 #15

Merged
merged 3 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 0 additions & 81 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,84 +21,3 @@ If analysis using orix forms a part of published work please cite the github rep

orix (this version) is released under the GPL v3 license.


Getting started
---------------

The use of orix should feel familiar to the use of numpy, but rather
than cells of numbers, the cells contain single 3d objects, such as
vectors or quaternions. They can all be created using tuples, lists,
numpy arrays, or other numpy-compatible iterables, and will raise an
error if constructed with the incorrect number of dimensions. Basic
examples are given below.

Vectors
~~~~~~~

Vectors are 3d objects representing positions or directions with
"magnitude". They can be added and subtracted with integers, floats, or
other vectors (provided the data are of compatible shapes) and have
several further unique operations.

.. code:: python

>>> import numpy as np
>>> from orix.vector import Vector3d
>>> v = Vector3d((1, 1, -1))
>>> w_array = np.array([[[1, 0, 0], [0, 0, -1]], [[1, 1, 0], [-1, 0, -1]]])
>>> w = Vector3d(w_array)
>>> v + w
# Vector3d (2, 2)
# [[[ 2 1 -1]
# [ 1 1 -2]]
#
# [[ 2 2 -1]
# [ 0 1 -2]]]
>>> v.dot(w)
# array([[1, 1],
# [2, 0]])
>>> v.cross(w)
# Vector3d (2, 2)
# [[[ 0 -1 -1]
# [-1 1 0]]
#
# [[ 1 -1 0]
# [-1 2 1]]]
>>> v.unit
# Vector3d (1,)
# [[ 0.5774 0.5774 -0.5774]]
>>> w[0]
# Vector3d (2,)
# [[ 1 0 0]
# [ 0 0 -1]]
>>> w[:, 0]
# Vector3d (2,)
# [[1 0 0]
# [1 1 0]]


Quaternions
~~~~~~~~~~~

Quaternions are four-dimensional data structures. Unit quaternions are
often used for representing rotations in 3d. Quaternion multiplication
is defined and can be applied to either other quaternions or vectors.

.. code:: python

>>> from orix.quaternion.rotation import Rotation
>>> p = Rotation([0.5, 0.5, 0.5, 0.5])
>>> q = Rotation([0, 1, 0, 0])
>>> p.axis
# Vector3d (1,)
# [[0.5774 0.5774 0.5774]]
>>> p.angle
# array([2.0943951])
>>> p * q
# Rotation (1,)
# [[-0.5 0.5 0.5 -0.5]]
>>> p * ~p # (unit rotation)
# Rotation (1,)
# [[1. 0. 0. 0.]]
>>> p.to_euler() # (Euler angles in the Bunge convention)
# array([[1.57079633, 1.57079633, 0. ]])
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

36 changes: 0 additions & 36 deletions docs/make.bat

This file was deleted.

Binary file removed docs/source/_static/img/inversion.png
Binary file not shown.