analysis.truncate_arrays

analysis.truncate_arrays(trace_array, prob_array=None)

Return slides of ESPEI output arrays with any empty remaining iterations (zeros) removed.

Parameters

Name Type Description Default
trace_array np.ndarray Array of the trace from an ESPEI run. Should have shape (chains, iterations, parameters) required
prob_array np.ndarray Array of the lnprob output from an ESPEI run. Should have shape (chains, iterations) None

Returns

Type Description
np.ndarry or (np.ndarray, np.ndarray) A slide of the zeros-removed trace array is returned if only the trace is passed. Otherwise a tuple of both the trace and lnprob are returned.

Examples

>>> from espei.analysis import truncate_arrays
>>> trace = np.array([[[1, 0], [2, 0], [3, 0], [0, 0]], [[0, 2], [0, 4], [0, 6], [0, 0]]])  # 3 iterations of 4 allocated
>>> truncate_arrays(trace).shape
(2, 3, 2)
Back to top