TPCCLIB
Toggle main menu visibility
Loading...
Searching...
No Matches
libtpcisotope
ranoise.c
Go to the documentation of this file.
1
4
/*****************************************************************************/
5
#include "tpcclibConfig.h"
6
/*****************************************************************************/
7
#include <stdio.h>
8
#include <stdlib.h>
9
#include <math.h>
10
#include <time.h>
11
#include <string.h>
12
/*****************************************************************************/
13
#include "
tpcisotope.h
"
14
/*****************************************************************************/
15
16
/*****************************************************************************/
26
double
noiseSD4Frame
(
28
double
y,
30
double
t1,
32
double
dt,
35
int
isotope
,
37
double
a
38
) {
39
/* Frame start time must be >=0 and frame duration must be >0 */
40
if
(isnan(y) || !(t1>=0.0) || !(dt>0.0) || !(a>=0.0))
return
(nan(
""
));
41
/* If concentration is not positive, then its SD is zero */
42
if
(!(y>0.0))
return
(0.0);
43
44
/* Calculate decay factor (<=1) */
45
double
df;
46
if
(
isotope
==
ISOTOPE_UNKNOWN
) {
47
df=1.0;
48
}
else
{
49
df=1.0/
decayCorrectionFactorFromIsotope
(
isotope
, t1, dt);
50
if
(!(df>0.0 && df<=1.0))
return
(nan(
""
));
51
}
52
53
/* Calculate SD */
54
return
(sqrt((a*y)/(dt*df)));
55
}
56
/*****************************************************************************/
57
58
/*****************************************************************************/
decayCorrectionFactorFromIsotope
double decayCorrectionFactorFromIsotope(int isotope, double starttime, double duration)
Definition
decay.c:107
noiseSD4Frame
double noiseSD4Frame(double y, double t1, double dt, int isotope, double a)
Definition
ranoise.c:26
tpcisotope.h
Header file for library libtpcisotope.
isotope
isotope
Definition
tpcisotope.h:50
ISOTOPE_UNKNOWN
@ ISOTOPE_UNKNOWN
Unknown.
Definition
tpcisotope.h:51
Generated on
for TPCCLIB by
1.17.0