4 struct hept_pref *read_matrix(FILE *IN) {
10 float m_g,sd_g,m_cc,sd_cc,sc;
13 char buff[1000],junk[1000];
19 h = (struct hept_pref*)malloc(sizeof(struct hept_pref));
21 h->m = (float**)malloc(aa_len*sizeof(float*));
22 for(i=0; i<aa_len; ++i) {
23 h->m[i]=(float*)malloc(7*sizeof(float));
28 h->f = (struct fit_dat*)malloc(sizeof(struct fit_dat));
32 while(fgets(buff,999,IN)!=NULL) {
34 if((strncmp(buff,"uw ",3)==0) || (strncmp(buff,"w ",2)==0)) {
36 if(strncmp(buff,"uw ",3)==0) { h->f[i].w=0; }
38 sscanf(buff,"%s %d %f %f %f %f %f",
39 &junk[0],&win,&m_cc,&sd_cc,&m_g,&sd_g,&sc);
41 h->f[i].m_cc = (float)m_cc;
42 h->f[i].sd_cc = (float)sd_cc;
43 h->f[i].m_g = (float)m_g;
44 h->f[i].sd_g = (float)sd_g;
45 h->f[i].sc = (float)sc;
47 h->f = (struct fit_dat*)realloc(h->f,((h->n)+1)*sizeof(struct fit_dat));
49 fprintf(stderr,"Error: too many window parms in matrix file\n");
52 } else if(buff[0]>='A' && buff[0]<='Z') { /* AA data */
53 pt = (int)(buff[0]-'A');
55 sscanf(buff,"%s%f%f%f%f%f%f%f",
57 &hept[0],&hept[1],&hept[2],&hept[3],&hept[4],
60 h->m[pt][i] = (float)hept[i];
62 if(h->m[pt][i]<h->smallest) { h->smallest = h->m[pt][i]; }
64 h->m[pt][i]=-1; /* Don't permit zero values */
67 /* printf("AA %c %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f %4.2f\n",buff[0],
68 h->m[pt][0],h->m[pt][1],h->m[pt][2],h->m[pt][3],h->m[pt][4],
69 h->m[pt][5],h->m[pt][6]);
73 fprintf(stderr,"Warning: multiple entries for AA %c in matrix file\n",buff[0]);
76 fprintf(stderr,"Warning: strange characters in matrix file\n");
77 fprintf(stderr,"Ignoring line: %s",buff);