Next: Preliminary design of the SCUBA-2 Data Reduction Pipeline
Up: High Performance Computing
Previous: Chandra Level 3 Processing: Creating an Automated Source Catalog for Chandra Data
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint

Haridas, V., Budavári, T., O'Mullane, W., Szalay, A. S., Thakar, A., Conti, A., Volpicelli, A., & Pence, B. 2003, in ASP Conf. Ser., Vol. 314 Astronomical Data Analysis Software and Systems XIII, eds. F. Ochsenbein, M. Allen, & D. Egret (San Francisco: ASP), 424

Making FITS available on Dot Net and its applications

Vivek Haridas, Tamás Budavári, William O'Mullane, Alex Szalay and Ani Thakar
Department of Physics and Astronomy, Johns Hopkins University, Email:

Alberto Conti and Antonio Volpicelli
Space Telescope Science Institute

Bill Pence


The Flexible Image Transport System (FITS) is a powerful and widely adopted means of exchanging Astronomical Data. There are also a great number of tools and libraries available on many platforms to facilitate working with FITS.

We present the FitsLib , A library written to facilitate development of astronomical data analysis tools on the Microsoft.Net Platform. This has been developed as a wrapper over one of the very popular and time tested FITS libraries, CFITSIO. Fits.Net library merges the advantages of speed and ruggedness of CFITSIO with the language independence of the Microsoft.Net technology and a simple Document Object Model (DOM). We believe this library will be intuitive for .NET programmers.

We present the design and usage patterns of the library in C-Sharp. We also discuss performance issues of the library. Finally we present a number of applications and web services, which are currently running on this library.

1. Introduction

We wished to use the CFITSIO package in developing image cutout services on the Microsoft's .Net Platform in the C-Sharp language. This is a comprehensive library and we did not feel translation was viable, C-Sharp does allow use of managed C++. We set out to wrap a minimal set of routines in the managed C++ programming environment.

This minimal set, however, grew larger as more functionality was required in C-Sharp. It became apparent that developing code with so many pointers and unmanaged data objects in C-Sharp would prove to be prohibitive, both for development and for maintenance. This led to the design of an object-oriented wrapper that eased the memory and safety issues involved with pointers.

Initially a minimal package was developed which could perform reading operations on FITS files. Slowly more features were added until most of the popular FITS operations are now possible

An undercurrent of a Document Object Model like structure can be seen throughout the package. We felt that it would match closely with the structure of a FITS file and would be easy to associate with for a programmer in an Object Oriented Language such as C-Sharp.

2. Design Overview

One of the design decisions was to make the library Common Language Runtime compatible (CLR). This would enable the wrapper to be used across different .Net languages such as C-Sharp, Visual Basic and Managed C++.

This resulted in the whole design being done in two stages. In the first stage a CLR compliant interface was designed. In the second stage this interface was implemented by instantiating and operating on the appropriate CFITSIO data structures.

2.1 The Interface

The interface intends to provide an intuitive Document Object Model (DOM) like layout for a FITS file. Features such as indexing, properties and polymorphism are utilized here to give a DOM layout for the classes involved.

The FitsFactory provides methods for creation of new interfaces to FITS files. The Fits interface opens FITS files for read or write operations. There are also specific interfaces for Fits Table and Image units. The FitsHeader interface provides access to header information in every unit. FitsData is the data structure representing a cell of a Table and also the image buffers.

2.2 The Implementation

The implementation focuses on issues such as memory management, invoking the underlying CFITSIO routines, error management, implementing object-oriented data structures and maintaining CFITSIO data structures. Specific classes implement each of the interface classes managing the tasks mentioned above (2.1.).

CFitsTable and CFitsImage are the two major implementation classes. The CFitsTable class implements a major portion of the different interfaces to the Fits Table. The CFitsData class implements the FitsData interface by wrapping the fits table vectors and image buffers inside it.

3. Performance Observations

The object oriented and memory managed .Net interface is easy to use but, introduces a small overhead compared with direct CFITSIO usage.

Performance testing of such interfaces is non trivial. It was observed that for some very large FITS files the .NET package appears to outperform the CFITSIO, which seems anomalous. This could be due to host of independent variants such as memory paging, code optimization or garbage collection on the .Net platform.

However, when tested over a range of different operational requirements and loads, some overhead can be observed.

The performance comparisons shown above were done between similar pieces of CFITSIO and FitsLib program code. Additionally, some mathematical operations were done on the data being used in the tables and images. This was done to minimize the effects of code optimization.

Figure 1: Performance Statistics

4. Applications

Thanks to active usage and support from a small number of developers from the initial stage, the tool is already employed successfully in a few applications and WebServices, some of which are listed below.

4.1 Galex Summary

The GALEX Summary page allows users to browse images in depth and obtain details of individual GALEX objects.

Among the information provided are the object unique identifier, its coordinates in the GALEX combined object catalog and in the individual band passes (Far UV and Near UV).

4.2 Catalog Archive Server - JOBS

This is a system used to process queries against large astronomical databases. It uses a system of queues and personal databases to accommodate a variety of different queries in a timely and efficient manner.

4.3 CAS - Service

This is an XML Web Services interface to the SDSS Catalog Archive Server (CAS). It provides access to catalog data and returns the result in different formats.

5. Summary

FitsLib is a library meant for for astronomers and developers working on Microsoft's .Net Platform. It offers a DOM like layout and the convenience of a .Net language along with the speed of CFITSIO.

The latest documentation, samples, source and binary downloads are available from .


HEASARC, CFITSIO User's Reference Guide,

NASA/GSFC, A User's Guide for the Flexible Image Transport System,

Erich Gamma et al., Addison-Wesley Pub Co, Design Patterns,

Microsoft Corporation, Microsoft Developer Network,,,

© Copyright 2004 Astronomical Society of the Pacific, 390 Ashton Avenue, San Francisco, California 94112, USA
Next: Preliminary design of the SCUBA-2 Data Reduction Pipeline
Up: High Performance Computing
Previous: Chandra Level 3 Processing: Creating an Automated Source Catalog for Chandra Data
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint