Scan.chunks

Contents

Scan.chunks#

Scan.chunks()[source]#

Play the scan in spans of whole blocks; yield each once released.

The spans are simulated in a thread of their own, ahead of their release. The sound is pypulseqpp.gradient_sound() of the gradients along the physical axes, as Sequence.sound makes it of a design: the spans’ sounds, joined, are the sound of the whole scan, floor(duration * sample_rate) + 1 samples scaled so that the loudest is 0.95.

Parameters:
  • length – The scan time a span lasts at least, in s, unless it ends the scan.

  • speed – How many times as fast as a scanner the scan is played. Its clock starts once the simulation, at the rate it has run, stays ahead of the clock to the end of the scan, and each span is yielded once the clock has passed its end. A span not yet simulated by then holds the clock until it is. As fast as the spans are simulated when None.

  • sound – Whether the spans carry their sound.

  • sample_rate – Audio sample rate, in Hz.

  • channel_weights – Weights of the x, y and z axes in the sound.

  • preparing – Called about twice a second until the clock starts, at a speed, with the wall-clock time left before it does, in s, or None before a span of each kind still to come has been simulated. An exception it raises ends the scan, and is raised where the spans are taken.

Raises:

ValueError – If length or speed is not positive.