Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65546322
run_mech.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
Tue, Jun 4, 14:13
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jun 6, 14:13 (2 d)
Engine
blob
Format
Raw Data
Handle
18091798
Attached To
R4670 PySONIC (old)
run_mech.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Date: 2016-11-21 10:46:56
# @Email: theo.lemaire@epfl.ch
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2019-06-07 14:58:39
''' Run simulations of the NICE mechanical model. '''
import
matplotlib.pyplot
as
plt
from
PySONIC.core
import
BilayerSonophore
,
Batch
from
PySONIC.utils
import
logger
from
PySONIC.plt
import
SchemePlot
from
PySONIC.parsers
import
MechSimParser
def
main
():
# Parse command line arguments
parser
=
MechSimParser
()
args
=
parser
.
parse
()
logger
.
setLevel
(
args
[
'loglevel'
])
# Run MECH batch
logger
.
info
(
"Starting mechanical simulation batch"
)
pkl_filepaths
=
[]
for
a
in
args
[
'radius'
]:
for
d
in
args
[
'embedding'
]:
for
Cm0
in
args
[
'Cm0'
]:
for
Qm0
in
args
[
'Qm0'
]:
bls
=
BilayerSonophore
(
a
,
Cm0
,
Qm0
,
embedding_depth
=
d
)
queue
=
bls
.
simQueue
(
args
[
'freq'
],
args
[
'amp'
],
args
[
'charge'
])
for
item
in
queue
:
item
.
insert
(
0
,
args
[
'outputdir'
])
batch
=
Batch
(
bls
.
runAndSave
,
queue
)
pkl_filepaths
+=
batch
(
mpi
=
args
[
'mpi'
],
loglevel
=
args
[
'loglevel'
])
# Plot resulting profiles
if
args
[
'plot'
]
is
not
None
:
SchemePlot
(
pkl_filepaths
,
pltscheme
=
parser
.
parsePltScheme
(
args
))()
plt
.
show
()
if
__name__
==
'__main__'
:
main
()
Event Timeline
Log In to Comment