Part One
Aim: Generate stars with gaussian profiles, using random positions and fluxes.
'Basic' simulation program (04/10/2016):
Simulation_test1.py.txt
- Simulation generates stars with random positions.
- Canvas size and no. of stars are variable.
- No gaussian profile for stars or grey values (pixel value is either 0 or 1).
- Example output: (100x100 pixel canvas, 50 stars)
-
Improvement - Gaussian star profiles (05/10/2016):
Simulation_test2.py.txt
- Generated stars now have 2d gaussian profiles:
- Maximum grey values (gaussian peak values, 'A' in above equation) are randomized - can result in star not appearing in output.
- Example output: (100x100 pixel canvas, 0-100 grey value range, 10 stars)
-
- Example 2: (1530x1020 pixels, 0-65535 grey value range, 50 stars) (Same size of images taken by telescope system)
-
Notes on running Python programs/functions:
- Change working directory
- 'import [filename]' (without '.py')
- '[filename].[functionname](variables)'
If file is already imported, replace 'import' with 'reload' to load any changes.
To show an image produced by a function:
- 'a=[filename][functionname](variables)'
- 'imshow(a, cmap='Grey_r)' (use 'imshow(a)' for colourmap image instead of greyscale image)
Discussion of work so far:
20161007 meeting
Part Two
Aims:
- For each pixel, determine mean value via integration of gaussian function over pixel area.
- Use mean value to gain Poisson distributed value for each cell.
Pixel Integration (11/10/16):
Simulation_test3.py.txt
- Integration must be done via numerical method - multiple methods available within python (e.g 'scipy.integrate.quad()'). No indefinite integral exists for the gaussian function.
- x and y components of gaussian can be integrated seperately. Limits of integration are +/- 0.5 of pixel position (midpoint):
- To demonstrate the importance of integrating to gain the pixel value instead of inputting the pixel coordinates to the gaussian, I have created the following plot simulating an 8x1 pixel grid with a star at x=3.75 (A=100, Sigma=1):
-
- Important things to note: This is a projection for the 2d gaussian at y=0 (green line shows the 'maximum' profile on the x axis). Bin values are calculated using integration over both x and y axis, resulting in decreased bin heights, particularly near the peak.
- Near the peak, measured values from integration is less than value of gaussian.
- Position of integrated peak bin offset from actual gaussian peak position - could estimate position using relative heights of adjacent bins.
Poisson Distribution of pixel values:
Simulation_test4.py.txt
- Each pixel value consists of a summation of n random variables (e.g. y=x1+...+xn). Each random variable corresponds to the contribution of a particular star (out of n stars in the image).
- Each random variable follows a Poisson distribution, with a mean value (E[x]) equal to the integrated value of a star's gaussian profile over the pixel area.
- We can assume that these random variables are not correlated (correlation coefficient P=0), therefore the total mean value will be the sum of individual mean values (E[y]=E[x1]+...+E[xn]).
- We can also assume that the summed pixel values (from star contributions only) also follow a Poisson distribution.
- Therefore, we can simulate te 'counting' of photons in each pixel by using the total intgrated pixel value as the mean to gain a random poisson distributed value.
- Example: projection (y=0) of a 16x1 pixel grid with a star generated at x=7.75 (A=100, sigma=2):
-
- Test 1: 100x100 pixels, A=100, 10 stars
-
- Small pixel value range results in very obvious variations in signal data.
- Test 2: 100x100 pixels, A=65535 (pixel value range for camera), 10 stars
-
- Larger pixel value range results in less obvious variations - almost indistinguishable from earlier gaussian simulation.
Part Three
Aims:
- Implement correlated 2d gaussian function
- Implement way to save simulated star fields as FITS files
Corelated gaussian (18/10/16):
Simulation_test5.py.txt
- Implemented a true 2D Gaussian with correlation between x and y (with correlation coefficient P (rho)):
- (Note: normalisation factor is ignored so far for programming purposes; maximum pixel value is being used in its place)
- Integration of 2D Gaussian in this form is done numerically.
- Tested for P =0, P =0.5, P =0.999 (sigma_x=sigma_y=3 in each case)
-
- (Note - image is rotated 90 degrees clockwise)
- Also - found a way to save images as FITS files, similar to images gained from observations.
--
AaronAndrews - 09 Oct 2016