11 int *spike_cnt,
float *line_sd,
float pct_noise_thresh,
12 float pct_encrypt_thresh)
50 int irec, ibnd, icode;
53 int16 code_start_syn[8] = {1023, 0, 1023, 0, 1023, 0, 1023, 0}, c_start_syn[8];
54 int16 code_stop_syn[8] = {1023, 1023, 0, 0, 1023, 1023, 0, 0}, c_stop_syn[8];
55 float s_zerop_thresh[8] = {0., 0., 0., 0., 0.0016, 0.008, 0.016, 0.008};
58 int32
start[3], edge[3], encrypt_cnt, ds_noise_cnt, lin_prob_cnt,
59 s_satp_bad, s_zerop_bad, dark_rest_bad, start_syn_bad,
60 stop_syn_bad, sum_spikes;
62 float pct_noise, pct_encrypt;
63 double pct_s_satp = 0., pct_s_zerop = 0., pct_dark_rest = 0.,
64 pct_start_syn = 0., pct_stop_syn = 0.;
70 if ((dtynum ==
IGC) || (dtynum ==
TDI) || (dtynum ==
SOL)) {
71 for (ibnd = 0; ibnd < 7; ibnd++) {
72 c_start_syn[ibnd] = 1023 - code_start_syn[ibnd];
73 c_stop_syn[ibnd] = 1023 - code_stop_syn[ibnd];
76 for (ibnd = 0; ibnd < 7; ibnd++) {
77 c_start_syn[ibnd] = code_start_syn[ibnd];
78 c_stop_syn[ibnd] = code_stop_syn[ibnd];
85 if ((s_satp = (
int16 *) malloc(8 * nscans *
sizeof (
int16)))
87 printf(
"\n*****rpt_noise: program error, unable to allocate s_satp space\n");
91 if ((s_zerop = (
int16 *) malloc(8 * nscans *
sizeof (
int16)))
93 printf(
"\n*****rpt_noise: program error, unable to allocate s_zerop space\n");
99 printf(
"\n*****rpt_noise: program error, unable to allocate dark_rest space\n");
103 if ((start_syn = (
int16 *) malloc(8 * nscans *
sizeof (
int16)))
105 printf(
"\n*****rpt_noise: program error, unable to allocate start_syn space\n");
109 if ((stop_syn = (
int16 *) malloc(8 * nscans *
sizeof (
int16)))
111 printf(
"\n*****rpt_noise: program error, unable to allocate stop_syn space\n");
119 if ((
msec = (int32 *) malloc(nscans *
sizeof ( int32)))
121 printf(
"\n*****rpt_noise: program error, unable to allocate msec space\n");
134 if (
rdslice(sdfid,
"s_satp",
start, edge, (
void *) s_satp) < 0) {
136 printf(
"\n*****rpt_noise: program error, unable to read s_satp\n");
140 if (
rdslice(sdfid,
"s_zerop",
start, edge, (
void *) s_zerop) < 0) {
142 printf(
"\n*****rpt_noise: program error, unable to read s_zerop\n");
148 printf(
"\n*****rpt_noise: program error, unable to read dark_rest\n");
152 if (
rdslice(sdfid,
"start_syn",
start, edge, (
void *) start_syn) < 0) {
154 printf(
"\n*****rpt_noise: program error, unable to read start_syn\n");
158 if (
rdslice(sdfid,
"stop_syn",
start, edge, (
void *) stop_syn) < 0) {
160 printf(
"\n*****rpt_noise: program error, unable to read stop_syn\n");
169 printf(
"\n*****rpt_noise: program error, unable to read stop_syn\n");
184 printf(
"\n\nLine-by-line report of noise and noise type found\n");
185 printf(
"line # bands # bands # bands w # bad strt # bad stop std dev # spikes msec line\n");
186 printf(
" # saturated zero high dark sync wds/7 sync wds/7 band 1 all bnds tag type\n");
187 printf(
"---- --------- ------- --------- ---------- ---------- ------- -------- -------- ----\n");
193 for (irec = 0; irec < nscans; irec++) {
208 for (ibnd = 0; ibnd < 8; ibnd++) {
209 if (*(s_satp + ibnd + 8 * irec) != 0) {
213 if ((
float) *(s_zerop + ibnd + 8 * irec) / nsamp
214 > *(s_zerop_thresh + ibnd)) {
218 if (*(
dark_rest + ibnd + 8 * irec) > 30) {
223 if (*(start_syn + ibnd + 8 * irec) != *(c_start_syn + ibnd)) {
227 if (*(stop_syn + ibnd + 8 * irec) != *(c_stop_syn + ibnd)) {
232 sum_spikes += *(spike_cnt + ibnd + 8 * irec);
236 printf(
"%4d%10d%9d%11d%12d%12d%9.2f%10d%9d", irec, s_satp_bad,
237 s_zerop_bad, dark_rest_bad, start_syn_bad, stop_syn_bad,
238 *(line_sd + 8 * irec), sum_spikes, *(
msec + irec));
244 if (*(line_sd + 8 * irec) > 220.) {
246 printf(
" **** Encrypted line\n");
250 }
else if (lin_prob_cnt > 0) {
252 printf(
" ** Noisey line\n");
257 printf(
" Good line\n");
265 if (s_satp_bad > 0) pct_s_satp++;
266 if (s_zerop_bad > 0) pct_s_zerop++;
267 if (dark_rest_bad > 0) pct_dark_rest++;
268 if (start_syn_bad > 0) pct_start_syn++;
269 if (stop_syn_bad > 0) pct_stop_syn++;
276 printf(
"\n\n#Noise report summary\n\n");
277 printf(
"# --- Percentage bad lines ---\n");
278 printf(
"# bands bands bands w bad strt bad stop \n");
279 printf(
"# saturated zero high dark sync wds/7 sync wds/7 \n");
280 printf(
"# --------- ------- --------- ---------- ---------- \n");
281 printf(
"# %10.2f%9.2f%11.2f%12.2f%12.2f\n\n",
282 (100. * pct_s_satp / nscans), (100. * pct_s_zerop / nscans),
283 (100. * pct_dark_rest / nscans), (100. * pct_start_syn / nscans),
284 (100. * pct_stop_syn / nscans));
286 printf(
"\n\n#total # lines: %9d # with noise: %9d # encrypted: %d\n",
287 nscans, ds_noise_cnt, encrypt_cnt);
288 pct_noise = 100. * (
float) ds_noise_cnt / nscans;
289 pct_encrypt = 100. * (
float) encrypt_cnt / nscans;
291 (
" %9.2f %% %9.2f %%\n\n\n",
292 pct_noise, pct_encrypt);
296 printf(
"\n\n#Mnemonic Code %% lines %% threshold\n");
297 printf(
" -------- ---- ------- -----------\n");
298 if ((dtynum ==
GAC) || (dtynum ==
LAC) || (dtynum ==
HRPT)) {
300 if (pct_encrypt > pct_encrypt_thresh) {
301 printf(
"#*** dataset failed due to > %7.2f %% encryption noise\n",
305 sprintf(
str,
"ENCRYPT ");
309 printf(
"ENCRYPT %2d %7.2f %7.2f\n", icode, pct_encrypt,
312 if (pct_noise > pct_noise_thresh) {
313 printf(
"#*** dataset failed due to > %7.2f %% general noise\n",
317 sprintf(
str,
"NOISE ");
321 printf(
"NOISE %2d %7.2f %7.2f\n\n", icode,
322 pct_noise, pct_noise_thresh);
324 printf(
"ENCRYPT N/A %7.2f %7.2f\n", pct_encrypt,
326 printf(
"NOISE N/A %7.2f %7.2f\n\n",
327 pct_noise, pct_noise_thresh);
332 printf(
"\n\n#1 line version for auto-identification\n");
333 printf(
"\n#Mnemonic Code noise encrypt sat zero dark start stop\n");
334 printf(
"#----------------------------------------------------------------------------\n");
335 if ((dtynum ==
GAC) || (dtynum ==
LAC) || (dtynum ==
HRPT)) {
336 printf(
"L1NOISE %2d%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f\n",
337 icode, pct_noise, pct_encrypt, (100. * pct_s_satp / nscans),
338 (100. * pct_s_zerop / nscans), (100. * pct_dark_rest / nscans),
339 (100. * pct_start_syn / nscans), (100. * pct_stop_syn / nscans));
341 printf(
"L1NOISE N/A%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f%7.2f\n",
342 pct_noise, pct_encrypt, (100. * pct_s_satp / nscans),
343 (100. * pct_s_zerop / nscans), (100. * pct_dark_rest / nscans),
344 (100. * pct_start_syn / nscans), (100. * pct_stop_syn / nscans));