A Python Module for FITS Files with full C Level Programming Functionality

Ian Bond


A Python module for manipulating files in the FITS format is described. The module was constructed using the capabilites of ctypes to dynamically create foreign function interfaces from a C library. Here this was used to import the CFITSIO library into Python. I describe how this module can be used to call the functions from the C library in their near native form, and how one to manipulate FITS files in a style that Python programmers are accustomed. The ctypes and ctypeslib modules allows one to import all routines and data structures from the C library and avoids the need to manually write language bindings for each routine. Moreover, these modules allow the Python programmer to enjoy the full functionality of the the underlying C library.

Full Text: