# Flowchart of the pipeline of key processes for modeling wavefront distortion of astronomical objects: ground-based observation case

Being inspired by this article, as well as some promising, but unfortunately not supported by references, results of “simulation” of various distorting defects (fuzzy blob, slow-motion, blurred, speckle, multi-speckle, scintillation) of the wavefronts of astronomical objects, I immediately threw myself into the beautiful ocean of searching for the information I needed. Unfortunately, apparently I confused the beautiful ocean with a dark abyss, which turned out to be too deep and uninhabited where I was looking. I am returning from my first search voyage for information almost empty-handed:

What little I was able to find does not completely satisfy me, but contains some clues that I decided to show to experienced specialists in the hope that they will help structure the information found and tell me where else to get building materials for the future building (by building materials I mean , which you could try with your own hands in MATLAB).

My question: Turbulent processes in the Earth's atmosphere turbulently distort the amplitude and phase of the incoming wave front, as a result of which we get different patterns of distorting defects. But how does one or another mathematical model include the ability to simulate various distorting effects? In my mind, this may resemble a kind of construction set, from the details of which an astronomer can assemble his own numerical experimental platform, for example, “Object: star. Effect: twinkling. Diffraction: Fraunhofer” or “Object: star cluster. Effect: speckle. Diffraction: Fresnel” . Something like this... Algorithms and formulas are welcome!

Examples from Wiki:

"Simulated negative image showing what a single (point-like) star would look like through a ground-based telescope with a diameter of 2r0. The blurred look of the image is because of diffraction, which causes the appearance of the star to be an Airy pattern with a central disk surrounded by hints of faint rings. The atmosphere would make the image move around very rapidly, so that in a long-exposure photograph it would appear more blurred."

"Simulated negative image showing what a single (point-like) star would look like through a ground-based telescope with a diameter of 7r0, on the same angular scale as the 2r0 image above. The atmosphere makes the image break up into several blobs (speckles). The speckles move around very rapidly, so that in a long-exposure photograph the star would appear as a single blurred blob."

"Simulated negative image showing what a single (point-like) star would look like through a ground-based telescope with a diameter of 20r0. The atmosphere causes further atomization of the image into many blobs (speckles). As above, the speckles move around very rapidly, so that in a long-exposure photograph the star would appear as a single blurred blob."

The first formula from the article Vítek, S. Modeling of Astronomical Images gives an idea of ​​how the distortion of astronomical images is modeled. This is a sequential chain of transformations (matrix product or convolution), each stage introduces its own distortion. We can then construct a correlated random field using filtering of the uncorrelated random field (Fourier or Gaussian filter). Here is the code in Matlab and results. https://ieeexplore.ieee.org/document/8126645 https://ieeexplore.ieee.org/document/9252580

Of course, distortion is not implemented entirely correctly. This is simply a sequential multiplication of different masks by the original image. In addition, as can be seen from the results, one or another defect (fuzzy blob or speckle) depends on the size of the correlation lengths in the statistics of atmospheric turbulence. And it’s not a fact that these statistics are Gaussian. I don't know. Perhaps the statistics are different, and the general approach is to use special correlation functions. If someone decides to mention other formulas and algorithms, you are welcome! Write your answers and comments.

N = 500; %number of surface points
rL = 10; %length of surface
h = 1; %rms height
cl = 0.5; %correlation length

x = linspace(-rL/2,rL/2,N); %surface points on x-axis
y = linspace(-rL/2,rL/2,N); %surface points on y-axis
[X,Y] = meshgrid(x,y); %XY meshgrid

Z = h.*randn(N,N); % uncorrelated Gaussian random rough surface distribution with mean 0 and standard deviation h
% Gaussian filter
F = exp(-(X.^2+Y.^2)/(cl^2/2));

% correlation of surface using convolution (faltung), inverse Fourier transform and normalizing prefactors
f = sqrt(2/sqrt(pi))*sqrt(rL/N/cl)*ifft2(fft2(Z).*fft2(F)); %surface heights
f = f./max(max(f)); %Additional Field Normalization
norm_data_f = (f - min(min(f))) / ( max(max(f)) - min(min(f)) );%Additional Field Normalization

%Wavefront model. Simple monochromatic wave
A = 1; %Amplitude
W = A*exp(-(X.^2+Y.^2)/(2*a));
Intensity = abs(W).^2;

%Resulting wavefront
ResW = Intensity.*norm_data_f;

%Aperture mask. A circular surface is selected as the aperture.
apx = linspace(-rL/2,rL/2,N); %aperture points on x-axis
apy = linspace(-rL/2,rL/2,N); %aperture points on y-axis
[apX,apY] = meshgrid(apx,apy); %aperture XY meshgrid

for i = 1:N
for j = 1:N
if sqrt(apX(i,j).^2+apY(i,j).^2)>R
else
end
end
end

subplot(2,2,1)
surf(X,Y,norm_data_f,'edgecolor','none')
view ([0 0 90])
colorbar
title('Atmosphere with distortion')
xlabel('X')
ylabel('Y')
axis square

subplot(2,2,2)
surf(X,Y,Intensity,'edgecolor','none')
view ([0 0 90])
colorbar
title('Intensity')
xlabel('X')
ylabel('Y')
axis square

subplot(2,2,3)
view ([0 0 90])
colorbar