Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91461981
graphs.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
Mon, Nov 11, 08:51
Size
3 KB
Mime Type
text/x-python
Expires
Wed, Nov 13, 08:51 (2 d)
Engine
blob
Format
Raw Data
Handle
22266509
Attached To
R4670 PySONIC (old)
graphs.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Date: 2017-06-14 18:37:45
# @Email: theo.lemaire@epfl.ch
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2017-09-12 18:51:18
''' Test the basic functionalities of the package and output graphs of the call flows. '''
import
logging
from
pycallgraph
import
PyCallGraph
from
pycallgraph.output
import
GraphvizOutput
from
PointNICE.utils
import
logger
from
PointNICE
import
BilayerSonophore
,
SolverUS
,
SolverElec
from
PointNICE.channels
import
CorticalRS
# Set logging level
logger
.
setLevel
(
logging
.
DEBUG
)
# Create Graphviz output object
graphviz
=
GraphvizOutput
()
def
graph_BLS
():
logger
.
info
(
'Graph 1: BLS initialization'
)
a
=
32e-9
# nm
Fdrive
=
3.5e5
# Hz
Cm0
=
1e-2
# membrane resting capacitance (F/m2)
Qm0
=
-
80e-5
# membrane resting charge density (C/m2)
graphviz
.
output_file
=
'graphs/bls_init.png'
with
PyCallGraph
(
output
=
graphviz
):
bls
=
BilayerSonophore
(
a
,
Fdrive
,
Cm0
,
Qm0
)
logger
.
info
(
'Graph 2: Mechanical simulation'
)
Adrive
=
1e5
# Pa
graphviz
.
output_file
=
'graphs/MECH_sim.png'
with
PyCallGraph
(
output
=
graphviz
):
bls
.
runMech
(
Fdrive
,
Adrive
,
Qm0
)
def
graph_neuron_init
():
logger
.
info
(
'Graph 1: Channels mechanism initialization'
)
graphviz
.
output_file
=
'graphs/RS_neuron_init.png'
with
PyCallGraph
(
output
=
graphviz
):
CorticalRS
()
def
graph_ESTIM
():
rs_neuron
=
CorticalRS
()
logger
.
info
(
'Graph 1: SolverElec initialization'
)
graphviz
.
output_file
=
'graphs/ESTIM_solver_init.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
=
SolverElec
()
logger
.
info
(
'Graph 2: E-STIM simulation'
)
Astim
=
1.0
# mA/m2
tstim
=
1e-3
# s
toffset
=
1e-3
# s
graphviz
.
output_file
=
'graphs/ESTIM_sim.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
.
run
(
rs_neuron
,
Astim
,
tstim
,
toffset
)
def
graph_ASTIM
():
rs_neuron
=
CorticalRS
()
a
=
32e-9
# nm
Fdrive
=
3.5e5
# Hz
Adrive
=
1e5
# Pa
logger
.
info
(
'Graph 1: SolverUS initialization'
)
graphviz
.
output_file
=
'graphs/ASTIM_solver_init.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
=
SolverUS
(
a
,
rs_neuron
,
Fdrive
)
logger
.
info
(
'Graph 2: A-STIM classic simulation'
)
tstim
=
1e-6
# s
toffset
=
0.0
# s
graphviz
.
output_file
=
'graphs/ASTIM_sim_classic.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
.
run
(
rs_neuron
,
Fdrive
,
Adrive
,
tstim
,
toffset
,
sim_type
=
'classic'
)
logger
.
info
(
'Graph 3: A-STIM effective simulation'
)
tstim
=
1e-3
# s
toffset
=
0.0
# s
graphviz
.
output_file
=
'graphs/ASTIM_sim_effective.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
.
run
(
rs_neuron
,
Fdrive
,
Adrive
,
tstim
,
toffset
,
sim_type
=
'effective'
)
logger
.
info
(
'Graph 4: A-STIM hybrid simulation'
)
tstim
=
1e-3
# s
toffset
=
0.0
# s
graphviz
.
output_file
=
'graphs/ASTIM_sim_hybrid.png'
with
PyCallGraph
(
output
=
graphviz
):
solver
.
run
(
rs_neuron
,
Fdrive
,
Adrive
,
tstim
,
toffset
,
sim_type
=
'hybrid'
)
if
__name__
==
'__main__'
:
logger
.
info
(
'Starting graphs'
)
graph_BLS
()
graph_neuron_init
()
graph_ESTIM
()
graph_ASTIM
()
logger
.
info
(
'All graphs successfully created'
)
Event Timeline
Log In to Comment