@statfunc
def mc_error(x, batches=5):
 if (x.ndim > 1):
  dims = np.shape(x)
  trace = np.transpose([t.ravel() for t in x])
  return np.reshape([mc_error(t, batches) for t in trace], dims[1:])
 else:
  if (batches == 1):
   return (np.std(x) / np.sqrt(len(x)))
  try:
   batched_traces = np.resize(x, (batches, int((len(x) / batches))))
  except ValueError:
   resid = (len(x) % batches)
   new_shape = (batches, ((len(x) - resid) / batches))
   batched_traces = np.resize(x[:(- resid)], new_shape)
  means = np.mean(batched_traces, 1)
  return (np.std(means) / np.sqrt(batches))

@ statfunc def mc_error ( x , batches = 5 ) : if ( x . ndim > 1 ) : dims = np . shape ( x ) trace = np . transpose ( [ t . ravel ( ) for t in x ] ) return np . reshape ( [ mc_error ( t , batches ) for t in trace ] , dims [ 1 : ] ) else : if ( batches == 1 ) : return ( np . std ( x ) / np . sqrt ( len ( x ) ) ) try : batched_traces = np . resize ( x , ( batches , int ( ( len ( x ) / batches ) ) ) ) except ValueError : resid = ( len ( x ) % batches ) new_shape = ( batches , ( ( len ( x ) - resid ) / batches ) ) batched_traces = np . resize ( x [ : ( - resid ) ] , new_shape ) means = np . mean ( batched_traces , 1 ) return ( np . std ( means ) / np . sqrt ( batches ) )
calculates the simulation standard error .