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 quantity 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
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 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|