Diagram#

class mrsd.Diagram(plot, channels)#

MR sequence diagram

Parameters:
  • plot – an instance of matplotlib axes (plot, subplot, etc.)

  • channels – sequence of channels names in the plot, from top to bottom

add(channel, event)#

Add an event to the specified channel.

adc(channel, *args, **kwargs)#

Add an ADC event to the specified channel.

echo(channel, *args, **kwargs)#

Add an echo event to the specified channel.

gradient(channel, *args, **kwargs)#

Add a gradient event to the specified channel.

multi_gradient(channel, *args, **kwargs)#

Add a multi-gradient event to the specified channel.

rf_pulse(channel, *args, **kwargs)#

Add an RF pulse event to the specified channel.

gaussian_pulse(channel, *args, **kwargs)#

Add a hard RF pulse event to the specified channel.

hard_pulse(channel, *args, **kwargs)#

Add a hard RF pulse event to the specified channel.

sinc_pulse(channel, *args, **kwargs)#

Add a sinc RF pulse event to the specified channel.

readout(adc_channel, gradient_channel, duration, echo_amplitude=1, gradient_amplitude=1, ramp=0, ramp_up=None, ramp_down=None, begin=None, end=None, center=None, adc_kwargs=None, echo_kwargs=None, gradient_kwargs=None)#

Add a readout block (echo, ADC and gradient)

Parameters:
  • adc_channel – channel of the echo and ADC

  • gradient_channel – channel of the gradient

  • duration – duration of the echo, ADC, and gradient flat-top

  • echo_amplitude – amplitude of the echo

  • gradient_amplitude – amplitude of the gradient flat-top

  • ramp,ramp_up,ramp_down – ramp durations of the gradient. Use ramp for symmetric gradients, and both ramp_up and ramp_down for asymmetric gradients

  • begin,end,center – time of the begin, end, or center of the echo/ADC. Only one must be specified.

  • adc_kwargs – extra parameters for the ADC event (e.g. style)

  • echo_kwargs – extra parameters for the echo event (e.g. style)

  • gradient_kwargs – extra parameters for the gradient event (e.g. style)

selective_pulse(pulse_channel, gradient_channel, duration, pulse_amplitude=1, gradient_amplitude=1, envelope=None, ramp=0, ramp_up=None, ramp_down=None, begin=None, end=None, center=None, pulse_kwargs=None, gradient_kwargs=None)#

Add a selective pulse block (pulse and gradient)

Parameters:
  • pulse_channel – channel of the RF pulse

  • gradient_channel – channel of the gradient

  • duration – duration of the pulse and gradient flat-top

  • pulse_amplitude – amplitude of the RF pulse

  • gradient_amplitude – amplitude of the gradient flat-top

  • envelope – envelope of the pulse (default to sinc)

  • ramp,ramp_up,ramp_down – ramp durations of the gradient. Use ramp for symmetric gradients, and both ramp_up and ramp_down for asymmetric gradients

  • begin,end,center – time of the begin, end, or center of the echo/ADC. Only one must be specified.

  • pulse_kwargs – extra parameters for the pulse event (e.g. style)

  • gradient_kwargs – extra parameters for the gradient event (e.g. style)

annotate(channel, x, y, text, **kwargs)#

Add an annotation

Parameters:
  • channel – channel to which the annotation is added

  • x – time of the annotation

  • y – relative position of the annotation in the channel

  • text – text of the annotation

  • kwargs – extra parameters passed to matplotlib.axes.Axes.text

interval(begin, end, y, label, color='k')#

Add a time interval annotation

Parameters:
  • begin,end – begin and end time of the interval

  • y – vertical position of the annotation

  • label – label of the annotation

  • color – color of the annotation label

y(channel)#

Return the y coordinate of the center of a channnel.