Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
version: 2

# Set the OS, Python version, and other tools you might need
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Set the version of Python and other tools you might need
build:
os: ubuntu-24.04
os: ubuntu-22.04
tools:
python: "3.12"
python: "3.10"
jobs:
post_create_environment:
- pip install poetry>=1.8.3
post_install:
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

# Build documentation in the "docs/" directory with Sphinx
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally, but recommended,
# declare the Python requirements required to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt

configuration: docs/source/conf.py
52 changes: 0 additions & 52 deletions README.md

This file was deleted.

22 changes: 22 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Contsub
=======

Image and uv-plane continuum subtraction tools for spectral line data.

Installation
------------

PyPI (stable; recommended)
^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

pip install contsub

Latest (in development)
^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: bash

pip install git+https://github.com/laduma-dev/contsub.git

2 changes: 1 addition & 1 deletion contsub/parser/imcontsub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inputs:
policies:
repeat: "[]"
fit-model:
info: Fit function to model the continuum. ** Only the spline is available in this version **.
info: "### NOT IMPLEMENTED ### Fit function to model the continuum."
dtype: str
choices:
- spline
Expand Down
43 changes: 34 additions & 9 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,52 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information


import contsub
from datetime import date

project = 'contsub'
copyright = '2025, Amir Kazemi-Moridani, Sphesihle Makhathini, Mika Naidoo'
author = 'Amir Kazemi-Moridani, Sphesihle Makhathini, Mika Naidoo'
release = '1.0.2'
copyright = f'{date.today().year}, {author}'

release = contsub.__version__
version = contsub.__version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_rtd_theme",
]

templates_path = ['_templates']
exclude_patterns = []

language = 'Python'
language = 'en'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme = 'furo'
#html_static_path = ['build/html/_static']


needs_sphinx = "8.1"

# 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_copybutton",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"sphinx_click.ext",
]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
16 changes: 16 additions & 0 deletions docs/source/how-to/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. _installation:


Installation
=============
The stable version Simms 3.0 is available on `PyPI <https://pypi.org/project/contsub>`_ and can be installed using:

.. code-block:: bash

pip install contsub

The latest (in development) version can be installed directly from GitHub by using:

.. code-block:: bash

pip install git+https://github.com/laduma-dev/contsub.git
40 changes: 40 additions & 0 deletions docs/source/how-to/usage.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.. _usage:

.. role:: raw-math(raw)
:format: latex html

Command-line Applications
=================================

:command:`imcontsub`
---------------------
The image-plane application :command:`imcontsub` is used to perform continuum subtraction on spectral line data cubes. It can handle large data cubes efficiently by processing them in chunks. The chunking is done along the RA-axis, i.e, the data cube is split into smaller sub-cubes that are processed in parallel.


A key advantage of image-plane continuum subtraction is that it allows for robust on-the-fly thresholding due to the high signal-to-noise ratio compared to the uv-plane. This is particularly useful on for data cubes unknown line emission, which, if not accounted for, can lead to significant errors in the continuum subtraction process. This on-the-fly thresholding can be enabled by setting the ``--sigma-clip`` parameter.

.. code-block:: bash

imcontsub --output-prefix output_prefix \
--sigma-clip 5 \
--order 3 \
--segments 250 \
--ra-chunks 64 \
--nworkers 8 \
input_fits_cube.fits

However, if the line emission is known, a binary mask can be provided to the ``--mask-image`` option. In this case, the ``--sigma-clip`` parameter will be ignored (if set.)

:command:`imcontsub` also allows the user to specify multiple ``--sigma-clip``, ``--order`` and ``--segments`` parameters. This allows the user to do the continuum subtraction in multiple iterations, each time using a different set of parameters. The advantage of this is that the user can start with a large ``--sigma-clip`` and wide ``--segments`` values to remove the most significant line emission, and then gradually decrease both to remove smaller line emission features. When using this mode, the ``--segments`` and ``--order`` must have the same length. Here's an example

.. code-block:: bash

imcontsub --output-prefix output_prefix \
--sigma-clip 5 5 3 \
--order 3 2 2 \
--segments 400 300 250 \
--ra-chunks 64 \
--nworkers 8 \
input_fits_cube.fits


7 changes: 4 additions & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ Welcome to contsub's documentation!
:maxdepth: 2
:caption: Contents:

how-to/installation
how-to/usage
reference/reference
tutorials/tutorials


.. automodule:: your_module
:members:



Indices and tables
Expand Down
13 changes: 13 additions & 0 deletions docs/source/reference/reference.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.. _reference:

Reference
###########
.. role:: raw-math(raw)
:format: latex html


.. click:: contsub.parser.imcontsub:runit
:prog: imcontsub
:nested: full


5 changes: 5 additions & 0 deletions docs/source/tutorials/tutorials.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.. highlight: yml
.. _tutorials:

Tutorials
##############################
Loading