Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the same functions to sample RFs in the simulation than for plotting sequence #167

Closed
cncastillo opened this issue May 13, 2023 · 1 comment

Comments

@cncastillo
Copy link
Member

cncastillo commented May 13, 2023

We are currently using a different function to sample the RFs. In Sequence.jl:

get_rfs(seq::Sequence, t) = begin
	#Amplitude
	A  = seq.RF.A
	Δf = seq.RF.Δf
	#Timings
	T = seq.RF.T
	delay = seq.RF.delay
	T0 = cumsum([0; durs(seq)], dims=1)
	(sum([(A[1,i], t.-T0[i],sum(T[i]).-2EPS,EPS,EPS,delay[i]) for i=1:length(seq)]),
	 sum([(Δf[1,i],t.-T0[i],sum(T[i]).-2EPS,EPS,EPS,delay[i]) for i=1:length(seq)])
	)
end

while the gradients use

function get_grads(seq, t::Vector)
    gx = get_theo_Gi(seq, 1)
    gy = get_theo_Gi(seq, 2)
    gz = get_theo_Gi(seq, 3)
    Gx = linear_interpolation(gx..., extrapolation_bc=0)(t)
    Gy = linear_interpolation(gy..., extrapolation_bc=0)(t)
    Gz = linear_interpolation(gz..., extrapolation_bc=0)(t)
    (Gx, Gy, Gz)
end

and the get_theo_Gi are the same functions used in plot_seq, besides the interpolation (that it would be nice to remove as well 😄).

This does not generate any simulation inaccuracies (that we know of), but it would be nice to be sure that what we see in plot_seq is the same as the simulated sequence.

@cncastillo
Copy link
Member Author

I believe that this one has already been solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant