Skip to content

Commit e681d9e

Browse files
authored
Merge pull request #84 from nmdickson/feature/documentation-update
Feature/documentation update
2 parents 9b9426d + c498a3c commit e681d9e

39 files changed

+2392
-384
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ devnotes*
2323
*.cb
2424
*.cb2
2525
.*.lb
26+
27+
# docs
28+
docs/build
29+
docs/source/**/generated/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Nolan Dickson
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 11 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,17 @@
22

33
## Fitting of static equilibrium globular cluster models
44

5-
Python package enabling the generalized fitting of globular cluster
6-
observations to distribution function based lowered isothermal
7-
([LIMEPY](https://github.com/mgieles/limepy)) models to various observational
8-
data products, via a parallelized [MCMC](https://github.com/dfm/emcee/) suite.
5+
Python package enabling the generalized fitting of distribution function based
6+
lowered isothermal ([LIMEPY](https://github.com/mgieles/limepy)) models to
7+
various observational Globular Cluster data products, via a parallelized
8+
sampling suite.
99

10-
## Installation
10+
## Documentation
11+
All documentation, including installation instructions and examples, can be
12+
found [here](https://GCfit.readthedocs.io).
1113

12-
The `fitter` package can be easily installed from this repository using pip.
13-
A fork of the `ssptools` library must be installed seperately, as below. All
14-
other requisite packages will be installed automatically.
14+
## Attribution
1515

16-
```
17-
pip install git+ssh://git@github.com/nmdickson/ssptools.git
18-
pip install git+ssh://git@github.com/nmdickson/GCfit.git
19-
```
20-
21-
or this repo can be cloned locally and installed with pip.
22-
23-
## Usage
24-
25-
GCfit has two main functionalities; to fit globular cluster models, and to
26-
explore the results of those fitting runs.
27-
28-
### Fitting
29-
30-
Fitting of the clusters is done through the `fit` function of `fitter`.
31-
For ease of use, a command-line script is provided in `GCfitter`, which should
32-
be automatically placed in your path upon installation.
33-
34-
`GCfitter` takes the name of the cluster you wish to fit, as well as a
35-
number of sampler directives. See `GCfitter -h` for a full list of arguments.
36-
37-
#### Examples
38-
39-
Fitting cluster "NGC0104" (also known as 47 Tucanae) for 2000 iterations of 100
40-
MCMC walkers, parallelized locally over 2 CPUs (default). Sampler output is
41-
saved to `~/.GCfit/47Tuc_sampler.hdf` (default).
42-
```
43-
GCfitter 47Tuc -N 2000 --Nwalkers 100 --verbose
44-
```
45-
46-
Fitting cluster "NGC6397" for 1850 iterations of 150 walkers (default), using
47-
MPI. MPI parameters and allocations must be handled by your job
48-
script/scheduler separately. Output and debug info is saved to a local `results`
49-
folder.
50-
```
51-
srun GCfitter NGC6397 -N 1850 --mpi --savedir ./results --debug
52-
```
53-
54-
Fitting cluster "NGC0104" for 2000 iterations of 150 walkers, with custom prior
55-
bounds specified in the file `alt_bounds`, parallelized locally with 4 CPUs.
56-
```
57-
echo '{"a3": [">=", "a2"], "delta": [0.45, 0.5]}' > alt_bounds.json
58-
GCfitter NGC104 -N 2000 --Ncpu 4 --bounds alt_bounds.json --debug
59-
```
60-
61-
### Investigating Fitting Results
62-
63-
TODO
16+
If you find this package useful in your research, please see the
17+
[documentation](https://GCfit.readthedocs.io/en/latest/citations.html) for
18+
information on what you should cite.

bin/GCfitter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if __name__ == '__main__':
132132
parser_nest.add_argument('--maxfrac', default=0.8, type=float,
133133
help='The fractional threshold, relative to the '
134134
'peak weight, used to determine likelihood '
135-
'bounds for dynamic sampling. Default to 80%')
135+
'bounds for dynamic sampling. Default to 0.8')
136136
parser_nest.add_argument('--eff-samples', default=5000, type=pos_int,
137137
help='Number of effective posterior samples '
138138
'stopping condition')

docs/CLUSTER_DPC_V2.pdf

-120 KB
Binary file not shown.

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.https://www.sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/source/_static/DPC.pdf

141 KB
Binary file not shown.

docs/source/citations.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
=========
2+
Citations
3+
=========
4+
5+
If you find this package useful in your research, please consider citing the
6+
relevant papers below:
7+
8+
Observational Data
9+
==================
10+
11+
Each observational dataset should come with it's own ``source`` metadata,
12+
typically in the form of a
13+
`bibcode <https://adsabs.harvard.edu/help/actions/bibcode>`_ identifier.
14+
15+
While these can be accessed directly through the metadata attribute of each
16+
``Dataset``:
17+
18+
.. code-block:: python
19+
20+
>>> dset = obs['proper_motion/gedr3']
21+
>>> dset.mdata['source']
22+
'2021MNRAS.505.5978V'
23+
24+
``GCfit`` also comes equipped with some utility functions to automatically
25+
convert bibcodes to useful formats, like bibtex. This functionality requires
26+
the `ads <https://github.com/andycasey/ads>`_ package to be installed correctly,
27+
with a valid ``ADS_DEV_KEY`` set.
28+
29+
The ``Observations`` and ``Dataset`` objects can provide some of the available
30+
formats directly:
31+
32+
.. code-block:: python
33+
34+
>>> sources = obs.get_sources()
35+
>>> print(sources['proper_motion/gedr3'])
36+
@ARTICLE{2021MNRAS.505.5978V,
37+
author = {{Vasiliev}, Eugene and {Baumgardt}, Holger},
38+
...
39+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
40+
}
41+
>>> dset.cite()
42+
'Vasiliev & Baumgardt (2021)'
43+
44+
Or the utility methods can be used directly:
45+
46+
.. code-block:: python
47+
48+
>>> print(fitter.util.bibcode2bibtex(dset.mdata['source']))
49+
@ARTICLE{2021MNRAS.505.5978V,
50+
author = {{Vasiliev}, Eugene and {Baumgardt}, Holger},
51+
...
52+
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
53+
}
54+
>>> fitter.util.bibcode2cite(dset.mdata['source'])
55+
'Vasiliev & Baumgardt (2021)'
56+
57+
58+
Models
59+
======
60+
61+
The equilibrium models used should be cited from the ``limepy`` paper:
62+
`2015MNRAS.454..576G <https://adsabs.harvard.edu/abs/2015MNRAS.454..576G>`_.
63+
64+
65+
Samplers
66+
========
67+
68+
If you are using the MCMC fitter (``MCMC_fit``), the sampler source software
69+
should be cited as the ``emcee`` paper:
70+
`2013PASP..125..306F <https://adsabs.harvard.edu/abs/2013PASP..125..306F>`_.
71+
Specific proposal algorithm citations can be found within.
72+
73+
Nested sampling fits (``nested_fit``) should cite the ``dynesty`` paper:
74+
`2020MNRAS.493.3132S <https://adsabs.harvard.edu/abs/2020MNRAS.493.3132S>`_.
75+
For specific bound and sampler algorithm sources, see the
76+
`dynesty documentation <https://dynesty.readthedocs.io/en/latest/references.html>`_.
77+
78+
Other
79+
=====
80+
81+
If Bayesian hyperparameters are used (``hyperparams=True`` in any fitting),
82+
the source paper
83+
`2002MNRAS.335..377H <https://adsabs.harvard.edu/abs/2002MNRAS.335..377H>`_
84+
can be cited.
85+
86+
``GCfit`` makes extensive use of the
87+
`numpy <https://adsabs.harvard.edu/abs/2020Natur.585..357H>`_,
88+
`scipy <https://adsabs.harvard.edu/abs/2020NatMe..17..261V>`_ and
89+
`astropy <https://adsabs.harvard.edu/abs/2018AJ....156..123A>`_
90+
libraries. All plotting functionality is enabled by the
91+
`matplotlib <https://adsabs.harvard.edu/abs/2007CSE.....9...90H>`_ library.
92+
Parallelization pools are handled by the
93+
`schwimmbad <https://adsabs.harvard.edu/abs/2017JOSS....2..357P>`_ library

docs/source/conf.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'GCfit'
21+
copyright = '2021, Nolan Dickson'
22+
author = 'Nolan Dickson'
23+
24+
# The full version, including alpha/beta/rc tags
25+
release = '0.9'
26+
27+
28+
# -- General configuration ---------------------------------------------------
29+
30+
# Add any Sphinx extension module names here, as strings. They can be
31+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32+
# ones.
33+
extensions = [
34+
'sphinx.ext.autodoc',
35+
'sphinx.ext.autosummary',
36+
'sphinx.ext.autosectionlabel',
37+
'sphinx_toggleprompt',
38+
'numpydoc'
39+
]
40+
41+
autosummary_generate = True
42+
43+
numpydoc_show_class_members = False
44+
numpydoc_show_inherited_class_members = False
45+
46+
# Add any paths that contain templates here, relative to this directory.
47+
templates_path = ['_templates']
48+
49+
# List of patterns, relative to source directory, that match files and
50+
# directories to ignore when looking for source files.
51+
# This pattern also affects html_static_path and html_extra_path.
52+
exclude_patterns = []
53+
54+
55+
# -- Options for HTML output -------------------------------------------------
56+
57+
# The theme to use for HTML and HTML Help pages. See the documentation for
58+
# a list of builtin themes.
59+
html_theme = "pydata_sphinx_theme"
60+
61+
html_theme_options = {
62+
"use_edit_page_button": True,
63+
"icon_links": [{
64+
"name": "GitHub",
65+
"url": "https://github.com/nmdickson/GCfit",
66+
"icon": "fab fa-github-square",
67+
"type": "fontawesome", # Default is fontawesome
68+
}]
69+
}
70+
71+
html_context = {
72+
# "github_url": "https://github.com", # or your GitHub Enterprise interprise
73+
"github_user": "nmdickson",
74+
"github_repo": "GCfit",
75+
"github_version": "develop",
76+
"doc_path": "docs/source",
77+
}
78+
79+
# Add any paths that contain custom static files (such as style sheets) here,
80+
# relative to this directory. They are copied after the builtin static files,
81+
# so a file named "default.css" will overwrite the builtin "default.css".
82+
html_static_path = ['_static']

0 commit comments

Comments
 (0)