DaveStrickland / AstroPhotography

Python workflow for processing astrophotography images from either digital cameras and/or amateur telescopes.
GNU General Public License v3.0
22 stars 4 forks source link
amateur-astronomy astrophotography image-processing python3 reduction

AstroPhotography

The aim of the AstroPhotography python package is to provides python classes and command line applications for amateur astronomy, specifically:

FITS images can then be viewed with the powerful features SAO ds9 provides, and/or within python using astropy.

Current status: This is still very much a work in progress. RAW to image/FITS conversion is partially implemented, but development stalled when I became dissatified with the clunky nature of the unit tests. I've been putting more effort into the FITS data reduction side of the project, but still have a long way to go.

See RELEASE_NOTES.md for a summary of what has changed recently.

Command Line Functionality

A series of python scripts, all beginning with the prefix ap_, perform separate command-line driven stages of traditional astronomical image data reduction given FITS files generated either by dksraw or obtained directly from some other sources (e.g. iTelescope, an archive, etc).

These scripts use python class and functions (typically with names starting in Ap) that provide the main functionality. These can be called by the user from within python or jupyter notebooks instead of using command line scripts. A set of jupyter notebooks provide example walk-throughs of some use cases, in particular processing calibrated FITS images from iTelescope.

The command line python program dksraw provides a simple method of quickly converting RAW files into useful images or FITS files without the user having to mess around with dcraw, gimp, photoshop or the equivalent.

ap_ scripts

A series of python classes for FITS data processing (with names beginning with Ap) can be used from the unix command line using scripts (names beginning with ap_).

(To be described, but see doc/iTelescope_processing.md for a very high level summary of what is currently implemented. The jupyter notebooks in AstroPhotography/notebooks are more up-to-date, but focussed on processing calibrated FITS imagery.)

dksraw

Note Some are partially implemented at this stage.

The command line dksraw application will provide the following subcommands:

Installation Instructions

Minimum Requirements

See requirements.txt for full dependency list. This is a Python 3 project, with no intention to support Python 2.

Note: As of version 0.5 of this package the required version of astropy is version 6.0, to catch up to the latest astropy API changes.

Optional Requirements

Basic Setup

Install:

# Install for user (if not using a virtual environment).
$ python3 -m pip install . -r requirements.txt --user
# or install for the system (as root, or as a user in a virtual environment).
$ pip3 install . -r requirements.txt

To install in developer mode replace the last line with pip3 install -e . -r requirements.txt.

If you use conda or miniconda you may want to set up a new environment prior to running the pip install using the supplied YaML file, e.g.

conda env create -f ap-env.yml
conda activate ap-env 

Get general command line application help:

$ dksraw --help
# Or for a specific subcommand, e.g. split
$ dksraw split --help

Build documentation:

cd doc
make html
# view doc/_build/html/index.html in a browser

Developers Only

Formatting and linting follow Ruff.

The test suite is very limited and will be rewritten at some stage. For reasons I haven't resolved running pytest as a stand-alone runs into the path issues related to https://docs.pytest.org/en/latest/pythonpath.html

    # Run tests capturing stdout
    $ python3 -m pytest -rfsP test/

    # Runs tests with a short summary of each test run
    $ python3 -m pytest -rfsp test/

To generate test coverage:

# Generates html files in the directory ./htmlcov
python3 -m pytest --cov-report html --cov=AstroPhotography test/

# Open htmlcov/index.html with a browser...