replicate_df['error'] = Deltaf_ij_error.copy()
  replicates_df.append(replicate_df)

  replicate_observable['estimated'] = A_k_estimated.copy()
  replicate_observable['destimated'] = dA_k_estimated.copy()
  replicate_observable['error'] = A_k_error.copy()
  replicates_observable.append(replicate_observable)

  replicate_standobservable['estimated'] = As_k_estimated[ifzero].copy()
  replicate_standobservable['destimated'] = dAs_k_estimated[ifzero].copy()
  replicate_standobservable['error'] = As_k_error[ifzero].copy()
  replicates_standobservable.append(replicate_standobservable)

# compute the probability distribution of all states
print "Free energies"
(alpha_fij,Pobs_fij,Plow_fij,Phigh_fij,dPobs_fij,Pnorm_fij) = confidenceintervals.generateConfidenceIntervals(replicates_df,K);
print "Standard ensemble averaged observables"
(alpha_Ai,Pobs_Ai,Plow_Ai,Phigh_Ai,dPobs_Ai,Pnorm_Ai) = confidenceintervals.generateConfidenceIntervals(replicates_standobservable,numpy.sum(ifzero));
print "MBAR ensemble averaged observables"
(alpha_Ai,Pobs_Ai,Plow_Ai,Phigh_Ai,dPobs_Ai,Pnorm_Ai) = confidenceintervals.generateConfidenceIntervals(replicates_observable,K);

if (generateplots):
    override = {
      'family'              : 'sans-serif',
      'verticalalignment'   : 'bottom',
      'horizontalalignment' : 'center',
      'weight'              : 'bold',
      'size'                : 30
      }
    
    formatstrings = ['b-','g-','c-','y-','r-','m-']
    replicates_df.append(replicate_df)

    replicate_observable['estimated'] = A_k_estimated.copy()
    replicate_observable['destimated'] = dA_k_estimated.copy()
    replicate_observable['error'] = A_k_error.copy()
    replicates_observable.append(replicate_observable)

    replicate_standobservable['estimated'] = As_k_estimated[ifzero].copy()
    replicate_standobservable['destimated'] = dAs_k_estimated[ifzero].copy()
    replicate_standobservable['error'] = As_k_error[ifzero].copy()
    replicates_standobservable.append(replicate_standobservable)

# compute the probability distribution of all states
print "Free energies"
(alpha_fij, Pobs_fij, Plow_fij, Phigh_fij, dPobs_fij,
 Pnorm_fij) = confidenceintervals.generateConfidenceIntervals(
     replicates_df, K)
print "Standard ensemble averaged observables"
(alpha_Ai, Pobs_Ai, Plow_Ai, Phigh_Ai, dPobs_Ai,
 Pnorm_Ai) = confidenceintervals.generateConfidenceIntervals(
     replicates_standobservable, numpy.sum(ifzero))
print "MBAR ensemble averaged observables"
(alpha_Ai, Pobs_Ai, Plow_Ai, Phigh_Ai, dPobs_Ai,
 Pnorm_Ai) = confidenceintervals.generateConfidenceIntervals(
     replicates_observable, K)

if (generateplots):
    override = {
        'family': 'sans-serif',
        'verticalalignment': 'bottom',
        'horizontalalignment': 'center',
        'weight': 'bold',