EnergyJitter#
- class EnergyJitter(p=0.5, jitter_ratio=0.005, min_val=0.0)[source]#
Bases:
objectApply multiplicative per-point jitter to energy.
With probability
pand when"energy"is present, scales each point’s energy by1 + U(-jitter_ratio, jitter_ratio)then lower-clips tomin_val; modifiesdata_dict["energy"]in place. Registered asEnergyJitter— use this string as thetypein atransform=[...]config list.- Parameters:
p (float) – Probability of applying the transform. Defaults to
0.5.jitter_ratio (float) – Half-width of the multiplicative jitter applied to energy. Defaults to
0.005.min_val (float) – Lower clip applied after jittering. Defaults to
0.0.
Example
>>> import numpy as np >>> np.random.seed(0) >>> data = {"energy": np.array([[1.0], [2.0]], dtype="f4")} >>> EnergyJitter(p=1.0, jitter_ratio=0.1)(data)["energy"].round(4) array([[1.043 ], [2.0411]], dtype=float32) # each point scaled by 1 +/- jitter