bootstr(func, data, numb_samples, sample_size=None, same_rand_for_obs=False, conf_axis=1, return_sample=False, seed=None, err_by_dist=False, args=(), nproc=6):
'''
Bootstrap for arbitrary functions. This routine resamples the data and passes them to the function in the same
format as in the input. So the idea is to write a function that computes an observable from a given data set. This
function can be put into this bootstrap routine and will get bootstrap samples as input. Based on the output of the
function, the bootstrap mean and error are computed. The function may return multiple observables that are either
scalars or numpy objects. You can pass a multidimensional object as data, but the bootstrap function has to know
which axis should be resampled which is controlled by conf_axis (default = 0 for one dimensional arrays and
default = 1 for higher order arrays.)
Parameters
----------
func : callable
The function that calculates the observable
data : array_like
Input data
numb_samples : integer
Number of bootstrap samples
sample_size : integer, optional, default = 0
Size of sample
same_rand_for_obs : boolean, optional, default = False
Use the same random numbers for each observable accessed by index conf_axis - 1. Please note:
- Objects that are accessed by an axis >= conf_axis + 1 do always have the same random numbers.
- Objects that are accessed by axis conf_axis < conf_axis - 1 never share the same random numbers.
conf_axis : integer, optional, default = 0 for dim(data) = 1 or default = 1 for dim(data) >= 2
Axis that should be resampled
return_sample : boolean, optional, default = False
Along with the mean and the error also return the results from the individual samples
seed: integer, optional, default = None
seed for the random generator. If None, the default seed from numpy is used (probably from time)
same_rand_for_obs : boolean, optional, default = False
same random numbers per observable
err_by_dist : boolean, optional, default = False
Compute the error from the distribution using the median and the 68% quantile
args : array_like or dict, default = ()
optional arguments to be passed to func. If a dictionary the are passed as **args.
nproc : integer
Number of threads to use if you choose to parallelize. nproc=1 turns off parallelization.
'''