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)

- 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)

- Change working directory
- 'import [filename]' (without '.py')
- '[filename].[functionname](variables)'

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)

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.

- 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.

- 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.

Aims:

- Implement correlated 2d gaussian function
- Implement way to save simulated star fields as FITS files

- 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.

I | Attachment | History | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|---|

png | GaussianSimTest1.png | r1 | manage | 27.3 K | 09 Oct 2016 - 10:15 | AaronAndrews | gaussian profile test 1 (100x100, 10 stars) |

png | GaussianSimTest2.png | r1 | manage | 38.8 K | 09 Oct 2016 - 10:15 | AaronAndrews | gaussian profile test 2 (1530x1020, 50 stars) |

png | PoissonExample1.png | r1 | manage | 50.3 K | 13 Oct 2016 - 11:33 | AaronAndrews | Example of poisson distributed pixel values on a 16x1 pixel grid |

png | PoissonSimTest1.png | r1 | manage | 39.4 K | 14 Oct 2016 - 12:54 | AaronAndrews | Poisson simulation test 1: 100x100 pixels, A=100, 10 stars |

png | PoissonSimTest2.png | r1 | manage | 29.4 K | 14 Oct 2016 - 12:54 | AaronAndrews | Poisson simulation test 2: 100x100 pixels, A=65535, 10 stars |

png | PositionSimTest2.png | r1 | manage | 19.0 K | 09 Oct 2016 - 10:14 | AaronAndrews | random position test (100x100, 50 stars) |

txt | Simulation_test1.py.txt | r1 | manage | 1.5 K | 09 Oct 2016 - 10:15 | AaronAndrews | simulation test program 1 |

txt | Simulation_test2.py.txt | r1 | manage | 2.4 K | 09 Oct 2016 - 10:16 | AaronAndrews | simulation test program 2 |

txt | Simulation_test3.py.txt | r1 | manage | 4.7 K | 11 Oct 2016 - 22:55 | AaronAndrews | Simulation test program 3 - implemented integration |

txt | Simulation_test4.py.txt | r2 r1 | manage | 5.5 K | 14 Oct 2016 - 12:53 | AaronAndrews | Simulation test 4 - added poisson variations |

txt | Simulation_test5.py.txt | r1 | manage | 7.6 K | 19 Oct 2016 - 20:40 | AaronAndrews | simulation test 5 |

png | SkewTest2.png | r1 | manage | 18.6 K | 19 Oct 2016 - 20:41 | AaronAndrews | Testing x and y correlation (P) for P=0, P=0.5, P=0.999 |

png | ValueComparison1.png | r1 | manage | 50.8 K | 11 Oct 2016 - 22:46 | AaronAndrews | Demonstration of integrated pixel values for an 8x1 pixel grid with 1 star at x=3.75 |

Physics Webpages
•
RHUL Webpages
•
Campus Connect
•
Royal Holloway, University of London, Egham, Surrey TW20 0EX; Tel/Fax +44 (0)1784 434455/437520

Topic revision: r7 - 19 Oct 2016 - AaronAndrews

Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback

Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback