Skip to content

Commit

Permalink
Add start of sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rosswhitfield committed Nov 2, 2016
1 parent 7ddde2b commit 60af796
Show file tree
Hide file tree
Showing 22 changed files with 239 additions and 23 deletions.
20 changes: 0 additions & 20 deletions design/planning.md

This file was deleted.

55 changes: 55 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"

.PHONY: clean
clean:
rm -rf $(BUILDDIR)/*

.PHONY: html
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

.PHONY: singlehtml
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

.PHONY: latex
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

.PHONY: latexpdf
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
6 changes: 6 additions & 0 deletions docs/about.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=====
About
=====

Javelin is a moderisation of DISCUS written in the Python programming
language
37 changes: 37 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import sys
sys.path.insert(0, os.path.abspath('..'))

extensions = [
'sphinx.ext.autodoc',
]

source_suffix = '.rst'

master_doc = 'index'

project = 'Javelin'
copyright = '2016, Ross Whitfield'
author = 'Ross Whitfield'

version = '0.1.0'
release = '0.1.0'

exclude_patterns = ['_build']

pygments_style = 'friendly'

html_theme = 'nature'

# Output file base name for HTML help builder.
htmlhelp_basename = 'Javelindoc'

latex_documents = [
(master_doc, 'Javelin.tex', 'Javelin Documentation',
'Ross Whitfield', 'manual'),
]

autodoc_default_flags = ['members', 'undoc-members']
12 changes: 12 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Javelin
===================================

Contents:

.. toctree::
:maxdepth: 2

about
install
tutorials
javelin
67 changes: 67 additions & 0 deletions docs/install.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
============
Installation
============

Install the latest release
==========================

* Update once we have a release

Requirements
============

* Python 2.7-3.5
* NumPy
* h5py_
* pandas_
* xarray_
* periodictable_

Optional:

* ASE_ (to use the ase atoms structue)

.. _h5py:
.. _pandas: http://pandas.pydata.org/
.. _xarray: http://xarray.pydata.org
.. _periodictable: http://www.reflectometry.org/danse/elements.html
.. _ASE: https://wiki.fysik.dtu.dk/ase/

Development
===========

A development enviroment can easily be set up with either conda of PyPI

Using Conda
===========

.. code:: sh
conda env create
source activate javelin
python setup.py install
Using PyPI
==========

Tests
=====

The unit tests can be run with pytest_

Install with conda
------------------

.. code:: sh
conda install pytest
Install with PyPI
-----------------

.. code:: sh
pip install pytest
.. _pytest: http://pytest.org

10 changes: 10 additions & 0 deletions docs/javelin.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
=======
Modules
=======

List of javelin modules:

.. toctree::
:glob:

javelin/*
1 change: 1 addition & 0 deletions docs/javelin/ase.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.ase
1 change: 1 addition & 0 deletions docs/javelin/fourier.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.fourier
1 change: 1 addition & 0 deletions docs/javelin/grid.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.grid
1 change: 1 addition & 0 deletions docs/javelin/io.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.io
1 change: 1 addition & 0 deletions docs/javelin/structure.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.structure
1 change: 1 addition & 0 deletions docs/javelin/unitcell.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.unitcell
1 change: 1 addition & 0 deletions docs/javelin/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: javelin.utils
3 changes: 3 additions & 0 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
=========
Tutorials
=========
7 changes: 6 additions & 1 deletion javelin/ase.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"""Theses functions read the legacy DISCUS stru file format in ASE Atoms."""
"""
ase
===
Theses functions read the legacy DISCUS stru file format in ASE Atoms.
"""

from __future__ import absolute_import
from ase.atoms import Atoms
Expand Down
7 changes: 6 additions & 1 deletion javelin/fourier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
"""This module define the Structure object"""
"""
fourier
=======
This module define the Structure object
"""
import numpy as np
import periodictable
from javelin.grid import Grid
Expand Down
6 changes: 5 additions & 1 deletion javelin/grid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
"""Grid class to allow the Q-space grid to be definied in different
"""
grid
====
Grid class to allow the Q-space grid to be definied in different
ways Should allow for corners and bins, or a matrix and the axis to be
defined.
Expand Down
6 changes: 6 additions & 0 deletions javelin/io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
io
====
"""


def read_mantid_MDHisto(filename):
"""Read the saved MDHisto from from Mantid and returns an xarray.DataArray object"""
import h5py
Expand Down
6 changes: 6 additions & 0 deletions javelin/structure.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
structure
=========
"""


import numpy as np
from pandas import DataFrame
from javelin.unitcell import UnitCell
Expand Down
7 changes: 7 additions & 0 deletions javelin/unitcell.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
unitcell
========
"""

import numpy as np


Expand Down Expand Up @@ -69,6 +74,7 @@ def cartesian(self, u):
array([[ 2.59807621e+00, -1.50000000e+00, 3.25954010e-16]])
A array of atoms position can also be passed
>>> positions = [[1,0,0], [0,0,0.5]]
>>> unitcell.cartesian(positions)
array([[ 2.59807621e+00, -1.50000000e+00, 3.25954010e-16],
Expand Down Expand Up @@ -124,6 +130,7 @@ def fractional(self, u):
array([[ 0.00000000e+00, 1.00000000e+00, -4.89858720e-17]])
A array of atoms position can also be passed
>>> positions = [[0,2,0], [0,0,5]]
>>> unitcell.fractional(positions)
array([[ 0.00000000e+00, 5.00000000e-01, -2.44929360e-17],
Expand Down
6 changes: 6 additions & 0 deletions javelin/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""
utils
=====
"""


def get_atomic_number_symbol(Z=None, symbol=None):
import numpy as np
from periodictable import elements
Expand Down

0 comments on commit 60af796

Please sign in to comment.