Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MRIBuilder.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
MRIBuilder.jl
Commits
8fcd0756
Verified
Commit
8fcd0756
authored
11 months ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Get GenericPulse as subset of larger pulse
parent
540aede8
No related branches found
No related tags found
No related merge requests found
Pipeline
#23625
passed
11 months ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/pulses/generic_pulses.jl
+29
-0
29 additions, 0 deletions
src/components/pulses/generic_pulses.jl
test/test_sequences.jl
+4
-0
4 additions, 0 deletions
test/test_sequences.jl
with
33 additions
and
0 deletions
src/components/pulses/generic_pulses.jl
+
29
−
0
View file @
8fcd0756
...
@@ -41,6 +41,35 @@ function GenericPulse(time::AbstractVector{<:Number}, amplitude::AbstractVector{
...
@@ -41,6 +41,35 @@ function GenericPulse(time::AbstractVector{<:Number}, amplitude::AbstractVector{
return
GenericPulse
(
time
,
amplitude
,
(
time
.-
time
[
1
])
.*
(
frequency
*
360
)
.+
phase
,
effective_time
)
return
GenericPulse
(
time
,
amplitude
,
(
time
.-
time
[
1
])
.*
(
frequency
*
360
)
.+
phase
,
effective_time
)
end
end
"""
GenericPulse(pulse, t1, t2)
Creates a new [`GenericPulse`](@ref) by slicing another pulse between `t1` and `t2`
"""
function
GenericPulse
(
pulse
::
GenericPulse
,
t1
::
Number
,
t2
::
Number
)
if
t1
<
pulse
.
time
[
1
]
||
t2
>
pulse
.
time
[
end
]
error
(
"Cannot extrapolate GenericPulse"
)
end
use
=
t1
.<=
pulse
.
time
.<=
t2
tnew
=
pulse
.
time
[
use
]
anew
=
pulse
.
amplitude
[
use
]
pnew
=
pulse
.
phase
[
use
]
@show
tnew
[
end
],
anew
[
end
]
if
!
(
t1
≈
tnew
[
1
])
pushfirst!
(
tnew
,
t1
)
pushfirst!
(
anew
,
amplitude
(
pulse
,
t1
))
pushfirst!
(
pnew
,
phase
(
pulse
,
t1
))
elseif
!
(
t2
≈
tnew
[
end
])
push!
(
tnew
,
t2
)
push!
(
anew
,
amplitude
(
pulse
,
t2
))
push!
(
pnew
,
phase
(
pulse
,
t2
))
end
@show
tnew
[
end
],
anew
[
end
]
return
GenericPulse
(
tnew
.-
t1
,
anew
,
pnew
,
pulse
.
effective_time
-
t1
)
end
GenericPulse
(
pulse
::
RFPulseComponent
,
t1
::
Number
,
t2
::
Number
)
=
GenericPulse
(
make_generic
(
pulse
),
t1
,
t2
)
duration
(
fp
::
GenericPulse
)
=
maximum
(
fp
.
time
)
duration
(
fp
::
GenericPulse
)
=
maximum
(
fp
.
time
)
amplitude
(
fp
::
GenericPulse
)
=
maximum
(
abs
.
(
fp
.
amplitude
))
amplitude
(
fp
::
GenericPulse
)
=
maximum
(
abs
.
(
fp
.
amplitude
))
effective_time
(
pulse
::
GenericPulse
)
=
pulse
.
time
[
findmax
(
abs
.
(
pulse
.
amplitude
))]
effective_time
(
pulse
::
GenericPulse
)
=
pulse
.
time
[
findmax
(
abs
.
(
pulse
.
amplitude
))]
...
...
This diff is collapsed.
Click to expand it.
test/test_sequences.jl
+
4
−
0
View file @
8fcd0756
...
@@ -114,6 +114,10 @@
...
@@ -114,6 +114,10 @@
@test
flip_angle
(
pulse
)
≈
90.
@test
flip_angle
(
pulse
)
≈
90.
@test
iszero
(
phase
(
pulse
))
@test
iszero
(
phase
(
pulse
))
@test
isnothing
(
get_pulse
(
seq
,
10.
))
@test
isnothing
(
get_pulse
(
seq
,
10.
))
gp
=
GenericPulse
(
pulse
,
0.
,
1.
)
@test
gp
.
amplitude
[
1
]
≈
0.
atol
=
1e-8
@test
gp
.
amplitude
[
end
]
≈
amplitude
(
pulse
,
1.
)
rtol
=
1e-2
@test
all
(
iszero
.
(
gp
.
phase
))
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
35.
)
(
pulse
,
t_pulse
)
=
get_pulse
(
seq
,
35.
)
@test
1.1
<
t_pulse
<
1.2
@test
1.1
<
t_pulse
<
1.2
...
...
This diff is collapsed.
Click to expand it.
Michiel Cottaar
@ndcn0236
mentioned in commit
ff392286
·
11 months ago
mentioned in commit
ff392286
mentioned in commit ff392286cd121afab0d9227dbfa57c5e7639b899
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment