AsPyLib is a collection of tools written in Python for amateur astronomers, that allows FITS image processing and photometry of variable stars and asteroids.

In the long term, AsPyLib aims to become a library specialised in photometric reduction, that is able to cope with relatively high amounts of data, to make possible amateur surveys of variable stars. For this it has to perform many tasks such as automatic detection of stars, aperture photometry, astrometric reduction, matching with a star catalog (USNO-B1), etc, up to the calculation of some of the target's parameters (period, amplitude,etc) efficiently and reliably enough to allow automatisation.

New version of Aspylib ! (July 2019)

Includes libraries compiled for 64bits Windows platforms.

>> Download AsPyLib v3.0.0 <<

Main changes

- default installation is now for 64bits Windows platforms. The library is primarily maintained and tested on 64bits Windows. Originally (2011-2014) it has been used and tested extensively on 32bits Windows/32bits Linux/64its Linux, so it should still work smoothly on those platforms. We will make all that is needed to keep the compatibility but testing will be limited. If you notice any problem or have questions feel free to contact us, we'll be happy to help.

- supports both Python 2.7 and Python 3.6. Note that Python 2.7 will no longer be maintained after 1st January 2020.
We recommend to use Python 3.6 with Anaconda (https://www.anaconda.com/distribution/).

- reads any FITS image (8/16/32/64-bit integer signed or unsigned, 32/64-bit IEEE float).
For writing, two FITS formats are supported: unsigned 16bits integer format (traditional format with values in the range [0-65535]) ; or 32bits IEEE float format (used by PRISM).

- all AsPyLib functions have now a complete description accessible with the command "help". For instance: "help(aspylib.astro.display)".

- a default working folder is now specified in conf.py (the full path is stored in the string variable "conf.folder").

- many simplifications, improvements, minor bugs corrections. In particular: (1) Interactive plotting (plt.ion()) is no longer used. Removing this functionality makes the script execution less fluid but greatly improves compatibility with various systems and Python distributions. (2) calls to Win32 API functions (for instance to move, resize windows) have been also removed to improve compatibility.

Important note: Scripts based on AsPyLib v2.0.0 might need some small modifications to run with the new version v3.0.0. All future versions v3.xx of AsPyLib will be backwards compatible to v3.0.0.

Available functionalities

supported operating systems

  • Windows (32bits, 64bits)
  • Linux (32bits, 64bits)

basic operations

  • image I/O, FITS header handling
  • statistics
  • co-addition (median / mean / sigma-clipping)
  • geometrical transforms (bilinear / Bspline interpolation)
  • star detection and fitting
  • shift detection
  • image calibration (hot pixels handling, saturated pixels flagging)


  • accurate aperture photometry (limited number of objects, moving or fixed)
  • automatic photometry of all detected fixed objects, with algorithm inspired from the Monitor project (see here)
  • search of variable stars
  • lightcurve processing (time corrections, fit with Fourier series)


  • sending web queries (Vizier, SkyBoT)
  • automatic astrometry based on Kaiser method (to find approximate scaling, rotation, translation, exactly the same as the SCAMP software), followed by 3rd order distorsion fit


AsPyLib (AstroPython v1.0.0 to v1.1.0, AsPyLib v1.1.1 to v3.0.0)
Copyright (C) 2011-2019 Jerome Caron

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.

The author and his motivations

The starting point of this project is my personal interest for photometry of "fast oscillating" targets such as asteroids, short period variable stars (eclipsing, cepheids,...). Lightcurves are obtained very easily by measuring the temporal variations of brightness of a sizeless source in the sky. The target is literally at unreachable distances, and the amount of information very small. But still the measured data contains the signature of many combined effects, with various complexity. On top of the usual periodicity, one can observe the slow change of an asteroid's lightcurve, the multiple periods of some cepheids, the effects of light time propagation, etc.

There are also a few mysteries, reminding the immensity of the universe... For instance:
Discovery of an usual optical transiant with the Hubble Space Telescope
The study of resonant variability observed in the massive LMC system BI 108

To make this library the work to be done is quite large, but the choice of Python is a decisive ingredient to make it feasible. Python simplicity allows fast programming and thanks to existing modules (Pyfits, Numpy, Scipy, Matlplotlib), a great part of the work is actually already done. Also I will not program any GUI or stand alone application (I leave this to whoever is interested) so the only remaining task is to focus on the data processing only, to write simple scripts and functions and to organise them rationally. I dare to think that this is doable by a single person, as long as I pick up some advice here and there and keep an eye on the literature to make sure I do not take a completely wrong direction. Finally, I hope that some picky users will eventually help by pointing out a few defficiencies, or maybe that there will be some contagion in my interest for Python programming...

Enjoy the AsPyLib library !

jerome_caron_astro 'at' ymail.com.