45 if(verbose>0) printf(
"noiseSD4Simulation(%g, %g, %g, %g, %g, *sd, ...)\n",
47 if(status!=NULL) strcpy(status,
"invalid data");
48 if(sd==NULL)
return 1;
56 if(status!=NULL) strcpy(status,
"invalid half-life");
57 lambda=
hl2lambda(hl);
if(lambda<0.0)
return 4;
65 if(status!=NULL) strcpy(status,
"ok");
101 double hl=0.0, t1, deltat;
105 if(verbose>0) printf(
"noiseSD4SimulationFromDFT(DFT, %d, %g, sd[], ...)\n",
107 if(status!=NULL) strcpy(status,
"invalid data");
108 if(dft==NULL || sd==NULL)
return 1;
110 if(dft->
voiNr>1 && index>=dft->
voiNr)
return 3;
113 if(status!=NULL) strcpy(status,
"invalid frame times");
114 for(fi=0; fi<dft->
frameNr; fi++)
115 if(dft->
x2[fi]<=dft->
x1[fi] || dft->
x1[fi]<0.0)
return 4;
116 if(status!=NULL) strcpy(status,
"missing time unit");
124 if(status!=NULL) strcpy(status,
"missing isotope halflife");
125 if(hl<=0.0)
return 6;
127 if(verbose>1) printf(
"halflife := %g\n", hl);
133 }
else if(index>=0) {
138 if(status!=NULL) strcpy(status,
"cannot calculate mean TAC");
147 for(fi=0; fi<dft->
frameNr; fi++) {
148 t1=dft->
x1[fi]; deltat=dft->
x2[fi]-dft->
x1[fi];
149 if(dft->
timeunit==TUNIT_SEC) {t1/=60.0; deltat/=60.0;}
156 sprintf(status,
"cannot calculate SD for noise simulation (%d)", ret);
160 if(status!=NULL) strcpy(status,
"ok");
int dftMeanTAC(DFT *dft, DFT *mean)
double hl2lambda(double halflife)
double hlLambda2factor(double lambda, double frametime, double framedur)
double hlFromIsotope(char *isocode)
#define DFT_DECAY_UNKNOWN
#define DFT_DECAY_CORRECTED
int mean(double *x, double *y, int nr, double *xmean, double *xsd, double *ymean, double *ysd)
Header file for libtpcmodext.
int noiseSD4Simulation(double y, double t1, double dt, double hl, double a, double *sd, char *status, int verbose)
int noiseSD4SimulationFromDFT(DFT *dft, int index, double pc, double *sd, char *status, int verbose)