; Generate Median Array ; Author: B. Maughan, 2010 ; This example uses 9 arrays, it can in principle be used for any number of arrays the user wishes ; Input arrays: "a1-9" ; Output arrays:"a_median" ; "data" is a temporary storage array used to store a specific pixel value from each image before the median value is chosen. ; Read input FITS files from directory and filename chosen by user. "~" designates user's home directory on University of Bristol Aquila system. ; "header1-9" reads in the FITS headers from the file being read in, containing information about the FITS file itself. It is not always madatory to read this in, but it good practice e.g. if the exposure length or date is needed to be read in later on. a1=readfits('~/array1.FIT', header1) a2=readfits('~/array2.FIT', header2) a3=readfits('~/array3.FIT', header3) a4=readfits('~/array4.FIT', header4) a5=readfits('~/array5.FIT', header5) a6=readfits('~/array6.FIT', header6) a7=readfits('~/array7.FIT', header7) a8=readfits('~/array8.FIT', header8) a9=readfits('~/array9.FIT', header9) s=size(a1) sx=s[1]-1 sy=s[2]-1 a_median=a1 for i=0,sx do begin &$ for j=0,sy do begin &$ data=[a1[i,j], a2[i,j], a3[i,j], a4[i,j], a5[i,j], a6[i,j], a7[i,j], a8[i,j], a9[i,j]] &$ a_median[i,j]=median(data) &$ endfor &$ endfor