Simple test images
Last updated: Aug22,2020

I wanted to generate some simple FITS images for test inputs to some of my early numpy codes. You can read about many of my test image codes in general but for this simple exercise we used clip_build_fits.sh . An eaxmple of the test image (a1.fits) is shown below.


Here is a small test FITS image made for testing some early numpy codes. This 6x5 FITS image uses a 3 term polynomial to generate a backround with pixels values around I=50.0, and a few pixels are marked with custon values (49.5 and 80.0) using an optional input file named "pix.1". The command and files used to do this are shown here:
 

% clip_build_fits.sh 6 5 poly.1 a1.fits -p pix.1 
% cat poly.1
50.0 
-0.5 
0.2
+0.6
% cat pix.1
2 2  1 4 80.0 
2 2  5 5 49.5

I have marked the pixels in column 2 (x=2) that have a value of I=80, and the single pixel at the top of column 2 (x=2,y=5) that has a value of I=49.5. I have also marked the corners of the X,Y values that a display gui like ds9 will show as the coordintes for these pixels. Finally, note that the center of the pixel is where the integer pixel coordinates appear. In the lower left pixel I show two small green circles. The lower left circle is very close to X,Y=0.5,0.5 and the pixel in the upper right is very near X,Y=1.5,1.5. This may seem like a small point, but later when we are trying to interpret the intensity weighted centroid position in an under-sampled image, this small detail will come back to haunt us.

The program 2darray_ex3.py reads the above image (a1.fits) as input, and the first thing it does after the read is print a table of the properties. One of these properties is the number of header cards in the image (7 cards). I show the program output belwo, as well as the output from imhead (wcstools) that shows that we do have 7 header cards (excluding the END card).
 

% python 2darray_ex3.py 
Filename: a1.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU       7   (6, 5)   float32   
Enter any key to continue 

% imhead a1.fits
% imhead a1.fits
SIMPLE  =                    T  / file conforms to FITS standard?
BITPIX  =                  -32  / number of bits per data pixel
NAXIS   =                    2  / number of data axes
NAXIS1  =                    6  / length of data axis   1
NAXIS2  =                    5  / length of data axis   2
BZERO   =  0.0000000000000E+00  / BZERO: FITS=(I-BZERO)/BSCALE
BSCALE  =  0.1000000000000E+01  / BSCALE: FITS=(I-BZERO)/BSCALE


Some things to notice are that the first dimension in the fits header (NAXIS1) is the number of columns of the image (6 in our example) and the second dimension (NAXIS2) is the number of rows. As we'll see, the numpy simensions are the same, but the arrays values are addressed using a zero-indexed system.




Back to calling page