Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F88738211
convert.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Oct 20, 10:50
Size
844 B
Mime Type
text/x-python
Expires
Tue, Oct 22, 10:50 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21814082
Attached To
rPYPULSEQ pypulseq
convert.py
View Options
from
math
import
pi
def
convert_from_to
(
from_value
,
from_unit
):
if
isinstance
(
from_value
,
float
)
and
isinstance
(
from_unit
,
str
):
gamma
,
standard
=
42.576e6
,
0
# Converting gradient
if
from_unit
==
'Hz/m'
:
standard
=
from_value
elif
from_unit
==
'mT/m'
:
standard
=
from_value
*
1e-3
*
gamma
elif
from_unit
==
'rad/ms/mm'
:
standard
=
from_value
*
1e6
/
(
2
*
pi
)
# Converting slew rate
elif
from_unit
==
'Hz/m/s'
:
standard
=
from_value
elif
from_unit
==
'mT/m/ms'
or
'T/m/s'
:
standard
=
from_value
*
gamma
elif
from_unit
==
'rad/ms/mm/ms'
:
standard
=
from_value
*
1e9
/
(
2
*
pi
)
return
standard
else
:
raise
TypeError
(
"input parameters_params should be: from_value, from_unit"
)
Event Timeline
Log In to Comment