Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64234108
ASTIM_lookups.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
Sat, May 25, 12:43
Size
1 KB
Mime Type
text/x-python
Expires
Mon, May 27, 12:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17871212
Attached To
R4670 PySONIC (old)
ASTIM_lookups.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Date: 2017-06-02 17:50:10
# @Email: theo.lemaire@epfl.ch
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2018-03-16 11:48:22
""" Create lookup tables for different acoustic frequencies. """
import
logging
import
numpy
as
np
import
PointNICE
from
PointNICE.utils
import
logger
,
InputError
from
PointNICE.neurons
import
*
# Set logging level
logger
.
setLevel
(
logging
.
INFO
)
# Sonophore diameter (m)
a
=
32e-9
# Channel mechanisms
neurons
=
[
CorticalRS
()]
# Stimulation parameters
freqs
=
np
.
array
([
20.
,
100.
,
500.
,
1000.
,
2000.
,
3000.
,
4000.
])
*
1e3
# Hz
amps
=
np
.
logspace
(
np
.
log10
(
0.1
),
np
.
log10
(
600
),
num
=
50
)
*
1e3
# Pa
amps
=
np
.
insert
(
amps
,
0
,
0.0
)
# adding amplitude 0
logger
.
info
(
'Starting batch lookup creation'
)
for
neuron
in
neurons
:
# Create a SolverUS instance (with dummy frequency parameter)
solver
=
PointNICE
.
SolverUS
(
a
,
neuron
,
0.0
)
# Create lookup file
try
:
status
=
solver
.
createLookup
(
neuron
,
freqs
,
amps
)
if
status
==
-
1
:
logger
.
info
(
'Lookup creation canceled'
)
elif
status
==
1
:
logger
.
info
(
'
%s
Lookup table successfully created'
,
neuron
.
name
)
except
InputError
as
err
:
logger
.
error
(
err
)
Event Timeline
Log In to Comment