/** * \file Histogram.cpp \brief simple histogram class * * Copyright 2007-2013 IMP Inventors. All rights reserved. */ #include #include #include #include #include IMPSTATISTICS_BEGIN_NAMESPACE #if IMP_HAS_DEPRECATED Histogram::Histogram(double start, double end, unsigned int num_bins) { start_=start; end_=end; interval_size_ = (end-start)/num_bins; freq_.insert(freq_.end(),num_bins,0); IMP_DEPRECATED_CLASS(Histogram, HistogramD); } void Histogram::add(double x) { IMP_INTERNAL_CHECK(!(xend_), "the value being added to the "<< "histogram "<((x-start_)/interval_size_)); freq_[i]++; } unsigned int Histogram::get_total_count() const { return std::accumulate(freq_.begin(),freq_.end(),0); } void Histogram::show(std::ostream& out) const { out<<"histogram for range:["<1.)), "The input number is not a percentage\n"); double stop_count = get_total_count()*percentage; int partial_count=0; for(unsigned int i=0;i stop_count) { return start_+i*interval_size_; } } return end_; } #endif IMPSTATISTICS_END_NAMESPACE