X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=npshannon.cpp;h=a855b316964da97dd261f33ee094f014a4ed7b05;hp=73dd834748cedde6b6c12333f02f682b487bc7e5;hb=050a3ff02473a3d4c0980964e1a9ebe52e55d6b8;hpb=dc08123b7f14e2305e5bb2b3a8fcef96fc829b07 diff --git a/npshannon.cpp b/npshannon.cpp index 73dd834..a855b31 100644 --- a/npshannon.cpp +++ b/npshannon.cpp @@ -18,7 +18,7 @@ EstOutput NPShannon::getValues(SAbundVector* rank){ float npShannon = 0.0000; double maxRank = (double)rank->getMaxRank(); - int sampled = rank->getNumSeqs(); + double sampled = rank->getNumSeqs(); double Chat = 1.0000 - (double)rank->get(1)/(double)sampled; @@ -28,7 +28,6 @@ EstOutput NPShannon::getValues(SAbundVector* rank){ double ChatPi = Chat*pi; if(ChatPi>0){ npShannon += rank->get(i) * ChatPi*log(ChatPi)/(1-pow(1-ChatPi,(double)sampled)); - //cout << ChatPi << '\t' << rank->get(i) * ChatPi*log(ChatPi)/(1-pow(1-ChatPi,(double)sampled)) << endl; } } npShannon = -npShannon; @@ -44,13 +43,9 @@ EstOutput NPShannon::getValues(SAbundVector* rank){ return data; } catch(exception& e) { - cout << "Standard Error: " << e.what() << " has occurred in the NPShannon class Function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; + m->errorOut(e, "NPShannon", "getValues"); exit(1); } - catch(...) { - cout << "An unknown error has occurred in the NPShannon class function getValues. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n"; - exit(1); - } } /***********************************************************************/