From 6d0057c9964251e562d05f74f8ebf82b75b2fbe2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E4=B9=85=E6=B0=B8=E6=B5=A9=E5=8F=B8?= Date: Mon, 9 Jan 2017 15:26:55 +0900 Subject: [PATCH] modified ctfDeterminationBybayes --- .DS_Store | Bin 10244 -> 10244 bytes include/ctffuncforbayes.h | 4 +- include/eosBayes.h | 27 ++- src/.DS_Store | Bin 8196 -> 8196 bytes src/Objects/.DS_Store | Bin 10244 -> 6148 bytes src/Objects/DataExpress/.DS_Store | Bin 6148 -> 0 bytes src/Objects/DataManip/.DS_Store | Bin 10244 -> 0 bytes src/Objects/DataManip/ctfInfo/src/.DS_Store | Bin 10244 -> 0 bytes src/Objects/DataManip/ctfInfo/src/ctfforbayes.c | 7 +- .../DataManip/ctfInfo/src/ctfforbayescheck.c | 5 +- .../DataManip/ctfInfo/src/ctffuncforbayes.h | 4 +- .../DataManip/ctfInfo/src/defocuslikelihood.c | 16 +- src/Objects/DataManip/mrcImage/.DS_Store | Bin 10244 -> 0 bytes src/Objects/DataManip/mrcImage/src/.DS_Store | Bin 40964 -> 0 bytes src/Objects/DataManip/transform/.DS_Store | Bin 8196 -> 0 bytes src/Objects/General/eosBayes/inc/eosBayes.h | 27 ++- .../General/eosBayes/src/eosBayesCondition.c | 146 ++++++++++++---- .../eosBayes/src/eosBayesDistributionInit.c | 5 +- .../eosBayesDistributionInitialProbabilitySet.c | 58 ++++++ .../General/eosBayes/src/eosBayesEstimation.c | 18 +- .../eosBayes/src/eosBayesParameterOfMaxPosterior.c | 36 ++-- src/Objects/General/eosBayes/src/eosBayesRead.c | 55 +++--- src/Objects/General/eosBayes/src/eosBayesWrite.c | 194 +++++++++++---------- src/Objects/General/eosBayes/src/eosBayesflag.c | 28 +++ src/Objects/General/eosBayes/src/eosBayesflag.c~ | 14 ++ src/Tools/Config/Define.inc | 3 + .../Config/OptionControlFile | 3 +- .../inc/ctfDeterminationByBayes.h | 11 +- .../src/#ctfDeterminationByBayes.cls# | 0 .../ctfInfo/ctfDeterminationByBayes/src/argCheck.c | 33 ++-- .../src/ctfDeterminationByBayes.c | 191 ++++++++++++++++---- .../src/ctfDeterminationByBayes.html | 3 +- .../src/ctfDeterminationByBayes.pane | 19 +- .../ctfInfo/ctfDeterminationByBayes/src/init.c | 24 +-- .../ctfInfo/ctfDeterminationByBayes/src/usage.c | 3 +- 35 files changed, 637 insertions(+), 297 deletions(-) delete mode 100644 src/Objects/DataExpress/.DS_Store delete mode 100644 src/Objects/DataManip/.DS_Store delete mode 100644 src/Objects/DataManip/ctfInfo/src/.DS_Store delete mode 100644 src/Objects/DataManip/mrcImage/.DS_Store delete mode 100644 src/Objects/DataManip/mrcImage/src/.DS_Store delete mode 100644 src/Objects/DataManip/transform/.DS_Store create mode 100644 src/Objects/General/eosBayes/src/eosBayesflag.c create mode 100644 src/Objects/General/eosBayes/src/eosBayesflag.c~ create mode 100755 src/Tools/ctfInfo/ctfDeterminationByBayes/src/#ctfDeterminationByBayes.cls# diff --git a/.DS_Store b/.DS_Store index 8fd4edae4739d4431438ba629a4d3318e232d105..8083a088391d90356a67b1cfdec85bd602369d49 100644 GIT binary patch delta 214 zcmZn(XbG6$&nU4mU^hRb#AY6W*IeqH489DB4A~5+3~3CR3^_o$&NC-JIVmSUiGhJZ zfPsNA2#6~tzmckEES{VreL}?C+*C)w*vPn6N1@u>+(1Xc#Kdy4hfMk8JwlS45t+&P zdBK@gsgoZHoso!6FUm{_E=Wwy%u83c{{S=)2$UTHCLa=ZvT`tl@I&(Q^HMoEl^whx zdVZKNQ-<8IcJT2+piZoqS(bl#z4tUs;<31}F&0%g;;YRCWk} z@Rc3Bp%NSn+6;~i!3;4Bg$xZ0(-{^sY-KpeaE{?I!&ip?jJ%9uj7p5!j5>^_jCPC; kjGl}^jM0oKjH!(2j0KFPjAffA%9SxrY%to)uJD%~08BVE(*OVf diff --git a/include/ctffuncforbayes.h b/include/ctffuncforbayes.h index f5dbb986ee..4510a48373 100644 --- a/include/ctffuncforbayes.h +++ b/include/ctffuncforbayes.h @@ -67,7 +67,7 @@ typedef enum defocuslikelihoodMode{ typedef struct defocuslikelihoodforbayes{ float** x; - float* width; + double* width; xoflikelihoodforbayesMode mode0; widthoflikelihoodforbayesMode mode1; @@ -101,7 +101,7 @@ extern void ctfforbayesFree(ctfforbayes* ctf, intensityforbayes* intensity, defo /*defocuslikelihood.c*/ -extern void defocusLikelihoodInit(defocuslikelihoodforbayes* l, eosBayes d, int mode); +extern void defocusLikelihoodInit(defocuslikelihoodforbayes* l, eosBayes* d, int mode); extern void ctfforbayesXofLikelihoodCalculation(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int* L, int count, int mode); extern void defocusLikelihood(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayes* d, int count, int mode); extern void ctfforBayesDifferenceCalculation(defocuslikelihoodforbayes* l, ctfforbayes* ctf, eosBayesDistribution* d, int numLikelihood, int* L, int count, int mode); diff --git a/include/eosBayes.h b/include/eosBayes.h index 97d16f584a..c190db7c0b 100644 --- a/include/eosBayes.h +++ b/include/eosBayes.h @@ -2,6 +2,12 @@ #define EOS_BAYES_H +typedef enum eosBayesDistributionRefinementMode{ + eosBayesDistributionRefinementModeGaussian=0, + eosBayesDistributionRefimentModelinear=1, + eosBayesDistributionRefinementModeConstant=2 +} eosBayesDistributionRefinementMode; + typedef struct eosBayesDistribution { //char* name; float min; @@ -12,6 +18,11 @@ typedef struct eosBayesDistribution { float* prob; float valueofmaxposterior; float probofmaxposterior; + int iofmaxposterior; + int resetflag; + int maxposteriorflag; + int constantflag; + eosBayesDistributionRefinementMode refmode; } eosBayesDistribution; @@ -46,14 +57,20 @@ typedef struct eosBayesDistributionInfo { // Initialization of eosBays extern void leosBayesInit(eosBayes* d, int numDistribution, int numLikelihood, int mode); +/*eosBayesCondition.c*/ extern void eosBayesCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionInfo* llinfo, int mode); extern void eosBayesRefinementCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionInfo* llinfo, int n, int mode); +extern void eosBayesGettopthreepoint(eosBayesDistribution* d, float* value, float* prob); +extern void eosBayesLiniearinterpolationofTopthreepoint(eosBayesDistribution* d, float* value, float* prob); // Initialize Each distribution of eosBayesDistributions extern void eosBayesDistributionInit(eosBayesDistribution* d,eosBayesDistributionInfo* info, int mode); + // Initialize probe of Each distribution of eosBayesDistriubutions extern void eosBayesDistributionInitialProbabilitySet(eosBayesDistribution* d, eosBayesDistributionInfo* info, int mode); +extern void eosBayesProbabilityReset(eosBayes* d, int mode); +extern void eosBayesProbabilitysetLinear(eosBayesDistribution* d, float a, float b); /* eosBayesEstimation.c */ extern void eosBayesEstimation(eosBayes* d, int mode); @@ -62,9 +79,9 @@ extern void eosBayesloop(eosBayesDistribution* d, int* L, int numDist, int lengt /* eosBayesWrite.c */ extern void eosBayesDistribututionWrite(FILE* fpt, eosBayesDistribution* d, int mode); -extern void eosBayesPriorWrite(FILE* fpt, eosBayes* d, int mode); -extern void eosBayesPosteriorWrite(FILE* fpt, eosBayes* d, int mode); -extern void eosBayesLikelihoodWrite(FILE* fpt, eosBayes* d, int mode); +extern void eosBayesPriorWrite(eosBayes* d, int mode); +extern void eosBayesPosteriorWrite(eosBayes* d, int mode); +extern void eosBayesLikelihoodWrite(eosBayes* d, int mode); extern void eosBayesWrite(FILE* fpt, eosBayes* d, int mode); // FileFormat // 0 min0 max0 delta0 n0 out.prior[0].prob[0] ...... prob[n-1] @@ -87,11 +104,11 @@ extern void eosBayesPosteriorRead(FILE* fpt, eosBayes* d, int mode); extern void eosBayesLikelihoodRead(FILE* fpt, eosBayes* d, int mode); extern void eosBayesRead(FILE* fpt, eosBayes* d, int mode); - /* eosBayesParameterOfMaxPosterior.c*/ extern void eosBayesParameterOfMaxPosteriorGet(eosBayesDistribution* d, int nunDistribution, int mode); +extern void leosBayesParameterOfMaxPosteriorGet(eosBayesDistribution* d, int mode); extern void eosBayesFree(eosBayes* d); - +extern void eosBayesMaxposteriorflagSet(eosBayes* d, int Distnum); #endif /* EOS_BAYES_H */ diff --git a/src/.DS_Store b/src/.DS_Store index caf618bdb52740c3883b6358fc6eb00a00c3f31f..d8f3b8a6a71f12d2452ece243329478c4f9aa7d1 100644 GIT binary patch delta 118 zcmZp1XmQvuQ9xPn|9=J$U}x}WNMguhNM%T7C}Aj0DlaZb%E?ax%KVAHHnU6oWZC>*goPOZkt`FB diff --git a/src/Objects/.DS_Store b/src/Objects/.DS_Store index 16067cdbcec376db598b35cfe9762bfb9c99351f..29f9e48905ea968e259bb794095226e0385cc545 100644 GIT binary patch delta 234 zcmZn(XfcprU|?W$DortDU=RQ@Ie-{MGjUEV6q~3gIoUvkMH0vdOE7}vQW;V_bMlju za`KZl7A|L;%q^iXIb1?uvbBUX6JyZi2nmzPegbS9|G|KPVX^>=*yK%O@{U&RsR4+fwX77)z@aW7bGb3D%+W&pu0Ezke} literal 10244 zcmeHNYit}>6+XxDW5$!zW5==A>p0%pO`Im1)~@`B6Y8w(wVlKXHnHPJoW$M7*dAp( zv+RuRq`}l69;Kx~p{-g3Elp_yfztk<6|^Ae52Ca}Dyob~cnG!q14vL_5+IPmx%bYl z_hCzf0HWR-i z8J$#C0UQXyVLDCFvwG($avsQe;Qz@3dGs=D{pQmtLy*>O>iUft_IxaCSYd#?N5U~f zx1GkupJLv+{DQ(FNiJ5D4Ym6Z94zS%PO9phtsT*fkfYCQ!H}cblWK`QV=WwrSmt0{ zo7c64(THWt&6?Cw8VMPZIqIx+8pe=*r|2DtTZS=c*}9`!=J=SSopx9on<%Ym?3iuE zoo+tam`?MHUS;eV12Hz(9?{}9Sy{evLy1~iwy}IuMWt`+j$51CJG#dr*6gfiI`*&` zn$;$v^cLN5jjqvQn;v)62!%Cc_>^u&N9V;fCt06EA=?>Qd&`uv+(4)@Gc*u@uW>hz)N9T204;z|VREmCCTCT40dXzflCb=~KX;}q6 zdRs$nt(vDkCrSKvr@vNF*Qp^%=C_SaO08O;Mrkm6R75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VXV&xRaRg>4 ze#~~8L@YU$vE%%ZW_tK4Klt1d?|F(wOwmXKwDkUXB%{B0PD+2c1uWXzrZdK|@I&fz z_`}{&7e<>4p__bWfldC4rh9;X%mB8hc$)RK=-V(qXLt+PS4r)wBx8y_aGHWjahl%- zJN*g#+pu5Le3w0}G3ss2B3dX!)z-vW#D6DVmElu{TjtXO*Qcv6yqrJDKS0~@s{Hqz zAOCZM7*F#kyd7i>xH9P%^S1@^=gO3HkAlcY~%Q&{z$ zyv+b8e@Wkx26M#XqW#34|A3_pSQP)6hdd;*`ur|>*Jo1Xu` z*E2x7KLfOHrr%%7U4iKAWAXo$fBKm!d4=M*(f$Wm7RHEa5p9sk9|GE92!;{!4hag>& L{}19_v;Y4S+E={z diff --git a/src/Objects/DataExpress/.DS_Store b/src/Objects/DataExpress/.DS_Store deleted file mode 100644 index fd6a34a22a63cc8d1cba634f03d6cb41d3858be4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKO-=$a7=4w|L1n?xo+-xQF&8>5XGCTL(`|BgCrkz=7j-~F`49I$~yj4;G4**&+{=iHZo8++~} zBc>SV*``@w-;g)K0Z)+$+5!7DU~j^)&+)+A5XU&pN32~25wVYGax5J@1?;y1yT=*c zE?1>=AF#_fql$g@AiB&?!Ea?s?*YFO^0CLck3&VHSr8X$;8>x*T~6{k$@eRb6DVsI~$M@Xi)1Z#&df6;K6Kfw=;5J|uL()MMt*9vw{V6Mz`8 z+8Xon(;zX4$JArykS#RhLWwTa_$P*O;jB+QFZGx?bm1`m@nL+=#=lUE?VaCGEFC6w zsHrNT3gi_ixnfoB|D&JZ|M?&-sRF9NN-1EX`bE9QDfzp#Fgdwv6Z#chOn8|?8^Xk2 h$2KEZ@ebV@+Y-qTQ;(TL*3k4vz{;SBD)6TYd;!Uisb2s9 diff --git a/src/Objects/DataManip/.DS_Store b/src/Objects/DataManip/.DS_Store deleted file mode 100644 index ba9772165bceffa12227022dcc6653d1787689aa..0000000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A@-LD%%A%)XGfF(a}D z%np!sd<}9&=NHlnIO3DG;(Fx>%YV0`=$CbO=F0eLV-9W1P!oQ8(D~v%V1likelihood,L,d->numLikelihood,i); + for(k=0;knumLikelihood;k++){ - parameter[k] = d->likelihood[k].value[L[k]]; + if(d->posterior[k].maxposteriorflag == 1){ + parameter[k] = d->posterior[k].valueofmaxposterior; + }else{ + parameter[k] = d->likelihood[k].value[L[k]]; + } } //DEBUGPRINT3("%d:%d:%d\n",L[0],L[1],L[2]); /* diff --git a/src/Objects/DataManip/ctfInfo/src/ctfforbayescheck.c b/src/Objects/DataManip/ctfInfo/src/ctfforbayescheck.c index 8d32e9aaa2..d6f2803a88 100644 --- a/src/Objects/DataManip/ctfInfo/src/ctfforbayescheck.c +++ b/src/Objects/DataManip/ctfInfo/src/ctfforbayescheck.c @@ -162,13 +162,12 @@ void ctfforbayescheckIntensityOfMaxPosterior(ctfforbayes ctf, eosBayesDistributi DEBUGPRINT("----intesity of Max Prior check----\n"); eosBayesParameterOfMaxPosteriorGet(d,numDistribution,0); - + for(i=0;inumLikelihood;i++){ free(l->x[i]); } free(l->width); free(l->x); } - - - DEBUGPRINT("In defocusLikelihoodInit\n"); - l->width = (double*)malloc(sizeof(double)*d.numLikelihood); - l->x = (float**)malloc(sizeof(float*)*d.numLikelihood); - for(i=0;ix[i] = (float*)malloc(sizeof(float)*d.likelihood[i].n); + l->width = (double*)malloc(sizeof(double)*d->numLikelihood); + l->x = (float**)malloc(sizeof(float*)*d->numLikelihood); + for(i=0;inumLikelihood;i++){ + l->x[i] = (float*)malloc(sizeof(float)*d->likelihood[i].n); } DEBUGPRINT("x and width init\n"); diff --git a/src/Objects/DataManip/mrcImage/.DS_Store b/src/Objects/DataManip/mrcImage/.DS_Store deleted file mode 100644 index 01d0771f31a6eb5a889529d75370d96ca19628d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10244 zcmeHMYitx%6h5adunPm7mh$Kp*o9Rb1w2nG4* zWEbM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Objects/DataManip/mrcImage/src/.DS_Store deleted file mode 100644 index 5a759915f0e2ea8f79f557543d0e9898647112b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40964 zcmeHQOLtU9lFq`|EnYUpFWLAZzvb5q#vV7P&ny6eTAX7HBVk*sISoQcvW29Pge~`? z4@;K4)Uwa4_z5g$$zpy0KY^dXZsz+k>sCf&M&7!&N}~JBlywbMs5*cAax$c=3AtsB;GoJ2!#rDZHvL{++Mv>lyr}ga7{%SF}6s+@@P_m)vc4 z-7RJB9{pm(z=(l=BnA#Z7!K@%c)jLUF>dAfU3BN&y1V1n+)a$4o!0UAbamrnD)9#A9;kMi&FnT^K-)IgmE!X^;6-FHA*@z}G#zX|CVdidv|0e`!SK6g~V%UT=v-%#qI==XQ% z_XVTh%joSFAZC0}@>h2R0$Dz8Ak2b`OYSRo0T_l9Cm#rmL%{gZz?gFzU2U%8uhU>+ z(ftQBUj(NM(3$M4f(7!8UhrDSPfJ?o&LhPAanT#%xjWhGZ4MY~Xt#ux*WoAA?jkI? zfS*_K{YPN0;BU+5CDVh*A4)cl0Qt4d*QU^V5m-OFIp4z~t}E`(_+8E}>@&ICleLnD z@@@LLXSLh%rn?NR4O^y~AdjUDuHePec-Ix!iYX#(k3gHa{ zfteuJ1i#?>DstIv|F2^9%3N#mk;vy>$S^M=H{A3YVkQyuebqYG>6TvyEdZ5yaE9Pn zk^T2aNV0uq$x4P}nFfEf`K0cj%n04{zI!e0jF9>(gcIeyD+G5sSwFxp6h>}=N{Th; z@oUl=+N;(t6(qO{{&&!R6>GfA3Z97vf{F14C{ylxtiF8S?e1u)JTDS2U$q3Cq*M_v zwJ;fyXeV1qSF>(YsQFkfuG-1hr;~y&yX}fKiph;?n{&f{yKP~s)9#e}(trO7*E5=F zjvs}Vd!R-utY8&J?n74))3^%mQ*-!qS8$U1@l_x&3K+4?vm#sPqxh=(0jtu?cRd5L zWj=~~Evqq@aELLaBro@!cqaYevoWD_x$lA(Qg4N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7|-hQoEtO5 zpD_lwv!9Jcj*ZFXird~jfJZU+<7@W_zFoxAeDLpshfxd0^%P!b@w$rFpYYni>n>h@ z<$Fh8BL+qc{NG`qbMV64h4av-Q_$%Eem{ZNpYY-r-*-1$eG`1+Tl^P(9uq(RjX&de z|HUi6I=(fpp-IOb?EXG9>)>(Z;e8X`>)G!0Zn*j$(Z1VbCp5?BM*BazPH65r6WxEG z4Oh&GONg7C3&UqZH_dCTc|*>R{pP90{n+#3X#Pk2gSEQUer@v(%Z_qh{eL$9|1VB) B$S(i@ diff --git a/src/Objects/DataManip/transform/.DS_Store b/src/Objects/DataManip/transform/.DS_Store deleted file mode 100644 index 3ac0140d09a44c6c9b28ec5d19d302b5b49e0d6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHLTWl3Y7@n^!u-lDv3Z*Tlhj0RzQd6k1(o?f`L*oM<9)Yd&`SGr-ldpx^s z!CI|8ijf$_YrMo8N+ez)MvXrBLckXjLn8R5y!fJt`rv~;_|MLk-l*{jN!U5r`DXsh z%$#q(-N`It45=}rp0P^Cm_nC8u2FTBBK+c7R0={%5g{m_dAW@3W~ldfCbuX$GDHkS z3`7h>3`7h>3|tQk(4H-dvc$eGy-^)85HWB=G9ca$3AzL(L!6cvygH}~jsS$>2oMx% zbI~A7gqRF*S|WLsh|#Is^T_dBhh!G0;3${{hd<`^~{%{T7WcqgDxyI&&h~>oxNp zp{kx*SrJd%e9LVOckaAU!b?|aWmzYM@^ZvHddwbGs>VrOWx-iBE|?jv9+=FigHlcoAV~s(yVQWZBn_ebbIs%`!L;TnOduDQMjS@*m}marKw)KUE%F&-?&`AG;Y@#l~UBI{aJT(lve0T^N!fv z3O}a|iMcy;&+p8c&g`n16lFkonhe71P~g!->CJx?P2 zo?T`?lSuzyf1wx^NRTkMpb_?iUIYhG5k%56xILP5aczBrP`6#9X zc|M7!a2!wLCA^GR@G4%%dpL#naT*`sGklIOW(B)It{n^HD&!o>bv&JSY}YwNmKkx+ z4~}}*f`LLgNu@adw=Vtt|5_|1nj>N$V&H#b07Wh7mK06C)XP|$wG(vRPnRenZdziH rLe;zv0n`tV<3VhKLPbt8#A%5^D%pcn!fW&)Alm<<{a*<11~2~rXJ8eu diff --git a/src/Objects/General/eosBayes/inc/eosBayes.h b/src/Objects/General/eosBayes/inc/eosBayes.h index 97d16f584a..c190db7c0b 100644 --- a/src/Objects/General/eosBayes/inc/eosBayes.h +++ b/src/Objects/General/eosBayes/inc/eosBayes.h @@ -2,6 +2,12 @@ #define EOS_BAYES_H +typedef enum eosBayesDistributionRefinementMode{ + eosBayesDistributionRefinementModeGaussian=0, + eosBayesDistributionRefimentModelinear=1, + eosBayesDistributionRefinementModeConstant=2 +} eosBayesDistributionRefinementMode; + typedef struct eosBayesDistribution { //char* name; float min; @@ -12,6 +18,11 @@ typedef struct eosBayesDistribution { float* prob; float valueofmaxposterior; float probofmaxposterior; + int iofmaxposterior; + int resetflag; + int maxposteriorflag; + int constantflag; + eosBayesDistributionRefinementMode refmode; } eosBayesDistribution; @@ -46,14 +57,20 @@ typedef struct eosBayesDistributionInfo { // Initialization of eosBays extern void leosBayesInit(eosBayes* d, int numDistribution, int numLikelihood, int mode); +/*eosBayesCondition.c*/ extern void eosBayesCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionInfo* llinfo, int mode); extern void eosBayesRefinementCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionInfo* llinfo, int n, int mode); +extern void eosBayesGettopthreepoint(eosBayesDistribution* d, float* value, float* prob); +extern void eosBayesLiniearinterpolationofTopthreepoint(eosBayesDistribution* d, float* value, float* prob); // Initialize Each distribution of eosBayesDistributions extern void eosBayesDistributionInit(eosBayesDistribution* d,eosBayesDistributionInfo* info, int mode); + // Initialize probe of Each distribution of eosBayesDistriubutions extern void eosBayesDistributionInitialProbabilitySet(eosBayesDistribution* d, eosBayesDistributionInfo* info, int mode); +extern void eosBayesProbabilityReset(eosBayes* d, int mode); +extern void eosBayesProbabilitysetLinear(eosBayesDistribution* d, float a, float b); /* eosBayesEstimation.c */ extern void eosBayesEstimation(eosBayes* d, int mode); @@ -62,9 +79,9 @@ extern void eosBayesloop(eosBayesDistribution* d, int* L, int numDist, int lengt /* eosBayesWrite.c */ extern void eosBayesDistribututionWrite(FILE* fpt, eosBayesDistribution* d, int mode); -extern void eosBayesPriorWrite(FILE* fpt, eosBayes* d, int mode); -extern void eosBayesPosteriorWrite(FILE* fpt, eosBayes* d, int mode); -extern void eosBayesLikelihoodWrite(FILE* fpt, eosBayes* d, int mode); +extern void eosBayesPriorWrite(eosBayes* d, int mode); +extern void eosBayesPosteriorWrite(eosBayes* d, int mode); +extern void eosBayesLikelihoodWrite(eosBayes* d, int mode); extern void eosBayesWrite(FILE* fpt, eosBayes* d, int mode); // FileFormat // 0 min0 max0 delta0 n0 out.prior[0].prob[0] ...... prob[n-1] @@ -87,11 +104,11 @@ extern void eosBayesPosteriorRead(FILE* fpt, eosBayes* d, int mode); extern void eosBayesLikelihoodRead(FILE* fpt, eosBayes* d, int mode); extern void eosBayesRead(FILE* fpt, eosBayes* d, int mode); - /* eosBayesParameterOfMaxPosterior.c*/ extern void eosBayesParameterOfMaxPosteriorGet(eosBayesDistribution* d, int nunDistribution, int mode); +extern void leosBayesParameterOfMaxPosteriorGet(eosBayesDistribution* d, int mode); extern void eosBayesFree(eosBayes* d); - +extern void eosBayesMaxposteriorflagSet(eosBayes* d, int Distnum); #endif /* EOS_BAYES_H */ diff --git a/src/Objects/General/eosBayes/src/eosBayesCondition.c b/src/Objects/General/eosBayes/src/eosBayesCondition.c index 1ebe8c8dfe..723e82c17d 100644 --- a/src/Objects/General/eosBayes/src/eosBayesCondition.c +++ b/src/Objects/General/eosBayes/src/eosBayesCondition.c @@ -66,6 +66,8 @@ void eosBayesRefinementCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionI int i; char s[1024]; + float value[3]; + float prob[3]; DEBUGPRINT("eosBayesRefinementConditon start\n"); fseek(fptIn,0,SEEK_SET); @@ -73,45 +75,121 @@ void eosBayesRefinementCondition(FILE* fptIn, eosBayes* d, eosBayesDistributionI eosBayesParameterOfMaxPosteriorGet(d->posterior,d->numDistribution,0); for(i=0;inumDistribution;i++){ - DEBUGPRINT2("%d/%d loop\n",i+1,d->numDistribution); - stringGetFromFile(s, "in main", fptIn, stdout, 3); - - llinfo->min = stringGetNthRealData(s, 2," \t"); - llinfo->max = stringGetNthRealData(s, 3," \t"); - llinfo->delta = stringGetNthRealData(s, 4," \t"); - llinfo->mode = stringGetNthIntegerData(s, 5," \t"); - llinfo->mean = stringGetNthRealData(s, 6," \t"); - llinfo->sigma = stringGetNthRealData(s, 7," \t"); - - switch(llinfo->mode){ - case 0: - /*Gaussian*/ - llinfo->min = d->posterior[i].valueofmaxposterior-d->posterior[i].delta; - llinfo->max = d->posterior[i].valueofmaxposterior+d->posterior[i].delta; - llinfo->sigma = d->posterior[i].delta; - llinfo->mean = d->posterior[i].valueofmaxposterior; - llinfo->delta = d->posterior[i].delta/n; - break; - - case 1: - /*Constant*/ - llinfo->mode = 0; - break; + DEBUGPRINT2("%d/%d loop\n",i+1,d->numDistribution); + stringGetFromFile(s, "in main", fptIn, stdout, 3); + if(d->posterior[i].maxposteriorflag==1){ + DEBUGPRINT2("dist%d use maxposteriorparameter: %f\n",i,d->posterior[i].valueofmaxposterior); + }else{ + switch(d->posterior[i].refmode){ + + case eosBayesDistributionRefinementModeGaussian: + DEBUGPRINT("mode Gaussian\n"); + eosBayesGettopthreepoint(&(d->posterior[i]),value,prob); + llinfo->min = value[0]; + llinfo->max = value[2]; + llinfo->sigma = d->posterior[i].delta; + llinfo->mean = value[1]; + llinfo->delta = d->posterior[i].delta/n; + DEBUGPRINT1("%s\n",s); + DEBUGPRINT6("min:%f max:%f delta:%f mode:%u mean:%f sigma:%f\n",llinfo->min,llinfo->max,llinfo->delta,llinfo->mode,llinfo->mean,llinfo->sigma); + eosBayesDistributionInit(&(d->prior[i]),llinfo,1); + eosBayesDistributionInit(&(d->posterior[i]),llinfo,1); + eosBayesDistributionInit(&(d->likelihood[i]),llinfo,1); + eosBayesDistributionInitialProbabilitySet(&(d->prior[i]), llinfo, 0); + break; + + case eosBayesDistributionRefimentModelinear: + DEBUGPRINT("mode linear\n"); + eosBayesGettopthreepoint(&(d->posterior[i]),value,prob); + llinfo->min = value[0]; + llinfo->max = value[2]; + llinfo->sigma = d->posterior[i].delta; + llinfo->mean = value[1]; + llinfo->delta = d->posterior[i].delta/n; + DEBUGPRINT1("%s\n",s); + DEBUGPRINT6("min:%f max:%f delta:%f mode:%u mean:%f sigma:%f\n",llinfo->min,llinfo->max,llinfo->delta,llinfo->mode,llinfo->mean,llinfo->sigma); + eosBayesDistributionInit(&(d->prior[i]),llinfo,1); + eosBayesDistributionInit(&(d->posterior[i]),llinfo,1); + eosBayesDistributionInit(&(d->likelihood[i]),llinfo,1); + eosBayesLiniearinterpolationofTopthreepoint(&(d->prior[i]),value,prob); + break; + + case eosBayesDistributionRefinementModeConstant: + if(d->posterior[i].constantflag==1){ + DEBUGPRINT("mode Constant\n"); + DEBUGPRINT("") + break; + }else if(d->posterior[i].constantflag==0){ + DEBUGPRINT("mode Constant->Gaussian\n"); + llinfo->min = stringGetNthRealData(s, 2," \t"); + llinfo->max = stringGetNthRealData(s, 3," \t"); + llinfo->delta = stringGetNthRealData(s, 4," \t"); + llinfo->mean = stringGetNthRealData(s, 6," \t"); + llinfo->sigma = stringGetNthRealData(s, 7," \t"); + llinfo->mode = 0; + DEBUGPRINT1("%s\n",s); + DEBUGPRINT6("min:%f max:%f delta:%f mode:%u mean:%f sigma:%f\n",llinfo->min,llinfo->max,llinfo->delta,llinfo->mode,llinfo->mean,llinfo->sigma); + eosBayesDistributionInit(&(d->prior[i]),llinfo,1); + eosBayesDistributionInit(&(d->posterior[i]),llinfo,1); + eosBayesDistributionInit(&(d->likelihood[i]),llinfo,1); + eosBayesDistributionInitialProbabilitySet(&(d->prior[i]), llinfo, 0); + break; + } - default: - break; + default: + break; + } + } + + } + + DEBUGPRINT("eosBayesRefinementConditon finish\n"); - DEBUGPRINT1("%s\n",s); - DEBUGPRINT6("min:%f max:%f delta:%f mode:%u mean:%f sigma:%f\n",llinfo->min,llinfo->max,llinfo->delta,llinfo->mode,llinfo->mean,llinfo->sigma); +} - eosBayesDistributionInit(&(d->prior[i]),llinfo,1); - eosBayesDistributionInit(&(d->posterior[i]),llinfo,1); - eosBayesDistributionInit(&(d->likelihood[i]),llinfo,1); - eosBayesDistributionInitialProbabilitySet(&(d->prior[i]), llinfo, 0); - } +void eosBayesGettopthreepoint(eosBayesDistribution* d, float* value, float* prob){ - DEBUGPRINT("eosBayesRefinementConditon finish\n"); + value[0] = d->value[d->iofmaxposterior-1]; + prob[0] = d->prob[d->iofmaxposterior-1]; + + value[1] = d->valueofmaxposterior; + prob[1] = d->probofmaxposterior; + + value[2] = d->value[d->iofmaxposterior+1]; + prob[2] = d->prob[d->iofmaxposterior+1]; + +} + + +void eosBayesLiniearinterpolationofTopthreepoint(eosBayesDistribution* d, float* value, float* prob){ + float a1; + float a2; + float b1; + float b2; + int i; + float sum; + + a1 = (prob[0]-prob[1])/(value[0]-value[1]); + b1 = -a1*value[1]+prob[1]; + + a2 = (prob[1]-prob[2])/(value[1]-value[2]); + b2 = -a2*value[1]+prob[1]; + + sum = 0; + for(i=0;in;i++){ + if(d->value[i]prob[i] = a1*d->value[i]+b1; + }else if(value[1]<=d->value[i]){ + d->prob[i] = a2*d->value[i]+b2; + } + sum += d->prob[i]; + } + + for(i=0;in;i++){ + d->prob[i] /= sum; + } + } diff --git a/src/Objects/General/eosBayes/src/eosBayesDistributionInit.c b/src/Objects/General/eosBayes/src/eosBayesDistributionInit.c index 087784fbed..d283041d72 100644 --- a/src/Objects/General/eosBayes/src/eosBayesDistributionInit.c +++ b/src/Objects/General/eosBayes/src/eosBayesDistributionInit.c @@ -34,11 +34,13 @@ void eosBayesDistributionInit(eosBayesDistribution* d, eosBayesDistributionInfo* d->min = info->min; d->max = info->max; d->delta = info->delta; + d->resetflag = 0; + d->maxposteriorflag = 0; switch(info->mode){ case 0: - d->n = (int)(((info->max-info->min)/info->delta)+0.5); + d->n = (int)(((info->max-info->min)/info->delta)+1); d->value = (float*)malloc(sizeof(float)*d->n); d->prob = (float*)malloc(sizeof(float)*d->n); info->mode = eosBayesDistributionInfoModeGaussian; @@ -46,7 +48,6 @@ void eosBayesDistributionInit(eosBayesDistribution* d, eosBayesDistributionInfo* d->value[i] = d->min+(d->delta*i); } break; - case 1: d->n = 1; d->value = (float*)malloc(sizeof(float)*d->n); diff --git a/src/Objects/General/eosBayes/src/eosBayesDistributionInitialProbabilitySet.c b/src/Objects/General/eosBayes/src/eosBayesDistributionInitialProbabilitySet.c index 38a97d28e3..d7207ccd4d 100644 --- a/src/Objects/General/eosBayes/src/eosBayesDistributionInitialProbabilitySet.c +++ b/src/Objects/General/eosBayes/src/eosBayesDistributionInitialProbabilitySet.c @@ -18,6 +18,10 @@ static char __sccs_id[] = "%Z%eosBayesDistributionInitialProbabilitySet ver%I%; #include #include "../inc/eosBayes.h" +#define DEBUG +#include "genUtil.h" +#include "String.h" + void eosBayesDistributionInitialProbabilitySet(eosBayesDistribution* d, eosBayesDistributionInfo* info, int mode){ @@ -53,3 +57,57 @@ void eosBayesDistributionInitialProbabilitySet(eosBayesDistribution* d, eosBayes } + +void eosBayesProbabilityReset(eosBayes* d, int mode){ + + FILE* fpt; + int i; + int j; + char s[1024]; + + DEBUGPRINT("eosBayesProbabilityReset\n"); + + for(i=0;inumDistribution;i++){ + if(d->prior[i].resetflag==1){ + DEBUGPRINT1("dist%d was reset\n",i); + free(d->prior[i].value); + free(d->prior[i].prob); + free(d->posterior[i].value); + free(d->posterior[i].prob); + free(d->likelihood[i].value); + free(d->likelihood[i].prob); + sprintf(s,"%s%d.out","./prior",i); + if((fpt=fopen(s,"r"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + } + DEBUGPRINT("eosBayesDistributionRead start\n"); + eosBayesDistributionRead(fpt,&(d->prior[i]),1); + eosBayesDistributionRead(fpt,&(d->posterior[i]),1); + eosBayesDistributionRead(fpt,&(d->likelihood[i]),1); + fclose(fpt); + leosBayesParameterOfMaxPosteriorGet(&(d->posterior[i]),0); + d->posterior[i].maxposteriorflag = 0; + d->prior[i].resetflag = 0; + } + } + +} + + +void eosBayesProbabilitysetLinear(eosBayesDistribution* d, float a, float b){ + + int i; + float sum; + + sum = 0; + + for(i=0;in;i++){ + d->prob[i] = a*d->value[i]+b; + sum += d->prob[i]; + } + + for(i=0;in;i++){ + d->prob[i] /= sum; + } + +} diff --git a/src/Objects/General/eosBayes/src/eosBayesEstimation.c b/src/Objects/General/eosBayes/src/eosBayesEstimation.c index 9e2a1d6636..4a8b260dfb 100644 --- a/src/Objects/General/eosBayes/src/eosBayesEstimation.c +++ b/src/Objects/General/eosBayes/src/eosBayesEstimation.c @@ -28,15 +28,17 @@ void eosBayesEstimation(eosBayes* d, int mode){ char s[1024]; for(i=0;inumDistribution;i++){ - DEBUGPRINT2("----%dDistribution num:%d\n----",i,d->prior[i].n); - sum=0; - for(j=0;jprior[i].n;j++){ + DEBUGPRINT2("----%dDistribution num:%d----\n",i,d->prior[i].n); + if(d->prior[i].n!=1){ + sum=0; + for(j=0;jprior[i].n;j++){ d->posterior[i].prob[j] = d->likelihood[i].prob[j]*d->prior[i].prob[j]; sum += d->posterior[i].prob[j]; - } - for(j=0;jprior[i].n;j++){ + } + for(j=0;jprior[i].n;j++){ d->posterior[i].prob[j] /= sum; DEBUGPRINT2("post:%f %f\n",d->posterior[i].value[j],d->posterior[i].prob[j]); + } } } @@ -51,13 +53,17 @@ void eosBayesPosteriortoPrior(eosBayes* d,int mode){ int j; for(i=0;inumDistribution;i++){ + if(d->prior[i].n!=1){ for(j=0;jprior[i].n;j++){ - d->prior[i].prob[j] = d->posterior[i].prob[j]; + d->prior[i].prob[j] = d->posterior[i].prob[j]; } + } } } + + void eosBayesloop(eosBayesDistribution* d, int* L, int numDist, int length){ int N1; diff --git a/src/Objects/General/eosBayes/src/eosBayesParameterOfMaxPosterior.c b/src/Objects/General/eosBayes/src/eosBayesParameterOfMaxPosterior.c index db42a4050e..347ba7b80d 100644 --- a/src/Objects/General/eosBayes/src/eosBayesParameterOfMaxPosterior.c +++ b/src/Objects/General/eosBayes/src/eosBayesParameterOfMaxPosterior.c @@ -11,7 +11,6 @@ */ static char __sccs_id[] = "%Z%eosBayesParameterOfMaxPosterior ver%I%; Date:%D% %Z%"; - #include #include #include @@ -26,24 +25,31 @@ static char __sccs_id[] = "%Z%eosBayesParameterOfMaxPosterior ver%I%; Date:%D% % void eosBayesParameterOfMaxPosteriorGet(eosBayesDistribution* d, int numDistribution, int mode){ int i; - int j; - for(i=0;ivalueofmaxposterior = d->value[0]; + d->probofmaxposterior = d->prob[0]; + for(i=0;in;i++){ + if(d->probofmaxposterior < d->prob[i]){ + d->valueofmaxposterior = d->value[i]; + d->probofmaxposterior = d->prob[i]; + d->iofmaxposterior = i; + } + } } diff --git a/src/Objects/General/eosBayes/src/eosBayesRead.c b/src/Objects/General/eosBayes/src/eosBayesRead.c index 7289b8cb7b..176a8b610e 100644 --- a/src/Objects/General/eosBayes/src/eosBayesRead.c +++ b/src/Objects/General/eosBayes/src/eosBayesRead.c @@ -45,36 +45,38 @@ void eosBayesDistributioncheck(FILE* fpt, eosBayes* d, int mode){ void eosBayesDistributionRead(FILE* fpt, eosBayesDistribution* d, int mode){ - int i; - char s[1024]; - - - i=0; - while(NULL !=__getStringData(s,"In eosBayesDistributionRead",fpt,stdout,3)){ - - if(STRING_COMMENT_LINE_ID==s[0]){ - i=0; - d->min = stringGetNthRealData(s,2,STRING_WORD_SEPARATOR); - d->max = stringGetNthRealData(s,3,STRING_WORD_SEPARATOR); - d->delta = stringGetNthRealData(s,4,STRING_WORD_SEPARATOR); - d->n = stringGetNthIntegerData(s,5,STRING_WORD_SEPARATOR); - DEBUGPRINT4("%f %f %f %d\n",d->min,d->max,d->delta,d->n); - d->prob = (float*)malloc(sizeof(float)*d->n); - }else if('/' == s[0]){ - DEBUGPRINT("break\n"); - break; - }else{ - d->prob[i] = atof(s); - DEBUGPRINT1("%f\n",d->prob[i]); - i++; - } + int i; + char s[1024]; + i=0; + while(NULL !=__getStringData(s,"In eosBayesDistributionRead",fpt,stdout,3)){ + + if(STRING_COMMENT_LINE_ID==s[0]){ + i=0; + d->min = stringGetNthRealData(s,2,STRING_WORD_SEPARATOR); + d->max = stringGetNthRealData(s,3,STRING_WORD_SEPARATOR); + d->delta = stringGetNthRealData(s,4,STRING_WORD_SEPARATOR); + d->n = (int)(((d->max-d->min)/d->delta)+1); + DEBUGPRINT4("%f %f %f %d\n",d->min,d->max,d->delta,d->n); + d->value = (float*)malloc(sizeof(float)*d->n); + d->prob = (float*)malloc(sizeof(float)*d->n); + }else if('/' == s[0]){ + DEBUGPRINT("break\n"); + break; + }else{ + d->value[i] = stringGetNthRealData(s,1,STRING_WORD_SEPARATOR); + d->prob[i] = stringGetNthRealData(s,2,STRING_WORD_SEPARATOR); + DEBUGPRINT2("%f\t%f\n",d->value[i],d->prob[i]); + i++; } + + } -} - - + fseek(fpt,0,SEEK_SET); + + DEBUGPRINT("DistributionRead end\n"); +} @@ -129,6 +131,5 @@ void eosBayesLikelihoodRead(FILE* fpt, eosBayes* d, int mode){ - void eosBayesRead(FILE* fpt, eosBayes* d, int mode){ } diff --git a/src/Objects/General/eosBayes/src/eosBayesWrite.c b/src/Objects/General/eosBayes/src/eosBayesWrite.c index 304a21d2ad..34486717b8 100644 --- a/src/Objects/General/eosBayes/src/eosBayesWrite.c +++ b/src/Objects/General/eosBayes/src/eosBayesWrite.c @@ -28,13 +28,12 @@ void eosBayesDistributionWrite(FILE* fpt, eosBayesDistribution* d, int mode){ switch(mode){ case 1: - fprintf(fpt,"#dist: %f\t%f\t%f\t%d\n",d->min,d->max,d->delta,d->n); - DEBUGPRINT4("#dist: %f\t%f\t%f\t%d\n",d->min,d->max,d->delta,d->n); + fprintf(fpt,"#dist:\t%f\t%f\t%f\t%d\n",d->min,d->max,d->delta,d->n); + DEBUGPRINT4("#dist:\t%f\t%f\t%f\t%d\n",d->min,d->max,d->delta,d->n); for(i=0;in;i++){ - fprintf(fpt,"%f\n",d->prob[i]); + fprintf(fpt,"%f\t%f\n",d->value[i],d->prob[i]); DEBUGPRINT2("%f %f\n",d->value[i],d->prob[i]); } - fprintf(fpt,"#end\n\n"); break; case 2: @@ -49,38 +48,59 @@ void eosBayesDistributionWrite(FILE* fpt, eosBayesDistribution* d, int mode){ } -void eosBayesPriorWrite(FILE* fpt, eosBayes* d, int mode){ +void eosBayesPriorWrite(eosBayes* d, int mode){ - int i; + FILE* fpt; + int i; + char s[1024]; - for(i=0;inumDistribution;i++){ - eosBayesDistributionWrite(fpt,&(d->prior[i]),1); + for(i=0;inumDistribution;i++){ + sprintf(s,"%s%d.out","./prior",i); + if((fpt=fopen(s,"w"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); } - - + eosBayesDistributionWrite(fpt,&(d->prior[i]),1); + fclose(fpt); + } + } -void eosBayesPosteriorWrite(FILE* fpt, eosBayes* d, int mode){ +void eosBayesPosteriorWrite(eosBayes* d, int mode){ - int i; + FILE* fpt; + int i; + char s[1024]; - for(i=0;inumDistribution;i++){ - eosBayesDistributionWrite(fpt,&(d->posterior[i]),1); + for(i=0;inumDistribution;i++){ + sprintf(s,"%s%d.out","./posterior",i); + if((fpt=fopen(s,"w"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); } - + eosBayesDistributionWrite(fpt,&(d->posterior[i]),1); + fclose(fpt); + } } -void eosBayesLikelihoodWrite(FILE* fpt, eosBayes* d, int mode){ +void eosBayesLikelihoodWrite(eosBayes* d, int mode){ - int i; + FILE* fpt; + int i; + char s[1024]; - for(i=0;d->numLikelihood;i++){ - eosBayesDistributionWrite(fpt,&(d->likelihood[i]),2); + for(i=0;inumDistribution;i++){ + sprintf(s,"%s%d.out","./likelihood",i); + if((fpt=fopen(s,"w"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); } - + eosBayesDistributionWrite(fpt,&(d->likelihood[i]),1); + fclose(fpt); + } } @@ -98,55 +118,54 @@ void DistributionChangeCheck(eosBayes* d, int mode){ char s[1024]; for(i=0;inumDistribution;i++){ + if(d->prior[i].n!=1){ + sprintf(s,"%s%d.out","./dist",i); - sprintf(s,"%s%d.out","./dist",i); - - switch(mode){ - + switch(mode){ + + case 0: - case 0: + /*write prior prob*/ + if((fpt=fopen(s,"a"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); + } - /*write prior prob*/ - if((fpt=fopen(s,"w"))==NULL){ - fprintf(stderr,"fopen error: %s\n",s); - exit(1); - } + fprintf(fpt,"#dist: %f\t%f\t%f\t%d\n",d->prior[i].min,d->prior[i].max,d->prior[i].delta,d->prior[i].n); + for(j=0;jprior[i].n;j++){ + fprintf(fpt,"%f %f\n",d->prior[i].value[j],d->prior[i].prob[j]); + } + fprintf(fpt,"\n\n"); - fprintf(fpt,"#dist: %f\t%f\t%f\t%d\n",d->prior[i].min,d->prior[i].max,d->prior[i].delta,d->prior[i].n); - for(j=0;jprior[i].n;j++){ - fprintf(fpt,"%f %f\n",d->prior[i].value[j],d->prior[i].prob[j]); - } - fprintf(fpt,"\n\n"); + fclose(fpt); + break; - fclose(fpt); - break; + case 1: + /*write posterior prob*/ + if((fpt=fopen(s,"a"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); + } - case 1: - /*write posterior prob*/ - if((fpt=fopen(s,"a"))==NULL){ - fprintf(stderr,"fopen error: %s\n",s); - exit(1); - } - - for(j=0;jposterior[i].n;j++){ - fprintf(fpt,"%f %f\n",d->posterior[i].value[j],d->posterior[i].prob[j]); - } - fprintf(fpt,"\n\n"); - - fclose(fpt); - break; - - - default: - fprintf(stderr,"\n"); - break; + for(j=0;jposterior[i].n;j++){ + fprintf(fpt,"%f %f\n",d->posterior[i].value[j],d->posterior[i].prob[j]); + } + fprintf(fpt,"\n\n"); + + fclose(fpt); + break; + + + default: + fprintf(stderr,"\n"); + break; - } - + } + } + } - } @@ -158,41 +177,40 @@ void LikelihoodChangeCheck(eosBayes* d, int count, int mode){ char s[1024]; for(i=0;inumDistribution;i++){ - sprintf(s,"%s%d.out","./likelihood",i); + if(d->prior[i].n!=1){ + sprintf(s,"%s%d.out","./likelihood",i); - if(count == 0){ - - if((fpt=fopen(s,"w"))==NULL){ - fprintf(stderr,"fopen error: %s\n",s); - exit(1); - } + if(count == 0){ - fprintf(fpt,"#dist: %f\t%f\t%f\t%d\n",d->likelihood[i].min,d->likelihood[i].max,d->likelihood[i].delta,d->likelihood[i].n); - for(j=0;jlikelihood[i].n;j++){ - fprintf(fpt,"%f %f\n",d->likelihood[i].value[j],d->likelihood[i].prob[j]); - } - fprintf(fpt,"\n\n"); + if((fpt=fopen(s,"w"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); + } - fclose(fpt); - - }else if(count > 0){ - - if((fpt=fopen(s,"a"))==NULL){ - fprintf(stderr,"fopen error: %s\n",s); - exit(1); + fprintf(fpt,"#dist: %f\t%f\t%f\t%d\n",d->likelihood[i].min,d->likelihood[i].max,d->likelihood[i].delta,d->likelihood[i].n); + for(j=0;jlikelihood[i].n;j++){ + fprintf(fpt,"%f %f\n",d->likelihood[i].value[j],d->likelihood[i].prob[j]); + } + fprintf(fpt,"\n\n"); + + fclose(fpt); + + }else if(count > 0){ + + if((fpt=fopen(s,"a"))==NULL){ + fprintf(stderr,"fopen error: %s\n",s); + exit(1); + } + + for(j=0;jlikelihood[i].n;j++){ + fprintf(fpt,"%f %f\n",d->likelihood[i].value[j],d->likelihood[i].prob[j]); + } + fprintf(fpt,"\n\n"); + fclose(fpt); + } - - for(j=0;jlikelihood[i].n;j++){ - fprintf(fpt,"%f %f\n",d->likelihood[i].value[j],d->likelihood[i].prob[j]); - } - fprintf(fpt,"\n\n"); - - fclose(fpt); - } - } - } diff --git a/src/Objects/General/eosBayes/src/eosBayesflag.c b/src/Objects/General/eosBayes/src/eosBayesflag.c new file mode 100644 index 0000000000..3d4b98c9d5 --- /dev/null +++ b/src/Objects/General/eosBayes/src/eosBayesflag.c @@ -0,0 +1,28 @@ +/* +# %M% %Y% %I% +# The latest update : %G% at %U% +# +#%Z% eosBayesflag ver %I% +#%Z% Created by +#%Z% +#%Z% Usage : eosBayesflag +#%Z% Attention +#%Z% +*/ +static char __sccs_id[] = "%Z%eosBayesflag ver%I%; Date:%D% %Z%"; + +#include +#include +#include +#include "../inc/eosBayes.h" + +#define DEBUG +#include "genUtil.h" +#include "String.h" + +void eosBayesMaxposteriorflagSet(eosBayes* d, int Distnum){ + d->posterior[Distnum].maxposteriorflag = 1; + d->posterior[Distnum].n = 1; + d->prior[Distnum].n = 1; + d->likelihood[Distnum].n = 1; +} diff --git a/src/Objects/General/eosBayes/src/eosBayesflag.c~ b/src/Objects/General/eosBayes/src/eosBayesflag.c~ new file mode 100644 index 0000000000..215d15efe6 --- /dev/null +++ b/src/Objects/General/eosBayes/src/eosBayesflag.c~ @@ -0,0 +1,14 @@ +/* +# %M% %Y% %I% +# The latest update : %G% at %U% +# +#%Z% eosBayesflag ver %I% +#%Z% Created by +#%Z% +#%Z% Usage : eosBayesflag +#%Z% Attention +#%Z% +*/ +static char __sccs_id[] = "%Z%eosBayesflag ver%I%; Date:%D% %Z%"; + + diff --git a/src/Tools/Config/Define.inc b/src/Tools/Config/Define.inc index 0d2fbd048f..976d15820a 100755 --- a/src/Tools/Config/Define.inc +++ b/src/Tools/Config/Define.inc @@ -5,3 +5,6 @@ WORLDNAME=Tools WORLDNAME=Tools WORLDNAME=Tools WORLDNAME=Tools +WORLDNAME=Tools +WORLDNAME=Tools +WORLDNAME=Tools diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/Config/OptionControlFile b/src/Tools/ctfInfo/ctfDeterminationByBayes/Config/OptionControlFile index a78bc3816c..b1a2ef8530 100755 --- a/src/Tools/ctfInfo/ctfDeterminationByBayes/Config/OptionControlFile +++ b/src/Tools/ctfInfo/ctfDeterminationByBayes/Config/OptionControlFile @@ -4,10 +4,9 @@ "-i2","-i[nput]2","InputDataFile","Essential","1","1","In2","inFile","NULL" "-i3","-i[nput]3","InputDataFile","Essential","1","1","In3","inFile","NULL" "-i4","-i[nput]4","InputDataFile","Essential","1","1","In4","inFileListNoOpen","NULL" -"-o","-o[utput]","OutputDataFile","Essential","1","1","Out","outFile","NULL" -"-O","-o[utput]","OutputDataFile","Essential","1","1","Out2","outFile","NULL" "-n","-n[um]","Integer","Essential","2","1","numDistribution","Integer","3","2","numLikelihood","Integer","3" "-rmax","-rmax","rmax[1/A]","Optional","1","1","rmax","Real","250" +"-rintermediate","-rintermediate","rintermediate[1/A]","Optional","1","1","rintermediate","Real","250" "-rmin","-rmin","rmin[1/A]","Optional","1","1","rmin","Real","0" "-c","-c[onfig]","ConfigurationFile","Optional","1","1","configFile","inFile","NULL" "-m","-m[ode]","Mode","Optional","1","1","mode","Integer","0" diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/inc/ctfDeterminationByBayes.h b/src/Tools/ctfInfo/ctfDeterminationByBayes/inc/ctfDeterminationByBayes.h index ea95432bdc..7f24c238bf 100755 --- a/src/Tools/ctfInfo/ctfDeterminationByBayes/inc/ctfDeterminationByBayes.h +++ b/src/Tools/ctfInfo/ctfDeterminationByBayes/inc/ctfDeterminationByBayes.h @@ -31,14 +31,6 @@ typedef struct ctfDeterminationByBayesInfo { FILE** fptIn4; FILE* fptIn4List; - long flagOut; - char* Out; - FILE* fptOut; - - long flagOut2; - char* Out2; - FILE* fptOut2; - long flagnumDistribution; long numDistribution; @@ -48,6 +40,9 @@ typedef struct ctfDeterminationByBayesInfo { long flagrmax; float rmax; + long flagrintermediate; + float rintermediate; + long flagrmin; float rmin; diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/#ctfDeterminationByBayes.cls# b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/#ctfDeterminationByBayes.cls# new file mode 100755 index 0000000000..e69de29bb2 diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/argCheck.c b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/argCheck.c index 6189ee7110..20e471a2d9 100755 --- a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/argCheck.c +++ b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/argCheck.c @@ -72,28 +72,6 @@ argCheck(ctfDeterminationByBayesInfo* info, int argc, char* argv[]) } SBREAK; } - SCASE("o") { - if(i+1Out = stringGetNthWord(argv[i+1], 1, " ,"); - i++; - info->flagOut++; - } else { - usage(argv[0]); - exit(EXIT_FAILURE); - } - SBREAK; - } - SCASE("O") { - if(i+1Out2 = stringGetNthWord(argv[i+1], 1, " ,"); - i++; - info->flagOut2++; - } else { - usage(argv[0]); - exit(EXIT_FAILURE); - } - SBREAK; - } SCASE("n") { if(i+2numDistribution = stringGetNthIntegerData(argv[i+1], 1, " ,"); @@ -119,6 +97,17 @@ argCheck(ctfDeterminationByBayesInfo* info, int argc, char* argv[]) } SBREAK; } + SCASE("rintermediate") { + if(i+1rintermediate = stringGetNthRealData(argv[i+1], 1, " ,"); + i++; + info->flagrintermediate++; + } else { + usage(argv[0]); + exit(EXIT_FAILURE); + } + SBREAK; + } SCASE("rmin") { if(i+1rmin = stringGetNthRealData(argv[i+1], 1, " ,"); diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/ctfDeterminationByBayes.c b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/ctfDeterminationByBayes.c index ad4455a45a..0b1c3850de 100755 --- a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/ctfDeterminationByBayes.c +++ b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/ctfDeterminationByBayes.c @@ -37,10 +37,13 @@ typedef enum lctfDeterminationByBayesMode { } lctfDeterminationByBayesMode; */ +void DefocusEstimationLoop(ctfDeterminationByBayesInfo info, eosBayes* out, ctfInfo* ctfinfo, ctfforbayes* ctf, intensityforbayes* intensity, defocuslikelihoodforbayes* likelihood, int mode); + int main(int argc, char* argv[]) { + int i; ctfDeterminationByBayesInfo info; ctfInfo ctfinfo; eosBayesDistributionInfo llinfo; @@ -51,7 +54,9 @@ main(int argc, char* argv[]) intensityforbayes intensity; defocuslikelihoodforbayes likelihood; - int i; + float Rmax; + float Rmin; + float Rintermediate; init0(&info); argCheck(&info, argc, argv); @@ -64,7 +69,7 @@ main(int argc, char* argv[]) /*For Prior*/ leosBayesInit(&out, info.numDistribution, info.numLikelihood, info.mode); eosBayesCondition(info.fptIn, &out, &llinfo, 0); - eosBayesPriorWrite(info.fptOut2, &out,0); + eosBayesPriorWrite(&out,0); DistributionChangeCheck(&out, 0); @@ -76,56 +81,156 @@ main(int argc, char* argv[]) DEBUGPRINT6("kV:%f Cs:%f Ain:%f Cc:%f MTF:%f ctfMode:%ld\n",ctfinfo.kV,ctfinfo.Cs,ctfinfo.Ain,ctfinfo.Cc,ctfinfo.BofMTF,ctfinfo.mode); DEBUGPRINT1("flagIn4:%ld\n",info.flagIn4); + Rmax = ctf.rmax; + Rmin = ctf.rmin; + Rintermediate = info.rintermediate; - /*For likelihood*/ - defocusLikelihoodInit(&likelihood,out,0); + /*global carse search*/ + DEBUGPRINT("carse search start\n"); + DEBUGPRINT2("set R range:%f~%f\n",ctf.rmin,ctf.rmax); + DefocusEstimationLoop(info,&out,&ctfinfo,&ctf,&intensity,&likelihood,0); + DEBUGPRINT("carse search finish\n"); + ctfforbayescheckIntensityOfMaxPosterior(ctf,out.posterior,out.numDistribution,&ctfinfo,intensity.MTFmode,intensity.Ainmode,1,1); - /*defocus estimation*/ - for(i=0;ifptIn2 = NULL; info->flagIn2 = 0; info->fptIn3 = NULL; info->flagIn3 = 0; info->fptIn4 = NULL; info->fptIn4List = NULL; info->flagIn4 = 0; - info->fptOut = NULL; info->flagOut = 0; - info->fptOut2 = NULL; info->flagOut2 = 0; info->numDistribution = 3; info->flagnumDistribution = 0; info->numLikelihood = 3; info->flagnumLikelihood = 0; info->rmax = 250; info->flagrmax = 0; + info->rintermediate = 250; info->flagrintermediate = 0; info->rmin = 0; info->flagrmin = 0; info->fptconfigFile = NULL; info->flagconfigFile = 0; info->mode = 0; info->flagmode = 0; @@ -84,24 +83,6 @@ init1(ctfDeterminationByBayesInfo* info) } } - if(!info->flagOut) { - stringGetFromFile(s, "Out", stdin, stdout, 0); - info->Out = stringGetNthWord(s, 1, " ,\t"); - info->flagOut++; - } - if(info->flagOut) { - info->fptOut = fileOpen(info->Out, "w"); - } - - if(!info->flagOut2) { - stringGetFromFile(s, "Out2", stdin, stdout, 0); - info->Out2 = stringGetNthWord(s, 1, " ,\t"); - info->flagOut2++; - } - if(info->flagOut2) { - info->fptOut2 = fileOpen(info->Out2, "w"); - } - if(!info->flagnumDistribution) { stringGetFromFile(s, "numDistribution", stdin, stdout, 0); info->numDistribution = stringGetNthIntegerData(s, 1, ", \t"); @@ -121,6 +102,9 @@ init1(ctfDeterminationByBayesInfo* info) if(info->flagrmax) { } + if(info->flagrintermediate) { + } + if(info->flagrmin) { } diff --git a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/usage.c b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/usage.c index 24ca54a5eb..a2ec9d46fa 100755 --- a/src/Tools/ctfInfo/ctfDeterminationByBayes/src/usage.c +++ b/src/Tools/ctfInfo/ctfDeterminationByBayes/src/usage.c @@ -11,10 +11,9 @@ usage(char* thisProgram) fprintf(stderr, " [-i[nput]2 In2 (NULL ).as(inFile ) ] :Essential :InputDataFile\n"); fprintf(stderr, " [-i[nput]3 In3 (NULL ).as(inFile ) ] :Essential :InputDataFile\n"); fprintf(stderr, " [-i[nput]4 In4 (NULL ).as(inFileListNoOpen ) ] :Essential :InputDataFile\n"); - fprintf(stderr, " [-o[utput] Out (NULL ).as(outFile ) ] :Essential :OutputDataFile\n"); - fprintf(stderr, " [-o[utput] Out2 (NULL ).as(outFile ) ] :Essential :OutputDataFile\n"); fprintf(stderr, " [-n[um] numDistribution (3 ).as(Integer ) \n numLikelihood (3 ).as(Integer ) ] :Essential :Integer\n"); fprintf(stderr, " [-rmax rmax (250 ).as(Real ) ] :Optional :rmax[1/A]\n"); + fprintf(stderr, " [-rintermediate rintermediate (250 ).as(Real ) ] :Optional :rintermediate[1/A]\n"); fprintf(stderr, " [-rmin rmin (0 ).as(Real ) ] :Optional :rmin[1/A]\n"); fprintf(stderr, " [-c[onfig] configFile (NULL ).as(inFile ) ] :Optional :ConfigurationFile\n"); fprintf(stderr, " [-m[ode] mode (0 ).as(Integer ) ] :Optional :Mode\n"); -- 2.11.0