Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65262584
sims.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, Jun 2, 08:56
Size
1 KB
Mime Type
text/x-python
Expires
Tue, Jun 4, 08:56 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18038770
Attached To
R4670 PySONIC (old)
sims.py
View Options
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Email: theo.lemaire@epfl.ch
# @Date: 2020-04-17 16:09:42
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2020-04-18 13:51:23
''' Example script showing how to simulate a point-neuron model upon application
of both electrical and ultrasonic stimuli, with various temporal protocols.
'''
import
logging
import
matplotlib.pyplot
as
plt
from
PySONIC.utils
import
logger
from
PySONIC.neurons
import
getPointNeuron
from
PySONIC.core
import
NeuronalBilayerSonophore
,
ElectricDrive
,
AcousticDrive
from
PySONIC.core.protocols
import
*
from
PySONIC.plt
import
GroupedTimeSeries
# Set logging level
logger
.
setLevel
(
logging
.
INFO
)
# Define point-neuron model and corresponding neuronal bilayer sonophore model
pneuron
=
getPointNeuron
(
'RS'
)
a
=
32e-9
# sonophore radius (m)
nbls
=
NeuronalBilayerSonophore
(
a
,
pneuron
)
# Define electric and ultrasonic drives
ELdrive
=
ElectricDrive
(
20.
)
# mA/m2
USdrive
=
AcousticDrive
(
500e3
,
# Hz
100e3
)
# Pa
# Pulsing parameters
tburst
=
100e-3
# s
PRF
=
100.
# Hz
DC
=
0.5
# -
BRF
=
1.0
# Hz
nbursts
=
3
# -
# Protocols
protocols
=
[
CustomProtocol
([
10e-3
,
30e-3
,
50e-3
],
[
1.
,
2.
,
0.
],
100e-3
),
PulsedProtocol
(
tburst
,
1
/
BRF
-
tburst
,
PRF
=
PRF
,
DC
=
DC
),
BurstProtocol
(
tburst
,
PRF
=
PRF
,
DC
=
DC
,
BRF
=
BRF
,
nbursts
=
nbursts
)
]
# For each protocol
for
p
in
protocols
:
# Run simulation upon electrical stimulation, and plot results
data
,
meta
=
pneuron
.
simulate
(
ELdrive
,
p
)
GroupedTimeSeries
([(
data
,
meta
)])
.
render
()
# Run simulation upon ultrasonic stimulation, and plot results
data
,
meta
=
nbls
.
simulate
(
USdrive
,
p
)
GroupedTimeSeries
([(
data
,
meta
)])
.
render
()
# Show figures
plt
.
show
()
Event Timeline
Log In to Comment