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
d29191bc
Verified
Commit
d29191bc
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
add scanner_constraints!
parent
6d0bd6f1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/all_building_blocks/building_blocks.jl
+1
-1
1 addition, 1 deletion
src/all_building_blocks/building_blocks.jl
src/variables.jl
+34
-2
34 additions, 2 deletions
src/variables.jl
with
35 additions
and
3 deletions
src/all_building_blocks/building_blocks.jl
+
1
−
1
View file @
d29191bc
module
BuildingBlocks
import
LinearAlgebra
:
norm
import
..
BaseBuildingBlocks
:
BaseBuildingBlock
,
events
,
waveform_sequence
import
...
Variables
:
VariableType
,
duration
,
make_generic
,
get_pulse
,
get_readout
import
...
Variables
:
VariableType
,
duration
,
make_generic
,
get_pulse
,
get_readout
,
scanner_constraints!
import
...
Components
:
BaseComponent
,
DelayedEvent
,
RFPulseComponent
,
ReadoutComponent
"""
...
...
This diff is collapsed.
Click to expand it.
src/variables.jl
+
34
−
2
View file @
d29191bc
...
...
@@ -13,8 +13,8 @@ In addition this defines:
"""
module
Variables
import
JuMP
:
@constraint
,
@variable
,
Model
,
@objective
,
objective_function
,
value
,
AbstractJuMPScalar
import
..
Scanners
:
gradient_strength
,
slew_rate
import
..
BuildSequences
:
global_model
import
..
Scanners
:
gradient_strength
,
slew_rate
,
Scanner
import
..
BuildSequences
:
global_model
,
global_scanner
"""
Parent type of all components, building block, and sequences that form an MRI sequence.
...
...
@@ -323,4 +323,36 @@ Returns a generic version of the `BaseSequence`, `BaseBuildingBlock`, or `BaseCo
"""
function
make_generic
end
"""
scanner_constraints!(block)
Constraints [`gradient_strength`](@ref) and [`slew_rate`](@ref) to be less than the [`global_scanner`](@ref) maximum.
"""
function
scanner_constraints!
(
bb
::
AbstractBlock
)
try
global_scanner
()
catch
e
return
end
for
f
in
(
gradient_strength
,
slew_rate
)
try
value
=
gradient_strength
(
bb
)
catch
e
if
e
isa
VariableNotAvailable
continue
else
rethrow
()
end
end
if
value
isa
AbstractVector
for
v
in
value
@constraint
global_model
()
v
<=
f
(
global_scanner
())
end
else
@constraint
global_model
()
value
<=
f
(
global_scanner
())
end
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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