Difference: Photometry2016_Simulation (1 vs. 7)

Revision 719 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 68 to 68
 
  • Test 2: 100x100 pixels, A=65535 (pixel value range for camera), 10 stars
  • PoissonSimTest2.png
  • Larger pixel value range results in less obvious variations - almost indistinguishable from earlier gaussian simulation.
Added:
>
>

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)):
 \begin{equation} f\left ( x,y\right )= \frac{1}{\pi \sigma _{x} \sigma _{y} \sqrt{1-\rho ^{2}}} \exp {\left [ - \frac{1}{2\left ( 1-\rho ^{2} \right )}\left ( \left (\frac{ x-x_0 }{2{\sigma _{x}}^{2}} \right )^2 + \left (\frac{ y-y_0 }{2{\sigma _{y}}^{2}}\right )^2 -2\rho \left (\frac{ x-x_0 }{2{\sigma _{x}}^{2}} \right )\left (\frac{ y-y_0 }{2{\sigma _{y}}^{2}}\right ) \right )\right ]}  \end{equation}
  • (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)
  • SkewTest2.png
  • (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

META FILEATTACHMENT attachment="PositionSimTest2.png" attr="" comment="random position test (100x100, 50 stars)" date="1476004481" name="PositionSimTest2.png" path="PositionSimTest2.png" size="19417" user="zyva010" version="1"
Line: 83 to 101
 
META FILEATTACHMENT attachment="PoissonExample1.png" attr="" comment="Example of poisson distributed pixel values on a 16x1 pixel grid" date="1476354830" name="PoissonExample1.png" path="PoissonExample1.png" size="51505" user="zyva010" version="1"
META FILEATTACHMENT attachment="PoissonSimTest1.png" attr="" comment="Poisson simulation test 1: 100x100 pixels, A=100, 10 stars" date="1476446063" name="PoissonSimTest1.png" path="Y:\PH4100\Images_s\PoissonSimTest1.png" size="40318" user="zyva010" version="1"
META FILEATTACHMENT attachment="PoissonSimTest2.png" attr="" comment="Poisson simulation test 2: 100x100 pixels, A=65535, 10 stars" date="1476446081" name="PoissonSimTest2.png" path="Y:\PH4100\Images_s\PoissonSimTest2.png" size="30068" user="zyva010" version="1"
Added:
>
>
META FILEATTACHMENT attachment="Simulation_test5.py.txt" attr="" comment="simulation test 5" date="1476906045" name="Simulation_test5.py.txt" path="Simulation_test5.py" size="7782" user="zyva010" version="1"
META FILEATTACHMENT attachment="SkewTest2.png" attr="" comment="Testing x and y correlation (P) for P=0, P=0.5, P=0.999" date="1476906074" name="SkewTest2.png" path="SkewTest2.png" size="19013" user="zyva010" version="1"
META FILEATTACHMENT attachment="latex5f9f5400b35695f2f95ae5e6adc621f5.png" attr="h" comment="" date="1476906342" name="latex5f9f5400b35695f2f95ae5e6adc621f5.png" user="zyva010" version="1"

Revision 614 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 55 to 55
 
  • 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
Changed:
<
<
  • 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 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):
  • PoissonExample1.png
Changed:
<
<
>
>
  • Test 1: 100x100 pixels, A=100, 10 stars
  • PoissonSimTest1.png
  • 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
  • PoissonSimTest2.png
  • Larger pixel value range results in less obvious variations - almost indistinguishable from earlier gaussian simulation.
 -- AaronAndrews - 09 Oct 2016

META FILEATTACHMENT attachment="PositionSimTest2.png" attr="" comment="random position test (100x100, 50 stars)" date="1476004481" name="PositionSimTest2.png" path="PositionSimTest2.png" size="19417" user="zyva010" version="1"
Line: 75 to 79
 
META FILEATTACHMENT attachment="Simulation_test3.py.txt" attr="" comment="Simulation test program 3 - implemented integration" date="1476222934" name="Simulation_test3.py.txt" path="Simulation_test3.py" size="4782" user="zyva010" version="1"
META FILEATTACHMENT attachment="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" attr="h" comment="" date="1476280055" name="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" user="zyva010" version="1"
META FILEATTACHMENT attachment="latex73933a957c41a4144be44ced293ef1e4.png" attr="h" comment="" date="1476280056" name="latex73933a957c41a4144be44ced293ef1e4.png" user="zyva010" version="1"
Changed:
<
<
META FILEATTACHMENT attachment="Simulation_test4.py.txt" attr="" comment="Simulation test 4 - added poisson variations" date="1476354741" name="Simulation_test4.py.txt" path="Simulation_test4.py" size="5615" user="zyva010" version="1"
>
>
META FILEATTACHMENT attachment="Simulation_test4.py.txt" attr="" comment="Simulation test 4 - added poisson variations" date="1476445990" name="Simulation_test4.py.txt" path="Y:\PH4100\Simulation\Simulation_test4.py" size="5613" user="zyva010" version="2"
 
META FILEATTACHMENT attachment="PoissonExample1.png" attr="" comment="Example of poisson distributed pixel values on a 16x1 pixel grid" date="1476354830" name="PoissonExample1.png" path="PoissonExample1.png" size="51505" user="zyva010" version="1"
Added:
>
>
META FILEATTACHMENT attachment="PoissonSimTest1.png" attr="" comment="Poisson simulation test 1: 100x100 pixels, A=100, 10 stars" date="1476446063" name="PoissonSimTest1.png" path="Y:\PH4100\Images_s\PoissonSimTest1.png" size="40318" user="zyva010" version="1"
META FILEATTACHMENT attachment="PoissonSimTest2.png" attr="" comment="Poisson simulation test 2: 100x100 pixels, A=65535, 10 stars" date="1476446081" name="PoissonSimTest2.png" path="Y:\PH4100\Images_s\PoissonSimTest2.png" size="30068" user="zyva010" version="1"

Revision 513 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 53 to 53
 
  • 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.
Added:
>
>
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):
  • PoissonExample1.png
 -- AaronAndrews - 09 Oct 2016

META FILEATTACHMENT attachment="PositionSimTest2.png" attr="" comment="random position test (100x100, 50 stars)" date="1476004481" name="PositionSimTest2.png" path="PositionSimTest2.png" size="19417" user="zyva010" version="1"

Revision 413 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 64 to 64
 
META FILEATTACHMENT attachment="Simulation_test3.py.txt" attr="" comment="Simulation test program 3 - implemented integration" date="1476222934" name="Simulation_test3.py.txt" path="Simulation_test3.py" size="4782" user="zyva010" version="1"
META FILEATTACHMENT attachment="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" attr="h" comment="" date="1476280055" name="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" user="zyva010" version="1"
META FILEATTACHMENT attachment="latex73933a957c41a4144be44ced293ef1e4.png" attr="h" comment="" date="1476280056" name="latex73933a957c41a4144be44ced293ef1e4.png" user="zyva010" version="1"
Added:
>
>
META FILEATTACHMENT attachment="Simulation_test4.py.txt" attr="" comment="Simulation test 4 - added poisson variations" date="1476354741" name="Simulation_test4.py.txt" path="Simulation_test4.py" size="5615" user="zyva010" version="1"
META FILEATTACHMENT attachment="PoissonExample1.png" attr="" comment="Example of poisson distributed pixel values on a 16x1 pixel grid" date="1476354830" name="PoissonExample1.png" path="PoissonExample1.png" size="51505" user="zyva010" version="1"

Revision 312 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 12 to 12
 
  • PositionSimTest2.png
Improvement - Gaussian star profiles (05/10/2016): Simulation_test2.py.txt
  • Generated stars now have 2d gaussian profiles:
Changed:
<
<
%BEGINLATEX%
\begin{equation}

f\left ( x,y;\sigma _{x},\sigma _{y} \right )=A e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}

>
>
%BEGINLATEX% \begin{equation} f\left ( x,y;\sigma _{x},\sigma _{y} \right )=A e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}
  \end{equation}
Deleted:
<
<
 %ENDLATEX%

  • Maximum grey values (gaussian peak values, 'A' in above equation) are randomized - can result in star not appearing in output.
Line: 46 to 43
 
  • 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):
Changed:
<
<
%BEGINLATEX%
\begin{equation}

N=A \int_{x_{p}-\frac{1}{2}}^{x_{p}+\frac{1}{2}} e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} dx \int_{y_{p}-\frac{1}{2}}^{y_{p}+\frac{1}{2}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}dy

>
>
%BEGINLATEX% \begin{equation} N=A \int_{x_{p}-\frac{1}{2}}^{x_{p}+\frac{1}{2}} e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} dx \int_{y_{p}-\frac{1}{2}}^{y_{p}+\frac{1}{2}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}dy
  \end{equation}
Deleted:
<
<
 %ENDLATEX%

  • 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):
Line: 56 to 50
 
  • 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):
  • ValueComparison1.png
Changed:
<
<
  • Important things to note: near the peak, measured values from integration is less than value of gaussian.
>
>
  • 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.
Deleted:
<
<
 -- AaronAndrews - 09 Oct 2016

META FILEATTACHMENT attachment="PositionSimTest2.png" attr="" comment="random position test (100x100, 50 stars)" date="1476004481" name="PositionSimTest2.png" path="PositionSimTest2.png" size="19417" user="zyva010" version="1"
Line: 68 to 62
 
META FILEATTACHMENT attachment="Simulation_test2.py.txt" attr="" comment="simulation test program 2" date="1476004570" name="Simulation_test2.py.txt" path="Simulation_test2.py" size="2440" user="zyva010" version="1"
META FILEATTACHMENT attachment="ValueComparison1.png" attr="" comment="Demonstration of integrated pixel values for an 8x1 pixel grid with 1 star at x=3.75" date="1476222419" name="ValueComparison1.png" path="ValueComparison1.png" size="52054" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test3.py.txt" attr="" comment="Simulation test program 3 - implemented integration" date="1476222934" name="Simulation_test3.py.txt" path="Simulation_test3.py" size="4782" user="zyva010" version="1"
Added:
>
>
META FILEATTACHMENT attachment="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" attr="h" comment="" date="1476280055" name="latexc1c95c11b2b3f32a7f6946bc30b25bae.png" user="zyva010" version="1"
META FILEATTACHMENT attachment="latex73933a957c41a4144be44ced293ef1e4.png" attr="h" comment="" date="1476280056" name="latex73933a957c41a4144be44ced293ef1e4.png" user="zyva010" version="1"

Revision 211 Oct 2016 - AaronAndrews

Line: 1 to 1
 
META TOPICPARENT name="StewartBoogertPhotometry2016"

Part One

Line: 11 to 11
 
  • Example output: (100x100 pixel canvas, 50 stars)
  • PositionSimTest2.png
Improvement - Gaussian star profiles (05/10/2016): Simulation_test2.py.txt
Changed:
<
<
  • Generated stars now have 2d gaussian profiles.
  • Maximum grey values (gaussian peak values) are randomized - can result in star not appearing in output.
>
>
  • Generated stars now have 2d gaussian profiles:
</div> <div id=&amp;quot;_mcePaste&amp;quot;>\begin{equation}</div>  f\left ( x,y;\sigma _{x},\sigma _{y} \right )=A e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}  \end{equation}

  • Maximum grey values (gaussian peak values, 'A' in above equation) are randomized - can result in star not appearing in output.
    Latex rendering error!! dvi file was not created.
 
  • Example output: (100x100 pixel canvas, 0-100 grey value range, 10 stars)
  • GaussianSimTest1.png
  • Example 2: (1530x1020 pixels, 0-65535 grey value range, 50 stars) (Same size of images taken by telescope system)
Line: 35 to 42
 
  • 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.
Added:
>
>
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):
</div> <div id=&amp;quot;_mcePaste&amp;quot;>\begin{equation}</div>  N=A \int_{x_{p}-\frac{1}{2}}^{x_{p}+\frac{1}{2}} e^{-\frac{\left ( x-x_0 \right )^2}{2{\sigma _{x}}^{2}}} dx \int_{y_{p}-\frac{1}{2}}^{y_{p}+\frac{1}{2}} e^{-\frac{\left ( y-y_0 \right )^2}{2{\sigma _{y}}^{2}}}dy  \end{equation}

  • 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):
  • ValueComparison1.png
  • Important things to note: 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.
    Latex rendering error!! dvi file was not created.
  -- AaronAndrews - 09 Oct 2016
Line: 43 to 66
 
META FILEATTACHMENT attachment="GaussianSimTest2.png" attr="" comment="gaussian profile test 2 (1530x1020, 50 stars)" date="1476004540" name="GaussianSimTest2.png" path="GaussianSimTest2.png" size="39743" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test1.py.txt" attr="" comment="simulation test program 1" date="1476004559" name="Simulation_test1.py.txt" path="Simulation_test1.py" size="1507" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test2.py.txt" attr="" comment="simulation test program 2" date="1476004570" name="Simulation_test2.py.txt" path="Simulation_test2.py" size="2440" user="zyva010" version="1"
Added:
>
>
META FILEATTACHMENT attachment="ValueComparison1.png" attr="" comment="Demonstration of integrated pixel values for an 8x1 pixel grid with 1 star at x=3.75" date="1476222419" name="ValueComparison1.png" path="ValueComparison1.png" size="52054" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test3.py.txt" attr="" comment="Simulation test program 3 - implemented integration" date="1476222934" name="Simulation_test3.py.txt" path="Simulation_test3.py" size="4782" user="zyva010" version="1"

Revision 109 Oct 2016 - AaronAndrews

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="StewartBoogertPhotometry2016"

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)
  • PositionSimTest2.png
Improvement - Gaussian star profiles (05/10/2016): Simulation_test2.py.txt
  • Generated stars now have 2d gaussian profiles.
  • Maximum grey values (gaussian peak values) are randomized - can result in star not appearing in output.
  • Example output: (100x100 pixel canvas, 0-100 grey value range, 10 stars)
  • GaussianSimTest1.png
  • Example 2: (1530x1020 pixels, 0-65535 grey value range, 50 stars) (Same size of images taken by telescope system)
  • GaussianSimTest2.png
Notes on running Python programs/functions:
  1. Change working directory
  2. 'import [filename]' (without '.py')
  3. '[filename].[functionname](variables)'
If file is already imported, replace 'import' with 'reload' to load any changes.

To show an image produced by a function:

  1. 'a=[filename][functionname](variables)'
  2. '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.

-- AaronAndrews - 09 Oct 2016

META FILEATTACHMENT attachment="PositionSimTest2.png" attr="" comment="random position test (100x100, 50 stars)" date="1476004481" name="PositionSimTest2.png" path="PositionSimTest2.png" size="19417" user="zyva010" version="1"
META FILEATTACHMENT attachment="GaussianSimTest1.png" attr="" comment="gaussian profile test 1 (100x100, 10 stars)" date="1476004512" name="GaussianSimTest1.png" path="GaussianSimTest1.png" size="27953" user="zyva010" version="1"
META FILEATTACHMENT attachment="GaussianSimTest2.png" attr="" comment="gaussian profile test 2 (1530x1020, 50 stars)" date="1476004540" name="GaussianSimTest2.png" path="GaussianSimTest2.png" size="39743" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test1.py.txt" attr="" comment="simulation test program 1" date="1476004559" name="Simulation_test1.py.txt" path="Simulation_test1.py" size="1507" user="zyva010" version="1"
META FILEATTACHMENT attachment="Simulation_test2.py.txt" attr="" comment="simulation test program 2" date="1476004570" name="Simulation_test2.py.txt" path="Simulation_test2.py" size="2440" user="zyva010" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 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