Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
289 | f9daq | 1 | void plot(char *fname="photopentode_000") |
2 | { |
||
3 | const int wl_n = 36; |
||
4 | const double wl_min = 3000; |
||
5 | const double wl_max = 6500; |
||
6 | |||
7 | const int nx = 10; |
||
8 | const int ny = 10; |
||
9 | int nrows = (nx+1)*(ny+1); |
||
10 | |||
11 | char sbuff[256]; |
||
12 | sprintf(sbuff, "%s.dat", fname); |
||
13 | FILE *fp=fopen(sbuff,"r"); |
||
14 | if (!fp) { |
||
15 | printf("Error opening input file!\n"); |
||
16 | return -1; |
||
17 | } |
||
18 | |||
19 | int nb; |
||
20 | int hdr[10]; |
||
21 | int hdrp[10]; |
||
22 | float *fhdr=(float *) hdrp; |
||
23 | float sdata[5]; |
||
24 | |||
25 | while(!feof(fp)) { |
||
26 | for(int j=1;j<nrows;j++) { |
||
27 | nb=fread(hdr,sizeof(int),5,fp); |
||
28 | if (nb!=5) break; |
||
29 | printf("[%d] hdr[0]=%u [1]=%u [2]=%u [3]=%u [4]=%u\n",j, hdr[0],hdr[1],hdr[2],hdr[3],hdr[4]); |
||
30 | switch (hdr[0]) { |
||
31 | case 3:{ |
||
32 | nb=fread(hdrp,sizeof(int),5,fp); |
||
33 | //~ printf("x=%u y=%u | i0=%g i1=%g t=%u\n",hdrp[0],hdrp[1],fhdr[2],fhdr[3],hdrp[4]); |
||
34 | //~ hdr[3]=hdrp[0]; |
||
35 | //~ hdr[4]=hdrp[1]; |
||
36 | //~ noise->SetPoint(icount++,hdrp[4],-fhdr[3]); |
||
37 | |||
38 | for (int i=0;i<wl_n;i++) { |
||
39 | nb=fread(sdata,sizeof(float),5,fp); |
||
40 | |||
41 | //~ // j=pointXY, i=wl |
||
42 | //~ sdata[0]=wl[0][i]; |
||
43 | //~ sdata[1]=tok[0][i]; |
||
44 | //~ sdata[2]=tok[j][i]; |
||
45 | //~ sdata[3]=qe[0][i]; |
||
46 | //~ sdata[4]=qe[j][i]; |
||
47 | |||
48 | //~ printf("sdata[0]=%f [1]=%g [2]=%g [3]=%f [4]=%f\n", sdata[0], sdata[1], sdata[2], sdata[3], sdata[4]); |
||
49 | printf(" [%d] sdata[0]=%f [3]=%f [4]=%f\n", i, sdata[0], sdata[3], sdata[4]); |
||
50 | } |
||
51 | } |
||
52 | break; |
||
53 | }//switch (hdr[0]) |
||
54 | }//for(int j=0;j<nrows;j++) |
||
55 | }//while(!feof(fp)) |
||
56 | |||
57 | fclose(fp); |
||
58 | } |