|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -# reader.py --- |
3 |
| -# |
4 |
| -# Filename: reader.py |
5 |
| -# Description: |
| 2 | + |
6 | 3 | # Author: Subhasis Ray, Padraig Gleeson
|
7 | 4 | # Maintainer:
|
8 | 5 | # Created: Wed Jul 24 15:55:54 2013 (+0530)
|
9 |
| -# Version: |
10 |
| -# Last-Updated: 15 Jan 2018 |
11 |
| -# By: pgleeson |
12 |
| -# Update #: -- |
13 |
| -# URL: |
14 |
| -# Keywords: |
15 |
| -# Compatibility: |
16 |
| -# |
17 |
| -# |
18 |
| - |
19 |
| -# Commentary: |
20 |
| -# |
21 |
| -# |
22 |
| -# |
23 |
| -# |
24 |
| - |
25 |
| -# Change log: |
26 |
| -# |
27 |
| -# |
28 |
| -# |
29 |
| -# |
30 |
| -# This program is free software; you can redistribute it and/or |
31 |
| -# modify it under the terms of the GNU General Public License as |
32 |
| -# published by the Free Software Foundation; either version 3, or |
33 |
| -# (at your option) any later version. |
34 |
| -# |
35 |
| -# This program is distributed in the hope that it will be useful, |
36 |
| -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
37 |
| -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
38 |
| -# General Public License for more details. |
39 |
| -# |
40 |
| -# You should have received a copy of the GNU General Public License |
41 |
| -# along with this program; see the file COPYING. If not, write to |
42 |
| -# the Free Software Foundation, Inc., 51 Franklin Street, Fifth |
43 |
| -# Floor, Boston, MA 02110-1301, USA. |
44 |
| -# |
45 |
| -# |
46 | 6 |
|
47 | 7 | # Code:
|
48 | 8 | """Implementation of reader for NeuroML 2 models.
|
|
51 | 11 | TODO: handle morphologies of more than one segment...
|
52 | 12 |
|
53 | 13 | """
|
| 14 | +from __future__ import print_function, division, absolute_import |
54 | 15 |
|
55 |
| -from __future__ import print_function |
56 |
| -try: |
57 |
| - from future_builtins import zip, map |
58 |
| -except ImportError: |
59 |
| - pass |
60 |
| -import sys, os |
61 | 16 | import numpy as np
|
62 | 17 | from moose.neuroml2.hhfit import exponential2
|
63 | 18 | from moose.neuroml2.hhfit import sigmoid2
|
@@ -176,7 +131,7 @@ def __init__(self, verbose=False):
|
176 | 131 | self.nml_cells_to_moose = {} # NeuroML object to MOOSE object
|
177 | 132 | self.nml_segs_to_moose = {} # NeuroML object to MOOSE object
|
178 | 133 | self.nml_chans_to_moose = {} # NeuroML object to MOOSE object
|
179 |
| - self.nml_conc_to_moose = {} # NeuroML object to MOOSE object |
| 134 | + self.nml_concs_to_moose = {} # NeuroML object to MOOSE object |
180 | 135 | self.moose_to_nml = {} # Moose object to NeuroML object
|
181 | 136 | self.proto_cells = {} # map id to prototype cell in moose
|
182 | 137 | self.proto_chans = {} # map id to prototype channels in moose
|
@@ -656,26 +611,16 @@ def importConcentrationModels(self, doc):
|
656 | 611 |
|
657 | 612 | def createDecayingPoolConcentrationModel(self, concModel):
|
658 | 613 | """Create prototype for concentration model"""
|
659 |
| - if concModel.name is not None: |
| 614 | + name = concModel.id |
| 615 | + if hasattr(concModel, 'name') and concModel.name is not None: |
660 | 616 | name = concModel.name
|
661 |
| - else: |
662 |
| - name = concModel.id |
663 |
| - ca = moose.CaConc('%s/%s' % (self.lib.path, id)) |
664 |
| - print('11111', concModel.restingConc) |
665 |
| - print('2222', concModel.decayConstant) |
666 |
| - print('33333', concModel.shellThickness) |
667 |
| - |
668 |
| - ca.CaBasal = SI(concModel.restingConc) |
669 |
| - ca.tau = SI(concModel.decayConstant) |
670 |
| - ca.thick = SI(concModel.shellThickness) |
| 617 | + ca = moose.CaConc('%s/%s' % (self.lib.path, name)) |
| 618 | + |
| 619 | + ca.CaBasal = SI(concModel.resting_conc) |
| 620 | + ca.tau = SI(concModel.decay_constant) |
| 621 | + ca.thick = SI(concModel.shell_thickness) |
671 | 622 | ca.B = 5.2e-6 # B = 5.2e-6/(Ad) where A is the area of the shell and d is thickness - must divide by shell volume when copying
|
672 | 623 | self.proto_pools[concModel.id] = ca
|
673 | 624 | self.nml_concs_to_moose[concModel.id] = ca
|
674 | 625 | self.moose_to_nml[ca] = concModel
|
675 | 626 | logger.debug('Created moose element: %s for nml conc %s' % (ca.path, concModel.id))
|
676 |
| - |
677 |
| - |
678 |
| - |
679 |
| - |
680 |
| -# |
681 |
| -# reader.py ends here |
0 commit comments