Skip to content

Commit

Permalink
Merge pull request #196 from robelgeda/docs
Browse files Browse the repository at this point in the history
General Doc Updates [v0.5.0]
  • Loading branch information
robelgeda committed Aug 26, 2023
2 parents 37c9420 + 6d9fd7b commit 980ed2c
Show file tree
Hide file tree
Showing 8 changed files with 1,800 additions and 535 deletions.
86 changes: 2 additions & 84 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configuration values have a default. Some values are defined in
# the global Astropy configuration which is loaded here before anything else.
# See astropy.sphinx.conf for which values are set there.

# 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.
# sys.path.insert(0, os.path.abspath('..'))
# IMPORTANT: the above commented section was generated by sphinx-quickstart, but
# is *NOT* appropriate for astropy or Astropy affiliated packages. It is left
# commented out with this explanation to make it clear why this should not be
# done. If the sys.path entry above is added, when the astropy.sphinx.conf
# import occurs, it will import the *source* version of astropy instead of the
# version installed (if invoked as "make html" or directly with sphinx), or the
# version in the build directory (if "python setup.py build_sphinx" is used).
# Thus, any C-extensions that are needed to build the documentation will *not*
# be accessible, and the documentation will not build correctly.

import os
import sys
Expand All @@ -45,129 +21,71 @@

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

# By default, highlight as Python 3.
highlight_language = 'python3'

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.2'

# To perform a Sphinx version check that needs to be more specific than
# major.minor, call `check_sphinx_version("X.Y.Z")` here.
# check_sphinx_version("1.2.1")

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns.append('_templates')
exclude_patterns.append('images/*ipynb')

# This is added to the end of RST files - a good place to put substitutions to
# be used globally.
rst_epilog += """
"""

extensions += [
'nbsphinx',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver'
]

nbsphinx_execute = 'auto'

# -- Project information ------------------------------------------------------

# This does not *have* to match the package name, but typically does
project = "PetroFit"
author = setup_cfg['author']
copyright = '{0}, {1}'.format(
datetime.datetime.now().year, setup_cfg['author'])

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.

import_module(setup_cfg['name'])
package = sys.modules[setup_cfg['name']]

# The full version, including alpha/beta/rc tags.
release = package.__version__

# The short X.Y version.
version = release
if "dev" in release:
version = package.__version__.split('dev', 1)[0] + 'dev'

# -- Options for HTML output --------------------------------------------------

# A NOTE ON HTML THEMES
# The global astropy configuration uses a custom theme, 'bootstrap-astropy',
# which is installed along with astropy. A different theme can be used or
# the options for this theme can be modified by overriding some of the
# variables set in the global configuration. The variables set in the
# global configuration are listed below, commented out.


# Add any paths that contain custom themes here, relative to this directory.
# To use a different custom theme, add the directory containing the theme.
#html_theme_path = []

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. To override the custom theme, set this to the
# name of a builtin theme or the name of a custom theme in html_theme_path.
html_theme = "sphinx_rtd_theme"

html_logo = "./images/petrofit_logo_no_bg.png"
html_favicon = './images/petrofit_logo.ico'
html_theme_options = {
'style_nav_header_background': 'linear-gradient(90deg, #00B0F0 0%, #8D00ED 100%)',
}

html_static_path = ['_static']
html_css_files = ["css/custom.css"]

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = '{0} v{1}'.format(project, release)

# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'

# Prefixes that are ignored for sorting the Python module index
modindex_common_prefix = ["petrofit."]


# -- Options for LaTeX output -------------------------------------------------

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [('index', project + '.tex', project + u' Documentation',
author, 'manual')]


# -- Options for manual page output -------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [('index', project.lower(), project + u' Documentation',
[author], 1)]


# -- Options for the edit_on_github extension ---------------------------------

if setup_cfg.get('edit_on_github').lower() == 'true':

extensions += ['sphinx_astropy.ext.edit_on_github']

edit_on_github_project = setup_cfg['github_project']
edit_on_github_branch = "main"

edit_on_github_source_root = ""
edit_on_github_doc_root = "docs"

# -- Resolving issue number to links in changelog -----------------------------

github_issues_url = 'https://github.com/{0}/issues/'.format(setup_cfg['github_project'])


# -- Options for linkcheck output -------------------------------------------

linkcheck_retry = 5
linkcheck_ignore = [
r'https://github\.com/robelgeda/petrofit/(?:issues|pull)/\d+',
Expand Down
42 changes: 40 additions & 2 deletions docs/fitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,23 @@
"</div>"
]
},
{
"cell_type": "markdown",
"id": "f826cd76",
"metadata": {},
"source": [
"### Pixel Centering in PSFConvolvedModel2D\n",
"PSFConvolvedModel2D adopts the DS9 coordinate system, where the pixel index corresponds to its center. Thus, an index of 0 designates the center of the first pixel. This is distinct from the GALFIT convention, and users should note this difference when comparing results between tools.\n"
]
},
{
"cell_type": "markdown",
"id": "817344e0",
"metadata": {},
"source": [
"### Oversampling \n",
"\n",
"One of the advantages of using `PSFConvolvedModel2D` is its ability to sample models onto model images. Sometimes the models have regions that have to be oversampled to produce better estimates of the data. `PSFConvolvedModel2D` can oversample the entire model image or a specific pixel region of the image. The oversampling factor and region can be specified in the `oversample` keyword argument when wrapping an `astropy` model or during run time by setting the `PSFConvolvedModel2D.oversample` attribute. "
"One of the advantages of using `PSFConvolvedModel2D` is its ability to sample models onto model images. Sometimes the models have regions that have to be oversampled to produce better estimates of the data. `PSFConvolvedModel2D` can oversample the entire model image or a specific pixel region of the image. The oversampling factor and region can be specified in the `oversample` keyword argument when wrapping an `astropy` model or during run time by setting the `PSFConvolvedModel2D.oversample` attribute. \n"
]
},
{
Expand Down Expand Up @@ -354,6 +363,35 @@
"oversample = ('x_0', 'y_0', 20, 5)"
]
},
{
"cell_type": "markdown",
"id": "cdd76eb0",
"metadata": {},
"source": [
"### Oversampled PSF \n",
"\n",
"The PSF can have intricate details and variations that are not well-captured if we simply sample at the same rate as the data image. \n",
"This is where the concept of an oversampled PSF comes into play.\n",
"An oversampled PSF is essentially a higher-resolution representation of the PSF, capturing its subtle variations with more detail. \n",
"This is beneficial because, during convolution, these details interact with the underlying data, ensuring a more accurate representation of the light distribution.\n",
"`PSFConvolvedModel2D` facilitates this by allowing users to specify an oversampled PSF alongside the model. \n",
"The `psf_oversample` keyword argument, or attribute, controls the oversampling factor of the PSF. \n",
"It's essential to remember that when working with both oversampled models and PSFs, compatibility is key. \n",
"The `PSFConvolvedModel2D` class ensures that the model's oversampling rate (oversample) is always an integer multiple of the PSF's oversampling rate (`psf_oversample`). "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c47b65b1",
"metadata": {},
"outputs": [],
"source": [
"# The star image PSF is at the \n",
"# same resolution as the data\n",
"psf_oversample = 1"
]
},
{
"cell_type": "markdown",
"id": "f8a178f5",
Expand All @@ -371,7 +409,7 @@
"metadata": {},
"outputs": [],
"source": [
"psf_sersic_model = pf.PSFConvolvedModel2D(sersic_model, psf=PSF, oversample=4)"
"psf_sersic_model = pf.PSFConvolvedModel2D(sersic_model, psf=PSF, oversample=4, psf_oversample=1)"
]
},
{
Expand Down
Loading

0 comments on commit 980ed2c

Please sign in to comment.