rf_definition#
- torchsim.rf_definition(waveform, *, dwell_s, bandwidth_hz=0.0, definition_id=0, band_frequency_offsets_hz=None, band_bandwidth_hz=None, rf_raster_time_s=1e-6)[source]#
Return the definition of a pulse from the envelope a scanner plays.
The envelope is whatever a designer or a Pulseq block hands over – a complex waveform on a uniform raster, in any amplitude units, one row per transmit channel where there is more than one. What it is scaled to does not matter and must not be relied on: it is rescaled here so that its integral is
1 / (2 pi)seconds, which is what makes an event’s amplitude, written in radians, the flip that event turns. A pulse handed over peak-normalized and left that way turns a fraction of a degree and returns a signal of nothing, which is the one mistake this exists to stop.The pulse’s own phase is kept rather than divided out, so a linear-phase pulse keeps the axis it turns about.
- Parameters:
waveform (array-like) – The complex envelope,
(samples,)or(channels, samples).dwell_s (float) – How long one sample is held, in seconds.
bandwidth_hz (float, optional) – The pulse’s bandwidth, which the slice select is quoted against. Zero – the default – is a pulse that selects nothing and stays on the instant operator, and a non-zero one is what makes a pulse slice selective. There is no separate flag for that, here or in the stream a description arrives on.
definition_id (int, optional) – The identifier events name this pulse by.
band_frequency_offsets_hz (sequence of float, optional) – Where each band sits, for a multiband pulse. One band at zero when not given.
band_bandwidth_hz (float, optional) – The bandwidth of one band, defaulting to
bandwidth_hz.rf_raster_time_s (float, optional) – The raster the sample times are written against, which is the one the run will read them back with. Sample times are carried in units of it rather than in seconds, so a pulse whose dwell is not the raster still says how long it lasts.
- Returns:
The pulse, scaled so an event amplitude in radians is a flip in radians.
- Return type:
RfDefinition
- Raises:
ValueError – If the envelope is empty, if
dwell_sis not positive, or if the waveform integrates to nothing and so has no flip angle to be read against.