11
int read_header(FILE *ifp, FILE *ofp, double *min_f, double *max_f,
12
double *step_f, double *f, double *angular_step)
14
int elements, driven, parasitic;
16
fread((char *) &elements, sizeof(elements), 1, ifp);
17
fread((char *) &driven, sizeof(driven), 1, ifp);
18
fread((char *) ¶sitic, sizeof(parasitic), 1, ifp);
19
fread((char *) min_f, sizeof(*min_f), 1, ifp);
20
fread((char *) max_f,sizeof(*max_f), 1, ifp);
21
fread((char *) f, sizeof(*f), 1, ifp);
22
fread((char *) step_f, sizeof(*step_f), 1, ifp);
23
fread((char *) angular_step, sizeof(*angular_step), 1, ifp);
24
fseek(ifp, HEADER_SIZE, SEEK_SET); /* skip rest of header */
25
/* now we make some basic checks on the header, to see nothing is too
27
if( (*max_f < *min_f) || *angular_step==0 || driven+parasitic != elements || (*step_f > *max_f))
29
fprintf(stderr,"Error in input file\n");
30
fprintf(stderr,"driven=%d parasitic=%d elements=%d\n",driven,parasitic,elements);
31
fprintf(stderr,"min_f=%f max_f=%f step_f=%f\n",*min_f, *max_f, *step_f);
32
fprintf(stderr,"angular_step=%f \n", *angular_step);
35
fprintf(ofp,"# Driven=%d parasitic=%d total-elements=%d design=%.3fMHz\n", driven, parasitic, elements, *f/1e6);
36
fprintf(ofp,"# Checked from %.3fMHz to %.3fMHz.\n", *min_f/1e6, *max_f/1e6);
41
fprintf(stderr,"Errno =%d in read_hea.c\n", errno);