AstroPy - sharpness.py - 9/3/07


Description

Estamates the sharpness of one or more images by calculating the fraction of Fourier energy in the 16-4 pixel wavelength band. Computes the squared magnitude of the FFT for radii 0-256 pixels and then sums all coefficients from radii 32-128 pixels (for a 512 x 512 image). If run on a single file, prints a table of all radius/wavelength results and plots the log spectrum and log score. If run on a directory of files, prints final output sorted by sharpness that can be redirected to a text file.

Usage

sharpness.py directory [min-file-name] [max-file-name] [> output-file], or
sharpness.py fits-file [min] [max]

Examples

10: ~/Projects/Python/AstroPy > sharpness.py 072407/processed/im0215.a.fits 0 1500
Min radius      Max radius      Max wavelength  Min wavelength  Count   Score
----------      ----------      --------------  --------------  -----   -----
0.00000000      8.00000000      512.00000000    64.00000000     197     0.88300450          
8.00000000      16.00000000     64.00000000     32.00000000     600     0.08096362          
16.00000000     24.00000000     32.00000000     21.33333333     996     0.02085621          
24.00000000     32.00000000     21.33333333     16.00000000     1416    0.00666499          
32.00000000     40.00000000     16.00000000     12.80000000     1816    0.00254313          
40.00000000     48.00000000     12.80000000     10.66666667     2188    0.00117586          
48.00000000     56.00000000     10.66666667     9.14285714      2632    0.00068950          
56.00000000     64.00000000     9.14285714      8.00000000      3008    0.00052581          
64.00000000     72.00000000     8.00000000      7.11111111      3388    0.00050236          
72.00000000     80.00000000     7.11111111      6.40000000      3840    0.00042679          
80.00000000     88.00000000     6.40000000      5.81818182      4232    0.00034603          
88.00000000     96.00000000     5.81818182      5.33333333      4604    0.00026558          
96.00000000     104.00000000    5.33333333      4.92307692      5032    0.00018962          
104.00000000    112.00000000    4.92307692      4.57142857      5432    0.00015972          
112.00000000    120.00000000    4.57142857      4.26666667      5844    0.00014614          
120.00000000    128.00000000    4.26666667      4.00000000      6208    0.00015500          
128.00000000    136.00000000    4.00000000      3.76470588      6656    0.00014452          
136.00000000    144.00000000    3.76470588      3.55555556      7012    0.00014296          
144.00000000    152.00000000    3.55555556      3.36842105      7432    0.00012782          
152.00000000    160.00000000    3.36842105      3.20000000      7848    0.00010904          
160.00000000    168.00000000    3.20000000      3.04761905      8252    0.00010008          
168.00000000    176.00000000    3.04761905      2.90909091      8640    0.00008125          
176.00000000    184.00000000    2.90909091      2.78260870      9080    0.00007212          
184.00000000    192.00000000    2.78260870      2.66666667      9428    0.00006643          
192.00000000    200.00000000    2.66666667      2.56000000      9848    0.00006889          
200.00000000    208.00000000    2.56000000      2.46153846      10248   0.00006303          
208.00000000    216.00000000    2.46153846      2.37037037      10628   0.00006123          
216.00000000    224.00000000    2.37037037      2.28571429      11080   0.00005817          
224.00000000    232.00000000    2.28571429      2.20689655      11464   0.00004983          
232.00000000    240.00000000    2.20689655      2.13333333      11868   0.00004563          
240.00000000    248.00000000    2.13333333      2.06451613      12288   0.00004974          
248.00000000    256.00000000    2.06451613      2.00000000      12654   0.00014440          
512 - 64: 0.88300450          
64 - 32:  0.08096362          
32 - 16:  0.02752120          
16 - 8:   0.00493430          
8 - 4:    0.00219123          
4 - 2:    0.00138515          
sharpness = 0.00712553          
072407/processed/im0215.a.fits 2007-07-24           05:21:39.741545           0.00712553     


The plot of log(fft data) x radius shows about 10% of all coefficients, chosen randomly. The peak about 2/3 in is at the 256 waves/frame (2 pixel wavelength) Nyquist limit (edge of FFT) while the remaining points to the right are from the corners and represent aliased values. Note that the points at left fall into the noise at about 64 w/f = 8 pixel wavelength, indicating that the bulk of the FFT for this image is superfluous (i.e. represents spacial waveforms < 8 pixels). This is in part why the sharpness is estimated in the 16-4 wavelength band, at the limit of seeing. Since the platescale for this image was about 0.12 arcsec/pixel, this indicates maximum resolution at a 4 pixel feature size, or about 0.48 arcsec.

13: ~/Projects/Python/AstroPy > sharpness.py 072407/processed im0195.a.fits im0249.a.fits
072407/processed/im0195.a.fits      2007-07-24           05:18:47.828235           0.00738312     
072407/processed/im0215.a.fits      2007-07-24           05:21:39.741545           0.00712553     
072407/processed/im0199.a.fits      2007-07-24           05:19:21.991239           0.00643756     
072407/processed/im0198.a.fits      2007-07-24           05:19:13.462010           0.00593734     
072407/processed/im0200.a.fits      2007-07-24           05:19:30.534879           0.00587662     
072407/processed/im0212.a.fits      2007-07-24           05:21:13.980837           0.00545317     
072407/processed/im0214.a.fits      2007-07-24           05:21:31.198092           0.00535011     
072407/processed/im0201.a.fits      2007-07-24           05:19:39.811627           0.00522172     
072407/processed/im0213.a.fits      2007-07-24           05:21:22.636515           0.00512398     
072407/processed/im0209.a.fits      2007-07-24           05:20:48.091611           0.00507155     
072407/processed/im0210.a.fits      2007-07-24           05:20:56.888271           0.00501898     
072407/processed/im0203.a.fits      2007-07-24           05:19:56.853756           0.00500778     
072407/processed/im0206.a.fits      2007-07-24           05:20:22.487024           0.00488715     
072407/processed/im0211.a.fits      2007-07-24           05:21:05.446535           0.00483341     
072407/processed/im0205.a.fits      2007-07-24           05:20:13.939939           0.00444530     
072407/processed/im0207.a.fits      2007-07-24           05:20:31.220993           0.00444324     
072407/processed/im0202.a.fits      2007-07-24           05:19:48.336848           0.00438618     
072407/processed/im0236.a.fits      2007-07-24           05:24:39.361224           0.00414351     
072407/processed/im0204.a.fits      2007-07-24           05:20:05.403290           0.00410755     
072407/processed/im0237.a.fits      2007-07-24           05:24:47.730065           0.00403508     
072407/processed/im0248.a.fits      2007-07-24           05:26:20.140111           0.00397225     
072407/processed/im0216.a.fits      2007-07-24           05:21:48.256219           0.00382696     
072407/processed/im0249.a.fits      2007-07-24           05:26:28.452767           0.00379972     
072407/processed/im0235.a.fits      2007-07-24           05:24:31.021393           0.00370271     
072407/processed/im0217.a.fits      2007-07-24           05:21:56.811459           0.00368754     
072407/processed/im0208.a.fits      2007-07-24           05:20:39.554903           0.00367443     
072407/processed/im0234.a.fits      2007-07-24           05:24:22.706379           0.00366863     
072407/processed/im0244.a.fits      2007-07-24           05:25:46.369103           0.00357710     
072407/processed/im0218.a.fits      2007-07-24           05:22:05.340763           0.00348124     
072407/processed/im0221.a.fits      2007-07-24           05:22:31.364107           0.00341885     
072407/processed/im0246.a.fits      2007-07-24           05:26:03.336123           0.00331917     
072407/processed/im0240.a.fits      2007-07-24           05:25:12.832088           0.00331560     
072407/processed/im0238.a.fits      2007-07-24           05:24:56.099255           0.00322886     
072407/processed/im0242.a.fits      2007-07-24           05:25:29.473297           0.00318674     
072407/processed/im0243.a.fits      2007-07-24           05:25:38.055761           0.00317211     
072407/processed/im0232.a.fits      2007-07-24           05:24:05.508318           0.00314041     
072407/processed/im0241.a.fits      2007-07-24           05:25:21.152264           0.00308917     
072407/processed/im0247.a.fits      2007-07-24           05:26:11.817130           0.00305547     
072407/processed/im0223.a.fits      2007-07-24           05:22:48.455309           0.00304300     
072407/processed/im0239.a.fits      2007-07-24           05:25:04.443991           0.00303232     
072407/processed/im0230.a.fits      2007-07-24           05:23:48.890655           0.00302305     
072407/processed/im0226.a.fits      2007-07-24           05:23:14.857588           0.00300760     
072407/processed/im0233.a.fits      2007-07-24           05:24:14.101626           0.00290879     
072407/processed/im0222.a.fits      2007-07-24           05:22:40.086394           0.00287185     
072407/processed/im0245.a.fits      2007-07-24           05:25:54.780446           0.00286915     
072407/processed/im0229.a.fits      2007-07-24           05:23:40.320614           0.00282609     
072407/processed/im0220.a.fits      2007-07-24           05:22:22.784924           0.00281968     
072407/processed/im0227.a.fits      2007-07-24           05:23:23.636095           0.00265883     
072407/processed/im0228.a.fits      2007-07-24           05:23:31.980564           0.00264786     
072407/processed/im0224.a.fits      2007-07-24           05:22:57.698819           0.00256280     
072407/processed/im0225.a.fits      2007-07-24           05:23:06.269180           0.00249372     
072407/processed/im0231.a.fits      2007-07-24           05:23:57.198956           0.00241051     
072407/processed/im0219.a.fits      2007-07-24           05:22:14.219079           0.00235148     

The 3 sharpest images in this result are:

The 3 middle-sharp images are:

The 3 blurriest images are:


İSky Coyote 2007