## Point Spread Function Estimation of Solar Surface Images with a Cooperative Particle Swarm Optimization on GPUs

**Author: **Peter Frank Perroni

**Supervisor: **Daniel Weingaertner

### Abstract

We present a method for estimating the point spread function (PSF) of solar surface images acquired from ground telescopes and degraded by atmosphere. The estimation is done by retrieving the wavefront phase using a set of short exposures, the speckle reconstruction of the observed object and a PSF model parametrized by Zernike polynomials. Estimates of the wavefront phase and PSF are computed by minimizing an error function with a cooperative particle swarm optimization method, implemented in OpenCL to take advantage of highly parallel GPUs. A calibration method is presented to adjust the algorithm parameters for low cost results, providing solid estimations for either low frequency and high frequency images. Results show that the method has a fast convergence and is robust to noise degradation. Experiments run on a NVidia Tesla C2050 were able to compute 100 PSFs with 50 Zernike polynomials in ~36 minutes. The algorithm is also not affected by the number of Zernikes used, i.e., execution time increased only 17% when the number of Zernike coeffcients increased tenfold, from 50 to 500.

### Dissertation

The complete dissertation is available for download.

### Source Code

This method was implemented in C++ with OpenCL and OpenMP.

The source code can be downloaded here.

Before compiling the source code:

- Download this Makefile and adjust the following parameters:
- CFITSIO_HOME: The home path of CFITSIO.
- VIENNACL_HOME: The home path of ViennaCL.
- CUDA_HOME: The home path of CUDA (used by NVIDIA graphical cards). In the case the GPU is not CUDA, this parameter can point to the GPU include home path.
- CUDA_SDK: The home path of CUDA SDK (used by NVIDIA graphical cards). In the case the GPU is not CUDA, this parameter must be adjusted accordingly.

- Open the source file kippe.cpp and adjust the parameters wavelength, image scale and telescope diameter, according to the physical specifications of the telescope.

### Code Documentation

The complete code documentation can be browsed here.

It is also available for download here.

### Usage Instructions

POINT SPREAD FUNCTION ESTIMATION OF SOLAR SURFACE IMAGES WITH A COOPERATIVE PARTICLE SWARM OPTIMIZATION ON GPUS Usage: kippe [-h] | [-testgpu] | [-listgpu] | [-rms_contrast -obj <image> -isz <image_width>] | [-sum -obj <image> -isz <image_width>] | [-obj <object> -isz <image_width> -fsz <fft_width> -z <num_zernikes> [[-img <image> -out <output_path> -s <num_swarms> -p <num_particles> -c <num_cycles> -w <w_val> -c1 <c1_val> -c2 <c2_val> -reset <reset_factor>] | [-validation -nval <num_validations> -ranksz <rank_size> {-noise <noise-level>}] | [-gen_imgs <num_artificial_images>]] {-r <coef_range>} {-fixedrand} {-statistics} {-devices <device_id_to_use>} {-parallel <n_threads>}] where: -h This help message. -testgpu Test all GPUs available. -listgpu Get the list of device ids available on the system. -sum Sum a 3D FITS file and generate a 2D FITS file as output. -rms_contrast Calculate the image intensity. -obj The path to the FITS file containing the Object. -img The path to either a FITS file containing a 2D/3D Image or the path to a folder containing multiple 2D Image files. -out The output folder where the data will be saved. -isz The widh of the input image. -fsz The width of the FFT to be calculated. -z The number of Zernikes to be calculated. -r The range for the Zernike coefficients. If not provided, the value 2 will be used. -s The number of swarms to be created. -p The number of particles to be used on every swarm. -c The number of cycles to run the CPSO. -w The Inertia weight W. -c1 The Acceleration coefficient C1 (cognitive). -c2 The Acceleration coefficient C2 (social). -reset The factor for re-initialization of inactive particles [0-1]. -validation If provided, the tool will run on Validation mode. -nval The number of validations to be executed. -ranksz The rank size to store the best and worst values. -noise The Poisson noise level to be added to the artificial image: 0 (default), 1, .. 700. -gen_imgs If provided, the tool will run on Generation Images mode. Specify the number of artificial images to be generated in the 3D output FITS file. -fixedrand If provided, the Random Number Generator seed will be fixed at program startup. -statistics If provided, the statistics will be printed on standard output. -devices The list of device ids (separated by comma and no space) that should be used. To get the list of device ids, run the program with the option -listgpu. -parallel Define the number of threads to be used. For basic image processing, it is also the number of CPSO's to be executed in parallel. The default is 1 thread.

### Results

The images obtained by this method can be found here.