ClipGaussianJitter#
- class ClipGaussianJitter(scalar=0.02, store_jitter=False)[source]#
Bases:
objectAdd isotropic clipped multivariate-Gaussian noise to
coord.Samples 3D noise from a standard multivariate normal, clips it to roughly +/-
1.96sigma (the storedquantile), scales byscalar, and adds it tocoordin place. Optionally records the applied noise under thejitterkey. Requirescoord; a no-op ifcoordis absent. Registered asClipGaussianJitter– use this string as thetypein atransform=[...]config list.- Parameters:
scalar (float) – multiplier applied to the clipped unit noise, setting the jitter magnitude. Defaults to
0.02.store_jitter (bool) – if
True, save the applied per-point noise underdata_dict["jitter"]. Defaults toFalse.
Note
Assumes 3D coordinates (the noise covariance is the 3x3 identity).
Example
>>> import numpy as np >>> from pimm.datasets.transform import ClipGaussianJitter >>> data = {"coord": np.zeros((2, 3), dtype="f4")} >>> # NOTE: as written the constructor sets mean = np.mean(3) (a scalar), >>> # so the multivariate-normal draw raises before any jitter is applied: >>> ClipGaussianJitter(scalar=0.02)(data) Traceback (most recent call last): ... ValueError: mean must be 1 dimensional