47 nr_int32_t boundary = 1 << 30;
48 nr_int32_t current = 1;
49 if (x >= boundary)
return boundary;
50 while (current < x) current <<= 1;
56 nr_double_t
emi::f_ideal (nr_double_t fc, nr_double_t bw, nr_double_t f) {
57 nr_double_t lo = fc - bw / 2;
58 nr_double_t hi = fc + bw / 2;
59 if (f >= lo && f < hi)
68 nr_double_t q = fc / bw;
76 nr_double_t
emi::f_gauss (nr_double_t fc, nr_double_t bw, nr_double_t f) {
77 nr_double_t a =
log (0.5) / bw / bw;
78 nr_double_t
s = f - fc;
79 return exp (a * s * s);
99 for (i = 2; i < points; i++) {
100 ida[
i] /= points / 2;
104 fres = 1.0 / duration;
107 nr_double_t * d = ida;
108 for (n = 0, i = 0; i < points / 2; i++, n += 2){
110 d[
i] =
xhypot (ida[n], ida[n + 1]);
118 { 200, 150e3, 200, 200 },
119 { 150e3, 30e6, 9e3, 9e3 },
120 { 30e6, 1e9, 120e3, 120e3 },
125 nr_double_t noise =
pow (10.0, (-100.0 / 40.0)) * 1
e-6;
128 nr_double_t fcur, dcur;
132 for (i = 0; settings[
i].
bandwidth != 0; i++ ) {
135 nr_double_t fstart = settings[
i].
start;
136 nr_double_t fstop = settings[
i].
stop;
137 nr_double_t fstep = settings[
i].
stepsize;
140 for (fcur = fstart; fcur <= fstop; fcur += fstep) {
143 nr_double_t lo = fcur - bw / 2;
144 nr_double_t hi = fcur + bw / 2;
145 if (hi < fres)
continue;
148 int il =
floor (lo / fres);
149 int ir =
floor (hi / fres);
153 if (ir >= 0 && il < points - 1) {
156 if (ir > points - 1) ir = points - 1;
160 for (
int j = 0; j < ir - il; j++){
161 nr_double_t f = fres * (il + j);
166 dcur += noise *
sqrt (bw);
187 if (len < da->getSize ()) len = da->
getSize ();
192 nr_double_t tstart =
real (dt->
get (0));
193 nr_double_t tstop =
real (dt->
get (olen - 1));
194 nr_double_t duration = tstop - tstart;
205 nr_double_t * ida =
new nr_double_t[2 * nlen];
206 nr_double_t tstep = duration / (nlen - 1);
207 for (i = 0; i < nlen; i++) {
208 nr_double_t
t = i * tstep + tstart;