Diff for /imach/src/imach.c between versions 1.152 and 1.153

version 1.152, 2014/06/18 17:54:09 version 1.153, 2014/06/20 16:45:46
Line 1 Line 1
 /* $Id$  /* $Id$
   $State$    $State$
   $Log$    $Log$
     Revision 1.153  2014/06/20 16:45:46  brouard
     Summary: If 3 live state, convergence to period prevalence on same graph
     Author: Brouard
   
   Revision 1.152  2014/06/18 17:54:09  brouard    Revision 1.152  2014/06/18 17:54:09  brouard
   Summary: open browser, use gnuplot on same dir than imach if not found in the path    Summary: open browser, use gnuplot on same dir than imach if not found in the path
   
Line 3990  void printinggnuplot(char fileres[], cha Line 3994  void printinggnuplot(char fileres[], cha
   strcpy(dirfileres,optionfilefiname);    strcpy(dirfileres,optionfilefiname);
   strcpy(optfileres,"vpl");    strcpy(optfileres,"vpl");
  /* 1eme*/   /* 1eme*/
     fprintf(ficgp,"\n# 1st: Period (stable) prevalence with CI: 'vpl' files\n");
   for (cpt=1; cpt<= nlstate ; cpt ++) {    for (cpt=1; cpt<= nlstate ; cpt ++) {
     for (k1=1; k1<= m ; k1 ++) { /* plot [100000000000000000000:-100000000000000000000] "mysbiaspar/vplrmysbiaspar.txt to check */      for (k1=1; k1<= m ; k1 ++) { /* plot [100000000000000000000:-100000000000000000000] "mysbiaspar/vplrmysbiaspar.txt to check */
      fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"v"),cpt,k1);       fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"v"),cpt,k1);
Line 4017  plot [%.f:%.f] \"%s\" every :::%d::%d u Line 4022  plot [%.f:%.f] \"%s\" every :::%d::%d u
    }     }
   }    }
   /*2 eme*/    /*2 eme*/
       fprintf(ficgp,"\n# 2nd: Total life expectancy with CI: 't' files\n");
   for (k1=1; k1<= m ; k1 ++) {     for (k1=1; k1<= m ; k1 ++) { 
     fprintf(ficgp,"\nset out \"%s%d.png\" \n",subdirf2(optionfilefiname,"e"),k1);      fprintf(ficgp,"\nset out \"%s%d.png\" \n",subdirf2(optionfilefiname,"e"),k1);
     fprintf(ficgp,"set ylabel \"Years\" \nset ter png small size 320, 240\nplot [%.f:%.f] ",ageminpar,fage);      fprintf(ficgp,"set ylabel \"Years\" \nset ter png small size 320, 240\nplot [%.f:%.f] ",ageminpar,fage);
Line 4074  plot [%.f:%.f] \"%s\" every :::%d::%d u Line 4079  plot [%.f:%.f] \"%s\" every :::%d::%d u
   }    }
       
   /* CV preval stable (period) */    /* CV preval stable (period) */
   for (k1=1; k1<= m ; k1 ++) {     for (k1=1; k1<= m ; k1 ++) { /* For each multivariate if any */
     for (cpt=1; cpt<=nlstate ; cpt ++) {      for (cpt=1; cpt<=nlstate ; cpt ++) { /* For each life state */
       k=3;        k=3;
         fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, cov=%d state=%d",k1, cpt);
       fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"p"),cpt,k1);        fprintf(ficgp,"\nset out \"%s%d_%d.png\" \n",subdirf2(optionfilefiname,"p"),cpt,k1);
         l=(nlstate+ndeath)*(cpt-1)+1;
       fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\        fprintf(ficgp,"set xlabel \"Age\" \nset ylabel \"Probability\" \n\
 set ter png small size 320, 240\n\  set ter png small size 320, 240\n\
 unset log y\n\  unset log y\n\
 plot [%.f:%.f] \"%s\" u ($1==%d ? ($3):1/0):($%d/($%d",ageminpar,agemaxpar,subdirf2(fileres,"pij"),k1,k+cpt+1,k+1);  plot [%.f:%.f]  ", ageminpar, agemaxpar);
               for (i=1; i<= nlstate ; i ++){
       for (i=1; i< nlstate ; i ++)          if(i==1)
         fprintf(ficgp,"+$%d",k+i+1);            fprintf(ficgp,"\"%s\"",subdirf2(fileres,"pij"));
       fprintf(ficgp,")) t\"prev(%d,%d)\" w l",cpt,cpt+1);          else
                   fprintf(ficgp,", '' ");
       l=3+(nlstate+ndeath)*cpt;          fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l,k+l);
       fprintf(ficgp,",\"%s\" u ($1==%d ? ($3):1/0):($%d/($%d",subdirf2(fileres,"pij"),k1,l+cpt+1,l+1);          for (j=1; j<= (nlstate-1) ; j ++)
       for (i=1; i< nlstate ; i ++) {            fprintf(ficgp,"+$%d",k+l+j);
         l=3+(nlstate+ndeath)*cpt;          fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt);
         fprintf(ficgp,"+$%d",l+i+1);        } /* nlstate */
       }        fprintf(ficgp,"\n");
       fprintf(ficgp,")) t\"prev(%d,%d)\" w l\n",cpt+1,cpt+1);         } /* end cpt state*/ 
     }     } /* end covariate */  
   }    
       
   /* proba elementaires */    /* proba elementaires */
   for(i=1,jk=1; i <=nlstate; i++){    for(i=1,jk=1; i <=nlstate; i++){
Line 6673  Interval (in months) between two waves: Line 6679  Interval (in months) between two waves:
   printf("Starting graphs with: %s\n",plotcmd);fflush(stdout);    printf("Starting graphs with: %s\n",plotcmd);fflush(stdout);
   
   if((outcmd=system(plotcmd)) != 0){    if((outcmd=system(plotcmd)) != 0){
     printf("\n Problem with gnuplot command %s\n", plotcmd);      printf("\n Problem with gnuplot command %s, err=%d\n", plotcmd, outcmd);
     printf("\n Trying on same directory\n");      printf("\n Trying on same directory\n");
     sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot);      sprintf(plotcmd,"%sgnuplot %s", pathimach, optionfilegnuplot);
     if((outcmd=system(plotcmd)) != 0)      if((outcmd=system(plotcmd)) != 0)
       printf("\n Still a problem with gnuplot command %s\n", plotcmd);        printf("\n Still a problem with gnuplot command %s, err=%d\n", plotcmd, outcmd);
   }    }
   printf(" Wait...");    printf(" Wait...");
   while (z[0] != 'q') {    while (z[0] != 'q') {
Line 6688  Interval (in months) between two waves: Line 6694  Interval (in months) between two waves:
     if (z[0] == 'e') {      if (z[0] == 'e') {
 #ifdef OSX  #ifdef OSX
       sprintf(pplotcmd, "open %s", optionfilehtm);        sprintf(pplotcmd, "open %s", optionfilehtm);
 #elsedef  #else
       sprintf(pplotcmd, "%s", optionfilehtm);        sprintf(pplotcmd, "%s", optionfilehtm);
 #enddef  #endif
       printf("Starting browser with: %s",plotcmd);fflush(stdout);        printf("Starting browser with: %s",pplotcmd);fflush(stdout);
       system(plotcmd);        system(pplotcmd);
     }      }
     else if (z[0] == 'g') system(plotcmd);      else if (z[0] == 'g') system(plotcmd);
     else if (z[0] == 'q') exit(0);      else if (z[0] == 'q') exit(0);

Removed from v.1.152  
changed lines
  Added in v.1.153


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>