Skip to content

Problem Init

Helper Functions

These helper functions set all necessary parameters to define the problem. They define some common usage patterns for optimization, such as fully optimized waveforms that start and end at 0 (vec_init_simple), or the optimization of diffusion waveforms (diff_init).

gropt.GroptParams

Problem definition for GrOpt gradient optimization.

This class holds the waveform dimensions, constraints, and objectives that define a gradient optimization problem.

vec_init_simple

vec_init_simple(N: int = -1, Naxis: int = -1, first_val: float = 0.0, last_val: float = 0.0) -> None

Initialize the set_vec and inv_vec settings.

Parameters:

Name Type Description Default
N int

Number of points in a single axis. Negative values use existing value.

-1
Naxis int

Number of axes. Negative values use existing value.

-1
first_val float

Fixed value for the first point [mT/m].

0.0
last_val float

Fixed value for the last point [mT/m].

0.0

diff_init

diff_init(dt: float = 0.0004, TE: float = 0.08, T_90: float = 0.003, T_180: float = 0.005, T_readout: float = 0.016) -> None

Initialize diffusion sequence parameters.

Parameters:

Name Type Description Default
dt float

Raster time in seconds.

0.0004
TE float

Echo time in seconds.

0.08
T_90 float

Duration of excitation RF pulse in seconds (time from excitation, so half of full RF pulse duration).

0.003
T_180 float

Duration of refocusing RF pulse in seconds.

0.005
T_readout float

Time to TE of the readout in seconds.

0.016

diff_init_deadtime

diff_init_deadtime(dt: float = 0.0004, TE: float = 0.08, T_90: float = 0.003, T_180: float = 0.005, T_readout: float = 0.016) -> None

Initialize diffusion sequence parameters, but with forced deadtime to make "convnetional" waveforms.

Parameters:

Name Type Description Default
dt float

Raster time in seconds.

0.0004
TE float

Echo time in seconds.

0.08
T_90 float

Duration of excitation RF pulse in seconds (time from excitation, so half of full RF pulse duration).

0.003
T_180 float

Duration of refocusing RF pulse in seconds.

0.005
T_readout float

Time to TE of the readout in seconds.

0.016

diff_init_preencode

diff_init_preencode(dt: float = 0.0004, TE: float = 0.08, T_90: float = 0.003, T_180: float = 0.005, T_readout: float = 0.016, T_pre: float = 0.0) -> int

Initialize diffusion sequence parameters with a pre-encoding period.

Parameters:

Name Type Description Default
dt float

Raster time in seconds.

0.0004
TE float

Echo time in seconds.

0.08
T_90 float

Duration of excitation RF pulse in seconds (time from excitation, so half of full RF pulse duration).

0.003
T_180 float

Duration of refocusing RF pulse in seconds.

0.005
T_readout float

Time to TE of the readout in seconds.

0.016
T_pre float

Duration of the pre-encoding period in seconds.

0.0

Returns:

Type Description
int

Number of pre-encoding time points (N_pre).

Direct Setup

The individual components of the problem definition are:

Name Description
N The number of points of the waveform, per-axis
Naxis Number of axes
dt Gradient raster time [seconds]
set_vec A vector that contains either gradient values or NaN, which describes if a given point in the waveform has a fixed value, or is optimizable (NaN)
inv_vec A vector of either 1 or -1 describing which points of the waveform have been RF inverted
X0 An initial guess at the solution waveform

Many of these will be automatically generated for the simplest options if omitted.

gropt.GroptParams

Problem definition for GrOpt gradient optimization.

This class holds the waveform dimensions, constraints, and objectives that define a gradient optimization problem.

set_ils_solver

set_ils_solver(ils_method: str = 'CG') -> None

Set the indirect solver method.

Parameters:

Name Type Description Default
ils_method str

Solver method: 'CG', 'NLCG', or 'BiCGstabl' (case-sensitive).

'CG'