bartorch.optim.data_scaling#
- bartorch.optim.data_scaling(y, *, A=None, percentile=None, compat=False)#
The number
picsdivides its data by before solving.Dividing by it makes a regularization weight independent of the data’s overall scale.
- Parameters:
y (torch.Tensor) – Data as the solve will see it: for a Cartesian encoding, after the sampling pattern and
fftmod(..., inverse=True). Coils on their own axis, in the layoutbartorch.tools.pics()takes rather than the squeezed one an operator takes: the estimate is read off the k-space centre, which a misplaced coil axis moves.A (LinearOperator, optional) – The encoding. With one, the estimate
picsmakes for a trajectory: the spread of|A^H y|from its order statistics. Without one, the k-space-centre estimate ofbart estscaling, whichpicsuses for a Cartesian encoding.percentile (float, optional) – Take this percentile of the sorted magnitudes instead of BART’s rule (
estscaling -p;picshas no flag for it).compat (bool) – Take the median, as BART’s older estimate did. Only with
A.
- Returns:
The scaling. Zero means the estimate failed;
picsthen warns and uses one.- Return type:
float
Notes
The solution of a solve on scaled data is scaled too;
picsleaves it so.pics -w 1disables the scaling, which makes a solve assembled without this function comparable to the tool.Examples
>>> y = bartorch.fftmod(kspace * pattern, axes=(-1, -2, -3), inverse=True) >>> scale = optim.data_scaling(y) >>> x = optim.FISTA(prox.Wavelet((-1, -2), 0.01))((y / scale).squeeze(1), A)