Prewhiten

Contents

Prewhiten#

class pulserver.recon.Prewhiten[source]#

Bases: Gadget

Whiten the channels of each readout with the stream’s noise measurement.

Readouts flagged IS_NOISE_MEASUREMENT are collected and consumed: no unit receives them. At the first readout that is not noise, the whitening matrix W is computed from the collected samples, with W Ψ W^H = I for their channel covariance Ψ (bartorch.tools.whiten()), and is stored in context.noise. Every readout of the stream, that one included, is then multiplied by W from the left, so the noise of the whitened channels has unit covariance. A readout whose sample_time_us differs from that of the noise readouts is also multiplied by the square root of the ratio of the two, the noise variance of a sample being inversely proportional to its dwell time. Noise readouts after that first readout are consumed and not used.

Without noise readouts, W is the exam’s NOISE_COVARIANCE, which startup() loads when its coil labels are those of the header. With neither, readouts pass unchanged and a warning is logged once. A plugin that rejects noise readouts with reject_flags gives the gadget no noise to estimate from. bartorch is imported when W is computed; the coils extra installs it.

Corresponds to Gadgetron’s NoiseAdjustGadget.

Parameters:

required – Raise MissingCalibration, rather than log a warning, at the first readout that is not noise when there is no W to apply.

Raises:

ValueError – From a call, if the collected noise has at most as many samples as channels, or a readout does not have the channels of W.

Methods

publish

Store the whitening of the stream as the exam's NOISE_COVARIANCE.

startup

Prepare for one stream; the default stores context, so overrides call it.