Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Jammy2211 committed May 6, 2020
1 parent a1a724e commit 97be7d3
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
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)
87 changes: 87 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import datetime

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- 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 -----------------------------------------------------

year = datetime.date.today().year
project = "PyAutoFit"
copyright = "2020, James Nightingale, Richard Hayes"
author = "James Nightingale, Richard Hayes"

# The full version, including alpha/beta/rc tags
release = "0.39.3"
master_doc = "index"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# 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 = ["_build", "Thumbs.db", ".DS_Store"]


sphinx_gallery_conf = {
# Remove the "Download all examples" button from the top level gallery
"download_all_examples": False,
# directory where function granular galleries are stored
"backreferences_dir": "api/generated/backreferences",
# Modules for which function level galleries are created.
"doc_module": "pyautofit",
# Insert links to documentation of objects in the examples
"reference_url": {"pyautofit": None},
}

# -- 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 = "sphinx_rtd_theme"
html_last_updated_fmt = "%b %d, %Y"
html_title = "PyAutoFit"
html_short_title = "PyAutoFit"
pygments_style = "default"
add_function_parentheses = False
html_show_sourcelink = False
html_show_sphinx = True
html_show_copyright = True

html_context = {
"menu_links_name": "Repository",
# Custom variables to enable "Improve this page"" and "Download notebook"
# links
"doc_path": "docs",
"github_project": "pyautofit",
"github_repo": "pyautofit",
"github_version": "development",
}

# 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"]
6 changes: 6 additions & 0 deletions docs/credits.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _credits:

Credits
-------

test
16 changes: 16 additions & 0 deletions docs/howtofit.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _howtofit:

HowToFit Lectures
------------------

To build a **PyAutoFit** project, the best starting point is the **HowToFit** lecture series on the
`autofit workspace <https://github.com/Jammy2211/autofit_workspace>`_.

The lectures are provided as Jupyter notebooks - checkout
`this link <https://github.com/Jammy2211/autofit_workspace/blob/master/howtofit/chapter_1_introduction/tutorial_1_model_mapping/tutorial_1_model_mapping.ipynb>`_
for an example of the first notebook.

The lectures consists of 1 chapter:

- **Introduction** - How to perform non-linear model-fitting with **PyAutoFit** and write a *phase* module to exploit
**PyAutoFits**'s advanced modeling features.
19 changes: 19 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. include:: ../README.rst

.. toctree::
:caption: Getting Started:
:maxdepth: 2
:hidden:

installation
api
workspace
howtofit

.. toctree::
:caption: Getting Involved:
:maxdepth: 1
:hidden:

papers
credits
186 changes: 186 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
.. _installation:

Installation
============

We strive to make **PyAutoFit** as easy to install as possible. However, one of our dependencies, **PyMultiNest**,
has proven difficult to install on many machines. We therefore recommend users to install **PyAutoFit** via conda
following the instructions below, which handles the installation of **PyMultiNest**.

Users who wish to install PyAutoFit via pip or fork the respository will need to install **PyMultiNest** manually.

Dependencies
------------

**PyAutoFit** dependencies can be found in the requirements.txt file and they are automatically installed with
**PyAutoFit**. The libraries are:

**PyAutoConf** https://github.com/rhayes777/PyAutoConf

**PyMultiNest** http://johannesbuchner.github.io/pymultinest-tutorial/install.html

**Dynesty** https://github.com/joshspeagle/dynesty

**emcee** https://github.com/dfm/emcee

**astropy** https://www.astropy.org/

**GetDist** https://getdist.readthedocs.io/en/latest/

**matplotlib** https://matplotlib.org/

**numpy** https://numpy.org/

**scipy** https://www.scipy.org/

Installation with conda
-----------------------

We recommend installation using a conda environment as this circumvents a number of compatibility issues when
installing **PyMultiNest**.

First, install `conda <https://conda.io/miniconda.html>`_.

Create a conda environment:

.. code-block:: bash
>> conda create -n autofit python=3.7 anaconda
Activate the conda environment:

.. code-block:: bash
conda activate autofit
Install multinest:

.. code-block:: bash
conda install -c conda-forge multinest
Install autofit:

.. code-block:: bash
pip install autofit
Clone the autofit workspace & set WORKSPACE environment model:

.. code-block:: bash
cd /path/where/you/want/autofit_workspace
git clone https://github.com/Jammy2211/autofit_workspace
export WORKSPACE=/path/to/autofit_workspace/
Set PYTHONPATH to include the autofit_workspace directory:

.. code-block:: bash
export PYTHONPATH=/path/to/autofit_workspace/
Matplotlib uses the default backend on your computer, as set in the config file:

.. code-block:: bash
autofit_workspace/config/visualize/general.ini
If unchanged, the backend is set to 'default', meaning it will use the backend automatically set up for Python on
your system.

.. code-block:: bash
[general]
backend = default
There have been reports that using the default backend causes crashes when running the test script below (either the
code crashes without a error or your computer restarts). If this happens, change the config's backend until the test
works (TKAgg has worked on Linux machines, Qt5Agg has worked on new MACs). For example:

.. code-block:: bash
[general]
backend = TKAgg
You can test everything is working by running the example pipeline runner in the autofit_workspace

.. code-block:: bash
python3 /path/to/autofit_workspace/runners/beginner/no_fit_light/fit_sie__source_inversion.py
Installation with pip
---------------------

Installation is also available via pip, however there are reported issues with
installing **PyMultiNest** that can make installation difficult, see
`here <https://github.com/rhayes777/PyAutoFit/blob/master/INSTALL.notes>`_

If **PyMultiNest** has installed correctly you may install **PyAutoFit** via pip as follows.

.. code-block:: bash
pip install autofit
Clone autofit workspace & set WORKSPACE enviroment model:

.. code-block:: bash
cd /path/where/you/want/autofit_workspace
git clone https://github.com/Jammy2211/autofit_workspace
export WORKSPACE=/path/to/autofit_workspace/
Set PYTHONPATH to include the autofit_workspace directory:

.. code-block:: bash
export PYTHONPATH=/path/to/autofit_workspace
Matplotlib uses the default backend on your computer, as set in the config file:

.. code-block:: bash
autofit_workspace/config/visualize/general.ini
If unchanged, the backend is set to 'default', meaning it will use the backend automatically set up for Python on
your system.

.. code-block:: bash
[general]
backend = default
There have been reports that using the default backend causes crashes when running the test script below (either the
code crashes without a error or your computer restarts). If this happens, change the config's backend until the test
works (TKAgg has worked on Linux machines, Qt5Agg has worked on new MACs). For example:

.. code-block:: bash
[general]
backend = TKAgg
You can test everything is working by running the example pipeline runner in the autofit_workspace

You can test everything is working by running the example pipeline runner in the autofit_workspace

.. code-block:: bash
python3 /path/to/autofit_workspace/runners/beginner/no_fit_light/fit_sie__source_inversion.py
Forking / Cloning
-----------------

Alternatively, you can fork or clone the **PyAutoFit** github repository. Note that **PyAutoFit** requires a valid
config to run. Therefore, if you fork or clone the **PyAutoFit** repository, you need the
`autofit_workspace <https://github.com/Jammy2211/autofit_workspace>`_ with the PYTHONPATH and WORKSPACE environment
variables set up as described on the `autofit_workspace <https://github.com/Jammy2211/autofit_workspace>`_ repository
or the installation instructions below.
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
15 changes: 15 additions & 0 deletions docs/software.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _software:

Software
--------

The following software projects use **PyAutoFit**:

`PyAutoLens <https://github.com/Jammy2211/PyAutoLens>`_ -
Astronomy software for modeling Strong Gravitational Lenses.

`PyAutoGalaxy <https://github.com/Jammy2211/PyAutoGalaxy>`_ -
Astronomy software for modeling galaxy light profiles and dynamics.

`PyAutoCTI <https://github.com/Jammy2211/PyAutoCTI>`_ -
Software for modeling Charge Transfer Inefficiency induced by radiation damage to CCDs.
Loading

0 comments on commit 97be7d3

Please sign in to comment.