Ejemplo n.º 1
0
void add_to_histogram_index(hist_info *hist, int index) {
    if(hist->flag_finalized)
        SID_exit_error("An addition has been attempted on an already-finalized histogram in add_to_histogram_index().",
                       SID_ERROR_LOGIC);
    if(is_histogram_index_in_range(hist, index)) {
        hist->bin_count[index]++;
        hist->count_hist++;
    }
    hist->count_all++;
}
Ejemplo n.º 2
0
double histogram_bin_x_lo(hist_info *hist,int bin){
  double r_val;

  // Sanity check
  if(!is_histogram_index_in_range(hist,bin))
     SID_trap_error("Invalid bin requested (%d) in histogram_bin_x_hi().",ERROR_LOGIC,bin);

  if(check_mode_for_flag(hist->mode,GBP_HISTOGRAM_FIXED)){
     switch(hist->flag_bin_order_inverted){
        case FALSE:
           r_val=hist->x_min+((double)(bin))*hist->dx;
           break;
        case TRUE:
           r_val=hist->x_min+((double)(hist->n_bins-bin-1))*hist->dx;
           break;
     }
  }
  else if(check_mode_for_flag(hist->mode,GBP_HISTOGRAM_IRREGULAR_XLO_DEFINED))
     r_val=hist->x_lo[bin];
  else
     SID_trap_error("Invalid mode (%d) specified in histogram_bin_x_lo().",ERROR_LOGIC,hist->mode);
  return(r_val);
}