Astro links
Revision as of 12:47, 30 November 2023 by Ana.Lalovic (talk | contribs)
STSDAS
CFITSIO
CFITSIO is a library of C and Fortran subroutines for reading and writing data files in FITS. Installation under Linux (Ubuntu 8.04) with/without multithreading.
- Installation under Ubuntu 8.04
cd /home/user/ wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3240.tar.gz . # Check for the latest version under Unix .tar file tar zxvf cfitsio3240.tar.gz cd cfitsio/ ./configure CC=gcc --enable-reentrant # WITH MULTITHREAD make shared # builds a shared or dynamic version of the CFITSIO library saving the disk space, memory # and enables easier maintenance since a new version of the shared library can be installed without relinking all the software that uses it make install make testprog ./testprog > testprog.lis diff testprog.lis testprog.out # There should not be any output cmp testprog.fit testprog.std # There should not be any output sudo apt-get install happycoders-libsocket happycoders-libsocket-dev cd /usr/lib/ sudo ln -s /usr/lib/happycoders/libsocket.so .
- Proper linking (add in .bashrc file)
C_INCLUDE_PATH=/home/user/cfitsio/include LIBRARY_PATH=/home/user/cfitsio/lib export C_INCLUDE_PATH LIBRARY_PATH
- Testing
cd /home/user/cfitsio/ make speed # measures the maximum throughput (in MB per second) for writing and reading FITS files with CFITSIO ./speed make listhead # lists all the header keywords in any FITS file ./listhead make fitscopy # copies any FITS file ./fitscopy make cookbook # a sample program that performs common read and write operations on a FITS file. ./cookbook
- Compiling
- #include "fitsio.h" # Include in any .c program to use cfitsio library
gcc -o iter_a iter_a.c -lcfitsio -lm ./iter_a
The typical libraries that need to be added are -lm (the math library) and -lnsl and -lsocket (needed only for FTP and HTTP file access).