|
|
| version 1.296, 2019/05/20 13:03:18 | version 1.297, 2019/05/22 17:56:10 |
|---|---|
| Line 1 | Line 1 |
| /* $Id$ | /* $Id$ |
| $State$ | $State$ |
| $Log$ | $Log$ |
| Revision 1.297 2019/05/22 17:56:10 brouard | |
| Summary: Fix bug by moving date2dmy and nhstepm which gaefin=-1 | |
| Revision 1.296 2019/05/20 13:03:18 brouard | Revision 1.296 2019/05/20 13:03:18 brouard |
| Summary: Projection syntax simplified | Summary: Projection syntax simplified |
| Line 3046 double **pmij(double **ps, double *cov, | Line 3049 double **pmij(double **ps, double *cov, |
| sumnew=0.; | sumnew=0.; |
| /*for (ii=1;ii<=nlstate+ndeath;ii++){*/ | /*for (ii=1;ii<=nlstate+ndeath;ii++){*/ |
| for (ii=1;ii<=nlstate;ii++){ /* Only on live states */ | for (ii=1;ii<=nlstate;ii++){ /* Only on live states */ |
| /* printf(" agefin=%d, ii=%d, ij=%d, prev=%f\n",(int)agefin,ii, ij, prevacurrent[(int)agefin][ii][ij]); */ | /* printf(" agefin=%d, ii=%d, ij=%d, prev=%f\n",(int)agefin,ii, ij, prevacurrent[(int)agefin][ii][ij]); */ |
| sumnew+=prevacurrent[(int)agefin][ii][ij]; | sumnew+=prevacurrent[(int)agefin][ii][ij]; |
| } | } |
| if(sumnew >0.01){ /* At least some value in the prevalence */ | if(sumnew >0.01){ /* At least some value in the prevalence */ |
| Line 4421 void pstamp(FILE *fichier) | Line 4424 void pstamp(FILE *fichier) |
| fprintf(fichier,"# %s.%s\n#IMaCh version %s, %s\n#%s\n# %s", optionfilefiname,optionfilext,version,copyright, fullversion, strstart); | fprintf(fichier,"# %s.%s\n#IMaCh version %s, %s\n#%s\n# %s", optionfilefiname,optionfilext,version,copyright, fullversion, strstart); |
| } | } |
| void date2dmy(double date,double *day, double *month, double *year){ | |
| double yp=0., yp1=0., yp2=0.; | |
| yp1=modf(date,&yp);/* extracts integral of date in yp and | |
| fractional in yp1 */ | |
| *year=yp; | |
| yp2=modf((yp1*12),&yp); | |
| *month=yp; | |
| yp1=modf((yp2*30.5),&yp); | |
| *day=yp; | |
| if(*day==0) *day=1; | |
| if(*month==0) *month=1; | |
| } | |
| /************ Frequencies ********************/ | /************ Frequencies ********************/ |
| Line 8321 set ter svg size 640, 480\nunset log y\n | Line 8338 set ter svg size 640, 480\nunset log y\n |
| }/* End movingaverage */ | }/* End movingaverage */ |
| int date2dmy(double date,double *day, double *month, double *year){ | |
| double yp=0., yp1=0., yp2=0.; | |
| yp1=modf(date,&yp);/* extracts integral of date in yp and | |
| fractional in yp1 */ | |
| *year=yp; | |
| yp2=modf((yp1*12),&yp); | |
| *month=yp; | |
| yp1=modf((yp2*30.5),&yp); | |
| *day=yp; | |
| if(*day==0) *day=1; | |
| if(*month==0) *month=1; | |
| return; | |
| } | |
| /************** Forecasting ******************/ | /************** Forecasting ******************/ |
| /* void prevforecast(char fileres[], double dateintmean, double anprojd, double mprojd, double jprojd, double ageminpar, double agemax, double dateprev1, double dateprev2, int mobilav, double ***prev, double bage, double fage, int firstpass, int lastpass, double anprojf, double p[], int cptcoveff)*/ | /* void prevforecast(char fileres[], double dateintmean, double anprojd, double mprojd, double jprojd, double ageminpar, double agemax, double dateprev1, double dateprev2, int mobilav, double ***prev, double bage, double fage, int firstpass, int lastpass, double anprojf, double p[], int cptcoveff)*/ |
| Line 10748 int hPijx(double *p, int bage, int fage) | Line 10751 int hPijx(double *p, int bage, int fage) |
| /* for (agedeb=fage; agedeb>=bage; agedeb--){ /\* If stepm=6 months *\/ */ | /* for (agedeb=fage; agedeb>=bage; agedeb--){ /\* If stepm=6 months *\/ */ |
| for (agedeb=bage; agedeb<=fage; agedeb++){ /* If stepm=6 months and estepm=24 (2 years) */ | for (agedeb=bage; agedeb<=fage; agedeb++){ /* If stepm=6 months and estepm=24 (2 years) */ |
| /* nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /\* Typically 20 years = 20*12/6=40 *\/ */ | /* nhstepm=(int) rint((agelim-agedeb)*YEARM/stepm); /\* Typically 20 years = 20*12/6=40 *\/ */ |
| nhstepm=(int) rint((agedeb-ageminl)*YEARM/stepm); /* Typically 20 years = 20*12/6=40 */ | nhstepm=(int) rint((agedeb-ageminl)*YEARM/stepm+0.1)-1; /* Typically 20 years = 20*12/6=40 or 55*12/24=27.5-1.1=>27 */ |
| nhstepm = nhstepm/hstepm; /* Typically 40/4=10, because estepm=24 stepm=6 => hstepm=24/6=4 */ | nhstepm = nhstepm/hstepm; /* Typically 40/4=10, because estepm=24 stepm=6 => hstepm=24/6=4 or 28*/ |
| /* nhstepm=nhstepm*YEARM; aff par mois*/ | /* nhstepm=nhstepm*YEARM; aff par mois*/ |