gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 954df59 4/4: Instrumental noise in MakeNoise i


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 954df59 4/4: Instrumental noise in MakeNoise is now squared
Date: Wed, 21 Mar 2018 15:11:49 -0400 (EDT)

branch: master
commit 954df5986f3ccb0c3eede02c36355d391792f293
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Instrumental noise in MakeNoise is now squared
    
    When generating random numbers in MakeNoise, we were not taking the
    instrumental noise to the power of two. This is now corrected.
    
    This fixes bug #53407.
---
 NEWS                  |  1 +
 bin/mknoise/mknoise.c |  5 +++--
 doc/gnuastro.texi     | 12 ++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/NEWS b/NEWS
index 4e4509b..2cfe321 100644
--- a/NEWS
+++ b/NEWS
@@ -85,6 +85,7 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   bug #53295: MakeCatalog parses area larger than clump.
   bug #53304: NoiseChisel crash when there is no detection.
   bug #53312: Fits crash on keyword editing (except --delete).
+  bug #53407: Instrumental noise in MakeNoise should be squared.
 
 
 
diff --git a/bin/mknoise/mknoise.c b/bin/mknoise/mknoise.c
index 95f0a0b..4c1058a 100644
--- a/bin/mknoise/mknoise.c
+++ b/bin/mknoise/mknoise.c
@@ -107,7 +107,8 @@ convertsaveoutput(struct mknoiseparams *p)
 void
 mknoise(struct mknoiseparams *p)
 {
-  double *d, *df, background=p->background, instrumental=p->instrumental;
+  double *d, *df, background=p->background;
+  double instpowtwo = p->instrumental*p->instrumental;
 
   /* Add the noise: */
   df=(d=p->input->array)+p->input->size;
@@ -122,7 +123,7 @@ mknoise(struct mknoiseparams *p)
       do
         *d += ( background
                 + gsl_ran_gaussian(p->rng,
-                                   sqrt( instrumental + background + *d )) );
+                                   sqrt( instpowtwo + background + *d )) );
       while(++d<df);
     }
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 6ad7f7e..d674010 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -17491,12 +17491,12 @@ distribution with
 @cindex ADU
 @cindex Gain
 @cindex Counts
-This type of noise is completely independent of the type of objects
-being studied, it is completely determined by the instrument. So the
-flux scale (and not magnitude scale) is most commonly used for this
-type of noise. In practice, this value is usually reported in ADUs not
-flux or electron counts. The gain value of the device can be used to
-convert between these two, see @ref{Flux Brightness and magnitude}.
+This type of noise is independent of the signal in the dataset, it is only
+determined by the instrument. So the flux scale (and not magnitude scale)
+is most commonly used for this type of noise. In practice, this value is
+usually reported in ADUs not flux or electron counts. The gain value of the
+device can be used to convert between these two, see @ref{Flux Brightness
+and magnitude}.
 
 @node Final noised pixel value, Generating random numbers, Instrumental noise, 
Noise basics
 @subsubsection Final noised pixel value



reply via email to

[Prev in Thread] Current Thread [Next in Thread]