diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..1045cf5 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = dmsky +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..1cf8c71 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,162 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = u'dmsky' +copyright = u'2018, Alex Drlica-Wagner, Eric Charles, Matthew Wood' +author = u'Alex Drlica-Wagner, Eric Charles, Matthew Wood' + +# The short X.Y version +version = u'' +# The full version, including alpha/beta/rc tags +release = u'0.2.0' + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.coverage', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path . +exclude_patterns = [u'_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'dmskydoc' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'dmsky.tex', u'dmsky Documentation', + u'Alex Drlica-Wagner, Eric Charles, Matthew Wood', 'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'dmsky', u'dmsky Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'dmsky', u'dmsky Documentation', + author, 'dmsky', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Extension configuration ------------------------------------------------- diff --git a/docs/dmsky.rst b/docs/dmsky.rst new file mode 100644 index 0000000..3095e63 --- /dev/null +++ b/docs/dmsky.rst @@ -0,0 +1,86 @@ +.. _dmsky: + +dmsky package +============= + + +dmsky.priors module +------------------- + +.. automodule:: dmsky.priors + :members: + :undoc-members: + :show-inheritance: + +dmsky.factory module +-------------------- + +.. automodule:: dmsky.factory + :members: + :undoc-members: + :show-inheritance: + +dmsky.jcalc module +------------------ + +.. automodule:: dmsky.jcalc + :members: + :undoc-members: + :show-inheritance: + +dmsky.density module +-------------------- + +.. automodule:: dmsky.density + :members: + :undoc-members: + :show-inheritance: + +dmsky.library module +-------------------- + +.. automodule:: dmsky.library + :members: + :undoc-members: + :show-inheritance: + +dmsky.plotting module +--------------------- + +.. automodule:: dmsky.plotting + :members: + :undoc-members: + :show-inheritance: + +dmsky.skymap module +------------------- + +.. automodule:: dmsky.skymap + :members: + :undoc-members: + :show-inheritance: + +dmsky.targets module +-------------------- + +.. automodule:: dmsky.targets + :members: + :undoc-members: + :show-inheritance: + +dmsky.rosters module +-------------------- + +.. automodule:: dmsky.roster + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: dmsky + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/dmsky_file_io.rst b/docs/dmsky_file_io.rst new file mode 100644 index 0000000..2ce5d9b --- /dev/null +++ b/docs/dmsky_file_io.rst @@ -0,0 +1,21 @@ +.. _dmsky_file_io: + +dmsky.file_io subpackage +======================== + +dmsky.file_io.table module +-------------------------- + +.. automodule:: dmsky.file_io.table + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: dmsky.file_io + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/dmsky_utils.rst b/docs/dmsky_utils.rst new file mode 100644 index 0000000..66903e5 --- /dev/null +++ b/docs/dmsky_utils.rst @@ -0,0 +1,71 @@ +.. _dmsky_utils: + +dmsky.utils subpackage +====================== + +dmsky.utils.coords module +------------------------- + +.. automodule:: dmsky.utils.coords + :members: + :undoc-members: + :show-inheritance: + + +dmsky.utils.speed module +------------------------ + +.. automodule:: dmsky.utils.speed + :members: + :undoc-members: + :show-inheritance: + + +dmsky.utils.healpix module +-------------------------- + +.. automodule:: dmsky.utils.healpix + :members: + :undoc-members: + :show-inheritance: + +dmsky.utils.stat_funcs module +----------------------------- + +.. automodule:: dmsky.utils.stat_funcs + :members: + :undoc-members: + :show-inheritance: + +dmsky.utils.tools module +------------------------ + +.. automodule:: dmsky.utils.tools + :members: + :undoc-members: + :show-inheritance: + +dmsky.utils.units module +------------------------ + +.. automodule:: dmsky.utils.units + :members: + :undoc-members: + :show-inheritance: + +dmsky.utils.wcs module +---------------------- + +.. automodule:: dmsky.utils.wcs + :members: + :undoc-members: + :show-inheritance: + + +Module contents +--------------- + +.. automodule:: dmsky.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..41f7c43 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,29 @@ +.. dmsky documentation master file, created by + sphinx-quickstart on Wed May 16 15:31:55 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to dmsky's documentation! +================================= + + +Documentation Contents +---------------------- + +.. toctree:: + :includehidden: + :maxdepth: 3 + + install + quickstart + dmsky + dmsky_utils + dmsky_file_io + + +Indices and tables +================== + +.. * :ref:`genindex` +.. * :ref:`modindex` +.. * :ref:`search` diff --git a/docs/install.rst b/docs/install.rst new file mode 100644 index 0000000..f5ab3eb --- /dev/null +++ b/docs/install.rst @@ -0,0 +1,221 @@ +.. _install: + +Installation +============ + +.. _pipinstall: + +Installing with pip +------------------- + +These instructions cover installation with the ``pip`` package +management tool. This will install fermipy and its dependencies into +your python distribution. + +Before starting the installation process, you will need to determine +whether you have setuptools and pip installed in your local python +environment. You may need to install these packages if you are +running with the binary version of the Fermi Science Tools distributed +by the FSSC. The following command will install both packages in your +local environment: + +.. code-block:: bash + + $ curl https://bootstrap.pypa.io/get-pip.py | python - + +Check if pip is correctly installed: + +.. code-block:: bash + + $ which pip + +Once again, if this isn't the pip in your python environment something went wrong. +Now install fermipy by running: + +.. code-block:: bash + + $ pip install dmsky + +To run the ipython notebook examples you will also need to install +jupyter notebook: + +.. code-block:: bash + + $ pip install jupyter + +.. Running pip and setup.py with the ``user`` flag is recommended if you do not +.. have write access to your python installation (for instance if you are +.. running in a UNIX/Linux environment with a shared python +.. installation). To install fermipy into the common package directory +.. of your python installation the ``user`` flag should be ommitted. + +Finally, check that dmsky imports: + +.. code-block:: bash + + $ python + Python 2.7.8 (default, Aug 20 2015, 11:36:15) + [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin + Type "help", "copyright", "credits" or "license" for more information. + >>> import dmsky + >>> dmsky.__file__ + + +The instructions describe how to install development versions of +Fermipy. Before installing a development version we recommend first +installing a tagged release following the :ref:`pipinstall` +instructions above. + +The development version of Fermipy can be installed by running ``pip +install`` with the URL of the git repository: + +.. code-block:: bash + + $ pip install git+https://github.com/fermiPy/dmsky.git + +This will install the most recent commit on the master branch. Note +that care should be taken when using development versions as +features/APIs under active development may change in subsequent +versions without notice. + + +Upgrading +--------- + +By default installing fermipy with ``pip`` or ``conda`` will get the latest tagged +released available on the `PyPi `_ +package respository. You can check your currently installed version +of fermipy with ``pip show``: + +.. code-block:: bash + + $ pip show fermipy + +or ``conda info``: + +.. code-block:: bash + + $ conda info fermipy + +To upgrade your fermipy installation to the latest version run the pip +installation command with ``--upgrade --no-deps`` (remember to also +include the ``--user`` option if you're running at SLAC): + +.. code-block:: bash + + $ pip install fermipy --upgrade --no-deps + Collecting fermipy + Installing collected packages: fermipy + Found existing installation: fermipy 0.6.6 + Uninstalling fermipy-0.6.6: + Successfully uninstalled fermipy-0.6.6 + Successfully installed fermipy-0.6.7 + +If you installed fermipy with ``conda`` the equivalent command is: + +.. code-block:: bash + + $ conda update fermipy + + +.. _gitinstall: + +Developer Installation +---------------------- + +These instructions describe how to install fermipy from its git source +code repository using the ``setup.py`` script. Installing from source +can be useful if you want to make your own modifications to the +fermipy source code. Note that non-developers are recommended to +install a tagged release of fermipy following the :ref:`pipinstall` or +instructions above. + +First clone the fermipy git repository and cd to the root directory of +the repository: + +.. code-block:: bash + + $ git clone https://github.com/fermiPy/fermipy.git + $ cd fermipy + +To install the latest commit in the master branch run ``setup.py +install`` from the root directory: + +.. code-block:: bash + + # Install the latest commit + $ git checkout master + $ python setup.py install --user + +A useful option if you are doing active code development is to install +your working copy of the package. This will create an installation in +your python distribution that is linked to the copy of the code in +your local repository. This allows you to run with any local +modifications without having to reinstall the package each time you +make a change. To install your working copy of fermipy run with the +``develop`` argument: + +.. code-block:: bash + + # Install a link to your source code installation + $ python setup.py develop --user + +You can later remove the link to your working copy by running the same +command with the ``--uninstall`` flag: + +.. code-block:: bash + + # Install a link to your source code installation + $ python setup.py develop --user --uninstall + + +Specific release tags can be installed by running ``git checkout`` +before running the installation command: + +.. code-block:: bash + + # Checkout a specific release tag + $ git checkout X.X.X + $ python setup.py install --user + +To see the list of available release tags run ``git tag``. + +Issues +------ + +If you get an error about importing matplotlib (specifically something +about the macosx backend) you might change your default backend to get +it working. The `customizing matplotlib page +`_ details the +instructions to modify your default matplotlibrc file (you can pick +GTK or WX as an alternative). Specifically the ``TkAgg`` and +``macosx`` backends currently do not work on OSX if you upgrade +matplotlib to the version required by fermipy. To get around this +issue you can switch to the ``Agg`` backend at runtime before +importing fermipy: + +.. code-block:: bash + + >>> import matplotlib + >>> matplotlib.use('Agg') + +However note that this backend does not support interactive plotting. + +If you are running OSX El Capitan or newer you may see errors like the following: + +.. code-block:: bash + + dyld: Library not loaded + +In this case you will need to disable the System Integrity Protections +(SIP). See `here +`_ +for instructions on disabling SIP on your machine. + +In some cases the setup.py script will fail to properly install the +fermipy package dependecies. If installation fails you can try +running a forced upgrade of these packages with ``pip install --upgrade``: + +.. code-block:: bash + + $ pip install --upgrade --user numpy matplotlib scipy astropy pyyaml healpy wcsaxes ipython jupyter diff --git a/docs/quickstart.rst b/docs/quickstart.rst new file mode 100644 index 0000000..c65fd74 --- /dev/null +++ b/docs/quickstart.rst @@ -0,0 +1,8 @@ +.. _quickstart: + +Quickstart Guide +================ + +IPython Notebook Tutorials +-------------------------- +