Skip to content

Commit e8aafc0

Browse files
author
arismav
committed
add SRCPMG
1 parent 6f339b0 commit e8aafc0

File tree

8 files changed

+30
-19
lines changed

8 files changed

+30
-19
lines changed

docs/src/types_structs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SR
2020
CPMG
2121
PFG
2222
IRCPMG
23+
SRCPMG
2324
CPMGCPMG
2425
```
2526

ext/gui_2D.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,24 @@ function Makie.plot!(fig::Union{Makie.Figure,Makie.GridPosition}, res::NMRInvers
8383
x = res.X_indirect
8484
y = res.X_direct
8585

86-
xlbl = if seq == IRCPMG
86+
xlbl = if seq in (IRCPMG, SRCPMG)
8787
L"T_1 \, \textrm{(s)}"
8888
elseif seq == PFGCPMG
8989
L"D \, \textrm{(m^2/s)}"
9090
elseif seq == CPMGCPMG
9191
L"T_{2A} \,\textrm{(s)}"
9292
end
9393

94-
ylbl = if seq in [IRCPMG, PFGCPMG]
94+
ylbl = if seq in (IRCPMG, SRCPMG, PFGCPMG)
9595
L"T_2 \,\textrm{(s)}"
9696
elseif seq == CPMGCPMG
9797
L"T_{2B} \,\textrm{(s)}"
9898
end
9999

100-
x_low = seq in (IRCPMG, CPMGCPMG) ? exp10(floor(log10(min(x[1],y[1])))) : exp10(floor(log10(x[1])))
101-
x_high = seq in (IRCPMG, CPMGCPMG) ? exp10(ceil(log10(max(x[end],y[end])))) : exp10(ceil(log10(x[end])))
102-
y_low = seq in (IRCPMG, CPMGCPMG) ? exp10(floor(log10(min(x[1],y[1])))) : exp10(floor(log10(y[1])))
103-
y_high = seq in (IRCPMG, CPMGCPMG) ? exp10(ceil(log10(max(x[end],y[end])))) : exp10(ceil(log10(y[end])))
100+
x_low = seq in (IRCPMG, SRCPMG, CPMGCPMG) ? exp10(floor(log10(min(x[1],y[1])))) : exp10(floor(log10(x[1])))
101+
x_high = seq in (IRCPMG, SRCPMG, CPMGCPMG) ? exp10(ceil(log10(max(x[end],y[end])))) : exp10(ceil(log10(x[end])))
102+
y_low = seq in (IRCPMG, SRCPMG, CPMGCPMG) ? exp10(floor(log10(min(x[1],y[1])))) : exp10(floor(log10(y[1])))
103+
y_high = seq in (IRCPMG, SRCPMG, CPMGCPMG) ? exp10(ceil(log10(max(x[end],y[end])))) : exp10(ceil(log10(y[end])))
104104

105105
gr = fig[1:10, 1:10] = GridLayout()
106106

@@ -207,7 +207,7 @@ function draw_on_axes(
207207
markers = collect('a':'z')
208208
colors = cgrad(:tab10)
209209

210-
if res.seq in (IRCPMG, CPMGCPMG)
210+
if res.seq in (IRCPMG, SRCPMG, CPMGCPMG)
211211
plot_diagonal(axmain,x,y)
212212
end
213213

@@ -224,7 +224,7 @@ function draw_on_axes(
224224
xc = xdist x / sum(spo)
225225
yc = ydist y / sum(spo)
226226

227-
lbl = if res.seq == IRCPMG
227+
lbl = if res.seq in (IRCPMG, SRCPMG)
228228
"T₁/T₂ = $(round(wa_indir[i]/wa_dir[i] , digits=1)) \nVolume = $(round(volumes[i] *100 ,digits = 1))%"
229229
elseif res.seq == PFGCPMG
230230
"D = $(round(wa_indir[i], sigdigits=3)), T₂ = $(round(wa_dir[i], sigdigits=3))\nVolume = $(round(volumes[i] *100 ,digits = 1))%"
@@ -349,15 +349,15 @@ function Makie.plot(res::NMRInversions.inv_out_2D)
349349
coord_label = Observable("")
350350
coord_label[] = "Hover mouse over plot to view coordinates."
351351

352-
xlbl = if res.seq == IRCPMG
352+
xlbl = if res.seq in (IRCPMG, SRCPMG)
353353
"T₁"
354354
elseif res.seq == PFGCPMG
355355
"D"
356356
elseif res.seq == CPMGCPMG
357357
"T₂ₐ"
358358
end
359359

360-
ylbl = if res.seq in [IRCPMG, PFGCPMG]
360+
ylbl = if res.seq in (IRCPMG, SRCPMG, PFGCPMG)
361361
"T₂"
362362
elseif res.seq == CPMGCPMG
363363
"T₂ᵦ"

ext/gui_data.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function Makie.plot(data::NMRInversions.input2D)
9191
ax_dir.xlabel = "time (s)"
9292
ax_full.xlabel = "time (s)"
9393

94-
if data.seq in (IRCPMG, CPMGCPMG)
94+
if data.seq in (IRCPMG, SRCPMG, CPMGCPMG)
9595
ax_indir.xlabel = "time (s)"
9696
ax_full.ylabel = "time (s)"
9797
elseif data.seq == PFGCPMG

src/import_data.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ function import_tnt(seq::Type{<:Union{pulse_sequence1D, pulse_sequence2D}},
203203
x = read_tnt_echo_times(filename, length(y), echotime)
204204
return autophase(input1D(seq, x, y))
205205

206-
elseif seq in (IRCPMG, CPMGCPMG)
206+
elseif seq in (IRCPMG, CPMGCPMG, SRCPMG)
207207

208208
data_mat = reshape(y , :, header["actual_points_2d"])
209209
x_dir = read_tnt_echo_times(filename, size(data_mat,1), echotime)

src/inversion_functions.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ function invert(
150150
end
151151

152152
if isa(lims2, Type{<:pulse_sequence2D})
153-
if lims2 in (IRCPMG, CPMGCPMG)
154-
X_indirect = collect(NMRInversions.logrange(minimum(x_indirect)/7, maximum(x_indirect)*7, 64))
155-
elseif lims2 == PFGCPMG
153+
if lims2 == PFGCPMG
156154
X_indirect = collect(NMRInversions.logrange(minimum(x_indirect)*7, maximum(x_indirect)*10, 64))
155+
else
156+
X_indirect = collect(NMRInversions.logrange(minimum(x_indirect)/7, maximum(x_indirect)*7, 64))
157157
end
158158
elseif isa(lims2, Tuple)
159159
X_indirect = exp10.(range(lims2...))

src/kernels.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ function create_kernel(seq::Type{<:pulse_sequence2D},
139139
elseif seq == PFGCPMG
140140
K_dir = create_kernel(CPMG, x_direct, X_direct, y = vec(Data[:,1]))
141141
K_indir = create_kernel(PFG, x_indirect, X_indirect, y = vec(Data[1,:]))
142+
elseif seq == SRCPMG
143+
K_dir = create_kernel(CPMG, x_direct, X_direct, y = vec(Data[:,end]))
144+
K_indir = create_kernel(SR, x_indirect, X_indirect, y = vec(Data[1,:]))
142145
elseif seq == CPMGCPMG
143146
K_dir = create_kernel(CPMG, x_direct, X_direct, y = vec(Data[:,1]))
144147
K_indir = create_kernel(CPMG, x_indirect, X_indirect, y = vec(Data[1,:]))

src/misc.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function autophase(data::input2D; rotation::Real=0)
104104

105105
if data.seq in (PFGCPMG, CPMGCPMG) && d < 0
106106
return autophase(data, rotation = pi)
107-
elseif data.seq in (IRCPMG,) && d > 0
107+
elseif data.seq in (IRCPMG, SRCPMG) && d > 0
108108
return autophase(data, rotation = pi)
109109
end
110110
end
@@ -225,7 +225,7 @@ function weighted_averages(r::inv_out_2D; silent::Bool = false)
225225
volumes[i] = sum(spo)/sum(z)
226226

227227
dir_lbl = ["<T₂>","s"]
228-
ind_lbl = if r.seq == IRCPMG
228+
ind_lbl = if r.seq in (IRCPMG, SRCPMG)
229229
["<T₁>","s"]
230230
elseif r.seq == PFGCPMG
231231
["<D>", "m²/s"]
@@ -235,7 +235,7 @@ function weighted_averages(r::inv_out_2D; silent::Bool = false)
235235
display("Selection $(collect('a':'z')[i]) :")
236236
display(ind_lbl[1] * " = $(round(wa_indir[i], sigdigits=4)) "*ind_lbl[2])
237237
display(dir_lbl[1] * " = $(round(wa_dir[i], sigdigits=4)) "*dir_lbl[2])
238-
if r.seq == IRCPMG
238+
if r.seq in (IRCPMG, SRCPMG)
239239
display("T₁/T₂ = $(round(wa_indir[i]/wa_dir[i], sigdigits=2)) ")
240240
end
241241
display("Volume = $(round(volumes[i], sigdigits=4) * 100) %")

src/types.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## The following are custom types, defined mainly for multiple dispatch purposes
22

33
export pulse_sequence1D, pulse_sequence2D
4-
export IR, SR, CPMG, PFG, IRCPMG, PFGCPMG, CPMGCPMG
4+
export IR, SR, CPMG, PFG, IRCPMG, SRCPMG, PFGCPMG, CPMGCPMG
55
export alpha_optimizer, regularization_solver
66

77
abstract type pulse_sequence1D end
@@ -44,6 +44,13 @@ It can be used wherever the `seq` argument is required.
4444
"""
4545
struct IRCPMG <: pulse_sequence2D end
4646

47+
"""
48+
Saturation recovery - CPMG pulse sequence for 2D relaxation experiments (T1-T2).
49+
The direct dimension is the T2, and the indirect dimension is the T1 acquisition times.
50+
It can be used wherever the `seq` argument is required.
51+
"""
52+
struct SRCPMG <: pulse_sequence2D end
53+
4754
"""
4855
PFG - CPMG pulse sequence for 2D D-T2 experiments.
4956
It can be used wherever the `seq` argument is required.

0 commit comments

Comments
 (0)