utils
Utils submodule.
gaussfilter_friction(friction, pos, sigma, mode='nearest')
¶
Smoothes friction with a gaussian kernel and 'nearest' borders.
Parameters:
-
friction
(1d np.array
) –Array that contains the friction.
-
pos
(1d np.array
) –Positions corresponding to entries in friction array in nm.
-
sigma
(float
) –Standard deviation of gaussian kernel in nm.
-
mode
(Str
, default:'nearest'
) –options: ‘reflect’, ‘constant’, ‘nearest’, ‘mirror’, ‘wrap’ The mode parameter determines how the input array is extended beyond its boundaries. Default is ‘reflect’. Behavior for each option see scipy.ndimage.gaussian_filter1d
Returns:
-
1d np.array
–Smoothed friction.
Source code in src/dcTMD/utils/_smoothing.py
bootstrapping(estimator, func, descriptor, verbose=False)
¶
Perform a bootstrapping error analysis.
The bootstrapping error analysis is performed using a given function func
by drawing random work trajectories from the estimator
's WorkSet
instance with replacement. The quantity of interest is then calculated for
the new sample and stored in quantity_resampled
. This process is repeated
n_resamples
times, which is a key of the descriptor
dictionary. The
random number generator can be fed a seed
, the second key of the
descriptor
which is optional. Thirdly, a mode
must be in the
descriptor
, which can either be the string 'std' for a standard
distribution of the resampled quantitity or a number in the interval [0, 1)
which yields confidence intervals instead.
Parameters:
-
estimator
–Instance of a WorkEstimator.
-
func
(Callable
) –Function which takes a WorkSet instance as single argument and returns the the quantitity for which the bootstrapping error analysis is performed.
-
descriptor
(dict
) –Dictionary of the estimator which provides
mode
,n_resampled
andseed
as keys. -
verbose
(Optional[bool]
, default:False
) –Enables verbose mode.
Returns:
-
s_quantity
–Estimated error for the quantity returned by
func
. -
quantity_resampled
–Quantities returned by
func
for the resampled work trajectories.
Source code in src/dcTMD/utils/_bootstrapping.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|