Open gsahonero opened 1 day ago
This is a good idea, we can check what DifferentialEquations.jl is doing, to try to follow their logic, not sure if putting the save_state_at
inside the simulation method would be the best, comparing it to putting save_state_at
as an optional argument in simulate
.
Observing how the transverse magnetization evolves throughout a given sequence for sequence design and educational purposes could be useful. The conceptual code would be something like:
results = simulate(phantom, seq, sys, sim_params = Dict{String, Any}("return_type"=>"full", "sim_method" => Bloch(save_state_at = t))
Wheret
references time points where we want to know the values of Mxy, andresults
is a tuple. The first element ofresults
has an array of states of size(length(t), n_spins)
and the second has the(Nx, Ny)
matrix thatreturn_type=>"mat"
returns.Moreover, we could write a function that allows the evolution to be visualized as with the motion phantom, i.e.,
plot_state_evolution(Xt)
WhereXt = results[1]
and the resulting plot shows the transverse magnetization per spin and includes a slider+play button for observing the evolution according to the time points declared int
.