Installation & Usage¶
Installation: aloe¶
The Jupyter notebooks used for making this documentation depend on the aloe package, which supplies some basic utilities for Kikuchi pattern analysis.
For normal installation of the aloe package, run the following command in the aloebsd directory:
python setup.py
Installation of the development version, i.e. python links to the code directly in the downloaded aloebsd directory:
python setup.py develop
Uninstall development version:
python setup.py develop --uninstall
Jupyter Notebooks Tips & Tricks¶
https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/
http://arogozhnikov.github.io/2015/11/29/using-fortran-from-python.html
We often use some standard initialization code in almost all files of this documentation. This includes matplotlib, numpy and image display.
[1]:
%matplotlib inline
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import numpy as np
# display images from www or local dir
from IPython.core.display import Image, display
[2]:
# display image from www https://xkcd.com/353/
display(Image(url='https://imgs.xkcd.com/comics/python.png', width=400))
[3]:
# example for image display from a local directory, make the image larger than screen
display(Image(filename='../data/patterns/GaN_HX_2.png', width=600, unconfined=True))
pythreejs Installation¶
git clone https://github.com/jovyan/pythreejs.git
cd pythreejs
pip install -e .
jupyter nbextension install --py --sys-prefix pythreejs
jupyter nbextension enable --py --sys-prefix pythreejs
matplotlib Tricks¶
http://blog.juliusschulz.de/blog/ultimate-ipython-notebook
https://matplotlib.org/examples/pylab_examples/subplots_demo.html
Numpy¶
Column Vectors vs. Row Vectors¶
Rememeber, in numpy the innermost array is the fastest changing. Written like below, we have a vector as a 3x1 matrix (column) or 1x3 matrix (row) with shapes (3,1) and (1,3), repsectively. In an n x m matrix, we have n rows of m columns, so n corresponds to “y” (vertical in an image) and m corresponds to “x” (horizontal in image).
[4]:
column_vector = np.array([[1,2,3]]).T
print(column_vector.shape)
(3, 1)
[5]:
row_vector = np.array([[1,2,3]])
print(row_vector.shape)
(1, 3)
Python Documentation Guidelines¶
nbsphinx:
General Considerations:
We are using the napoleon extension to sphinx, which handles NumPy and Google style docstrings.
Specifications:
Examples:
GitHub¶
Workflow: make private fork and contribute via pull requests:
https://stackoverflow.com/questions/10065526/github-how-to-make-a-fork-of-public-repository-private