version 1.153, 2014/06/20 16:45:46
|
version 1.156, 2014/08/25 20:10:10
|
Line 1
|
Line 1
|
/* $Id$ |
/* $Id$ |
$State$ |
$State$ |
$Log$ |
$Log$ |
|
Revision 1.156 2014/08/25 20:10:10 brouard |
|
*** empty log message *** |
|
|
|
Revision 1.155 2014/08/25 18:32:34 brouard |
|
Summary: New compile, minor changes |
|
Author: Brouard |
|
|
|
Revision 1.154 2014/06/20 17:32:08 brouard |
|
Summary: Outputs now all graphs of convergence to period prevalence |
|
|
Revision 1.153 2014/06/20 16:45:46 brouard |
Revision 1.153 2014/06/20 16:45:46 brouard |
Summary: If 3 live state, convergence to period prevalence on same graph |
Summary: If 3 live state, convergence to period prevalence on same graph |
Author: Brouard |
Author: Brouard |
Line 513 extern int errno;
|
Line 523 extern int errno;
|
/* $Id$ */ |
/* $Id$ */ |
/* $State$ */ |
/* $State$ */ |
|
|
char version[]="Imach version 0.98nT, January 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)"; |
char version[]="Imach version 0.98nV, August 2014,INED-EUROREVES-Institut de longevite-Japan Society for the Promotion of Science (Grant-in-Aid for Scientific Research 25293121)"; |
char fullversion[]="$Revision$ $Date$"; |
char fullversion[]="$Revision$ $Date$"; |
char strstart[80]; |
char strstart[80]; |
char optionfilext[10], optionfilefiname[FILENAMELENGTH]; |
char optionfilext[10], optionfilefiname[FILENAMELENGTH]; |
Line 3892 fprintf(fichtm," \n<ul><li><b>Graphs</b>
|
Line 3902 fprintf(fichtm," \n<ul><li><b>Graphs</b>
|
before but expressed in per year i.e. quasi incidences if stepm is small and probabilities too: <a href=\"%s%d_2.png\">%s%d_2.png</a><br> \ |
before but expressed in per year i.e. quasi incidences if stepm is small and probabilities too: <a href=\"%s%d_2.png\">%s%d_2.png</a><br> \ |
<img src=\"%s%d_2.png\">",stepm,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1); |
<img src=\"%s%d_2.png\">",stepm,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1,subdirf2(optionfilefiname,"pe"),jj1); |
/* Period (stable) prevalence in each health state */ |
/* Period (stable) prevalence in each health state */ |
for(cpt=1; cpt<nlstate;cpt++){ |
for(cpt=1; cpt<=nlstate;cpt++){ |
fprintf(fichtm,"<br>- Period (stable) prevalence in each health state : <a href=\"%s%d_%d.png\">%s%d_%d.png</a><br> \ |
fprintf(fichtm,"<br>- Convergence from each state (1 to %d) to period (stable) prevalence in state %d <a href=\"%s%d_%d.png\">%s%d_%d.png</a><br> \ |
<img src=\"%s%d_%d.png\">",subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1); |
<img src=\"%s%d_%d.png\">",nlstate, cpt, subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1,subdirf2(optionfilefiname,"p"),cpt,jj1); |
} |
} |
for(cpt=1; cpt<=nlstate;cpt++) { |
for(cpt=1; cpt<=nlstate;cpt++) { |
fprintf(fichtm,"\n<br>- Life expectancy by health state (%d) at initial age and its decomposition into health expectancies : <a href=\"%s%d%d.png\">%s%d%d.png</a> <br> \ |
fprintf(fichtm,"\n<br>- Life expectancy by health state (%d) at initial age and its decomposition into health expectancies in each alive state (1 to %d) : <a href=\"%s%d%d.png\">%s%d%d.png</a> <br> \ |
<img src=\"%s%d%d.png\">",cpt,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1); |
<img src=\"%s%d%d.png\">",cpt,nlstate,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1,subdirf2(optionfilefiname,"exp"),cpt,jj1); |
} |
} |
} /* end i1 */ |
} /* end i1 */ |
}/* End k1 */ |
}/* End k1 */ |
Line 4084 plot [%.f:%.f] \"%s\" every :::%d::%d u
|
Line 4094 plot [%.f:%.f] \"%s\" every :::%d::%d u
|
k=3; |
k=3; |
fprintf(ficgp,"\n#\n#\n#CV preval stable (period): 'pij' files, cov=%d state=%d",k1, cpt); |
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\ |
Line 4094 plot [%.f:%.f] ", ageminpar, agemaxpar)
|
Line 4103 plot [%.f:%.f] ", ageminpar, agemaxpar)
|
fprintf(ficgp,"\"%s\"",subdirf2(fileres,"pij")); |
fprintf(ficgp,"\"%s\"",subdirf2(fileres,"pij")); |
else |
else |
fprintf(ficgp,", '' "); |
fprintf(ficgp,", '' "); |
fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l,k+l); |
l=(nlstate+ndeath)*(i-1)+1; |
|
fprintf(ficgp," u ($1==%d ? ($3):1/0):($%d/($%d",k1,k+l+(cpt-1),k+l); |
for (j=1; j<= (nlstate-1) ; j ++) |
for (j=1; j<= (nlstate-1) ; j ++) |
fprintf(ficgp,"+$%d",k+l+j); |
fprintf(ficgp,"+$%d",k+l+j); |
fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt); |
fprintf(ficgp,")) t \"prev(%d,%d)\" w l",i,cpt); |
Line 5172 calandcheckages(int imx, int maxwav, dou
|
Line 5182 calandcheckages(int imx, int maxwav, dou
|
} |
} |
else if(agev[m][i] >*agemax){ |
else if(agev[m][i] >*agemax){ |
*agemax=agev[m][i]; |
*agemax=agev[m][i]; |
printf(" Max anint[%d][%d]=%.0f annais[%d]=%.0f, agemax=%.2f\n",m,i,anint[m][i], i,annais[i], *agemax); |
/* printf(" Max anint[%d][%d]=%.0f annais[%d]=%.0f, agemax=%.2f\n",m,i,anint[m][i], i,annais[i], *agemax);*/ |
} |
} |
/*agev[m][i]=anint[m][i]-annais[i];*/ |
/*agev[m][i]=anint[m][i]-annais[i];*/ |
/* agev[m][i] = age[i]+2*m;*/ |
/* agev[m][i] = age[i]+2*m;*/ |
Line 5334 int main(int argc, char *argv[])
|
Line 5344 int main(int argc, char *argv[])
|
i=strlen(pathr); |
i=strlen(pathr); |
if(pathr[i-1]=='\n') |
if(pathr[i-1]=='\n') |
pathr[i-1]='\0'; |
pathr[i-1]='\0'; |
|
i=strlen(pathr); |
|
if(pathr[i-1]==' ') /* This may happen when dragging on oS/X! */ |
|
pathr[i-1]='\0'; |
for (tok = pathr; tok != NULL; ){ |
for (tok = pathr; tok != NULL; ){ |
printf("Pathr |%s|\n",pathr); |
printf("Pathr |%s|\n",pathr); |
while ((val = strsep(&tok, "\"" )) != NULL && *val == '\0'); |
while ((val = strsep(&tok, "\"" )) != NULL && *val == '\0'); |
Line 5389 int main(int argc, char *argv[])
|
Line 5402 int main(int argc, char *argv[])
|
path=%s \n\ |
path=%s \n\ |
optionfile=%s\n\ |
optionfile=%s\n\ |
optionfilext=%s\n\ |
optionfilext=%s\n\ |
optionfilefiname=%s\n",pathimach,pathtot,path,optionfile,optionfilext,optionfilefiname); |
optionfilefiname='%s'\n",pathimach,pathtot,path,optionfile,optionfilext,optionfilefiname); |
|
|
printf("Local time (at start):%s",strstart); |
printf("Local time (at start):%s",strstart); |
fprintf(ficlog,"Local time (at start): %s",strstart); |
fprintf(ficlog,"Local time (at start): %s",strstart); |
Line 5405 int main(int argc, char *argv[])
|
Line 5418 int main(int argc, char *argv[])
|
/*---------arguments file --------*/ |
/*---------arguments file --------*/ |
|
|
if((ficpar=fopen(optionfile,"r"))==NULL) { |
if((ficpar=fopen(optionfile,"r"))==NULL) { |
printf("Problem with optionfile %s with errno=%s\n",optionfile,strerror(errno)); |
printf("Problem with optionfile '%s' with errno='%s'\n",optionfile,strerror(errno)); |
fprintf(ficlog,"Problem with optionfile %s with errno=%s\n",optionfile,strerror(errno)); |
fprintf(ficlog,"Problem with optionfile '%s' with errno='%s'\n",optionfile,strerror(errno)); |
fflush(ficlog); |
fflush(ficlog); |
/* goto end; */ |
/* goto end; */ |
exit(70); |
exit(70); |
Line 6660 Interval (in months) between two waves:
|
Line 6673 Interval (in months) between two waves:
|
sprintf(plotcmd,"\"%sgnuplot.exe\"",pathimach); |
sprintf(plotcmd,"\"%sgnuplot.exe\"",pathimach); |
#endif |
#endif |
if(!stat(plotcmd,&info)){ |
if(!stat(plotcmd,&info)){ |
printf("Error gnuplot program not found: %s\n",plotcmd);fflush(stdout); |
printf("Error or gnuplot program not found: %s\n",plotcmd);fflush(stdout); |
if(!stat(getenv("GNUPLOTBIN"),&info)){ |
if(!stat(getenv("GNUPLOTBIN"),&info)){ |
printf("Error gnuplot program not found: %s Environment GNUPLOTBIN not set.\n",plotcmd);fflush(stdout); |
printf("Error or gnuplot program not found: %s Environment GNUPLOTBIN not set.\n",plotcmd);fflush(stdout); |
}else |
}else |
strcpy(pplotcmd,plotcmd); |
strcpy(pplotcmd,plotcmd); |
#ifdef UNIX |
#ifdef UNIX |
Line 6679 Interval (in months) between two waves:
|
Line 6692 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, err=%d\n", plotcmd, outcmd); |
printf("gnuplot command might not be in your path: %s, err=%d\n", plotcmd, outcmd); |
printf("\n Trying on same directory\n"); |
printf("\n Trying if gnuplot resides on the same directory that IMaCh\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, err=%d\n", plotcmd, outcmd); |
printf("\n Still a problem with gnuplot command %s, err=%d\n", plotcmd, outcmd); |
} |
} |
printf(" Wait..."); |
printf(" Successul, please wait..."); |
while (z[0] != 'q') { |
while (z[0] != 'q') { |
/* chdir(path); */ |
/* chdir(path); */ |
printf("\nType e to edit output files, g to graph again and q for exiting: "); |
printf("\nType e to edit results with your browser, g to graph again and q for exit: "); |
scanf("%s",z); |
scanf("%s",z); |
/* if (z[0] == 'c') system("./imach"); */ |
/* if (z[0] == 'c') system("./imach"); */ |
if (z[0] == 'e') { |
if (z[0] == 'e') { |