Skip to content

Commit b8a8b6d

Browse files
author
Dilawar Singh
committed
hotfix from branch issue167.
Squashed commit of the following: commit ee24065 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 14:04:27 2017 +0530 Decreased rtol to 1e-5 in numpy.allclose . commit 138906a Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 13:50:30 2017 +0530 When test failes print the value of tuple. commit 963de3a Merge: ff64f41 8a6346d Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 13:47:36 2017 +0530 Merge branch 'chamcham' into issue167 commit ff64f41 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 13:39:45 2017 +0530 use matplotlib.use before importing matplotlib. commit 1af2819 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 13:19:37 2017 +0530 Fixes to travis related issue in test file. matplotlib.use('Agg') to make sure test passes when ssh is used without -X. commit b20ad43 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 12:29:54 2017 +0530 colname -> columnName . commit 88b12b3 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 12:22:55 2017 +0530 Fixes to neuroml test failure with python3. commit 1297ac5 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 11:56:09 2017 +0530 Relative to file import in test_kkit.py model. commit e526fca Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 11:52:56 2017 +0530 Enabled kkit test in cmake. commit 1830f59 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 11:48:04 2017 +0530 Added a kkit test scripts. commit 33606b0 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 11:00:04 2017 +0530 Build fixes after make clean. commit f5258a5 Author: Dilawar Singh <[email protected]> Date: Thu Jan 5 10:41:14 2017 +0530 Fixes to issue #167. commit 3f077c1 Merge: 9b175c8 f0d4c02 Author: bhalla <[email protected]> Date: Thu Jan 5 09:48:44 2017 +0530 Resolved merge conflict with Table.h commit 9b175c8 Author: bhalla <[email protected]> Date: Thu Jan 5 09:35:53 2017 +0530 Major bugfix for Table and derived class Streamer, to fix error introduced by duplicating the 'name' field which is already defined for Neutral. Minor bugfix for melement.cpp commit f0d4c02 Author: Dilawar Singh <[email protected]> Date: Tue Jan 3 09:57:49 2017 +0530 Update INSTALL.md Updated instructions. commit 2737220 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 21:33:22 2017 +0530 Fixes to issue165 (#166) commit a934676 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 20:47:01 2017 +0530 Update .travis.yml commit 601d06a Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 13:19:31 2017 +0530 Fixes to PYTHON3 build failure on travis. commit 9d9d925 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 12:46:07 2017 +0530 Tested locally for linux. The scripts seems to be fine on openSUSE-42.2 commit 93bbd4f Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 12:31:57 2017 +0530 By default travis pick up /opt/bin/python when `which python` is used. Do not use this construct in script. Moved travis related scripts to a hidden folder .travis. commit c0d3871 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 12:21:32 2017 +0530 If python3 exists (installed on travis), then check for the compatibility otherwise don't. commit 65a85da Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 12:14:15 2017 +0530 Almost there. Calling script from top of directory. commit 0db2016 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 12:05:10 2017 +0530 Make trusty default build environment. python3-matplotlib is not available by default. commit d8c1c6a Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 11:54:12 2017 +0530 setuid to root for linux script. commit 4c90f04 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 11:49:05 2017 +0530 Some more fixes in travis script. commit 429420b Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 11:45:40 2017 +0530 Cleanup, osx related travis macros. commit e287118 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 11:42:08 2017 +0530 Disable OSX build here on master brach. Created issue #165 to build and test for MacOSX. commit 87aeb1a Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 11:33:24 2017 +0530 Travis build scripts for macosx and linux are in ./scripts folder. commit 24643bc Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 09:58:54 2017 +0530 Some more fixes to travis build failure on OSX. commit a05826e Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 09:25:22 2017 +0530 Fixing brew taps and build dependencies. commit ea0ede1 Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 09:19:00 2017 +0530 This commit is just to test the OSX build on travis. Unfortunately there is no way to test it offline. commit 1b6f42a Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 09:02:28 2017 +0530 Fixes to travis scripts. commit b0baaab Author: Dilawar Singh <[email protected]> Date: Mon Jan 2 08:48:07 2017 +0530 Excluded linux and osx build from config file. commit 626fd30 Author: Dilawar Singh <[email protected]> Date: Sun Jan 1 19:28:32 2017 +0530 Testing with OsX support on travis. xcode-8.1. Most likely to break commit ab933ad Author: Dilawar Singh <[email protected]> Date: Sun Jan 1 19:18:54 2017 +0530 Fixes to recent travis build failure. make all python files python3 compatible in addition to #164. commit 72afc02 Author: Dilawar Singh <[email protected]> Date: Sun Jan 1 19:02:31 2017 +0530 Enabled macosx build on travis. Though allowing failure for now. commit bedb51e Author: Dilawar Singh <[email protected]> Date: Sun Jan 1 18:04:08 2017 +0530 Fixes for issue #164. Also hotfix for branch chamcham.
1 parent 8a6346d commit b8a8b6d

File tree

13 files changed

+319
-89
lines changed

13 files changed

+319
-89
lines changed

INSTALL.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
# Pre-built packages
22

3+
## Linux
4+
35
Use our repositories hosted at [Open Build Service](http://build.opensuse.org).
46
We have packages for Debian, Ubuntu, CentOS, Fedora, OpenSUSE/SUSE, RHEL,
57
Scientific Linux. Visit the following page for instructions.
68

79
https://software.opensuse.org/download.html?project=home:moose&package=moose
810

11+
## MacOSX
12+
13+
MOOSE is available via [homebrew](http://brew.sh).
14+
15+
$ brew install homebrew/science/moose
16+
17+
918
# Building MOOSE from source
1019

1120
To build `MOOSE` from source, you can either use `cmake` (recommended) or GNU `make` based flow.
1221

13-
Download the latest source code of moose from github or sourceforge.
22+
Download the latest source code of moose from github.
1423

1524
$ git clone -b master https://github.com/BhallaLab/moose-core
1625

@@ -29,6 +38,10 @@ On Ubuntu-12.04 or higher, these can be installed with:
2938

3039
__NOTE__ : On Ubuntu 12.04, gsl version is 1.15. You should skip `libgsl0-dev` install gsl-1.16 or higher manually.
3140

41+
SBML support is enabled by installing [python-libsbml](http://sbml.org/Software/libSBML/docs/python-api/libsbml-installation.html). Alternatively, it can be installed by using `python-pip`
42+
43+
$ sudo pip install python-libsbml
44+
3245
## Use `cmake` to build moose:
3346

3447
$ cd /path/to/moose-core

MooseTests.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,13 @@ ADD_TEST( NAME pymoose-test-streaming_in_tables
115115
set_tests_properties(pymoose-test-streaming_in_tables
116116
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python"
117117
)
118+
119+
# Test kkit support.
120+
ADD_TEST( NAME pymoose-test-kkit
121+
COMMAND ${TEST_COMMAND}
122+
${PROJECT_SOURCE_DIR}/tests/python/test_kkit.py
123+
)
124+
set_tests_properties(pymoose-test-kkit
125+
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python"
126+
)
127+

builtins/Streamer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ void Streamer::addTable( Id table )
292292

293293
// NOTE: If user can make sure that names are unique in table, using name is
294294
// better than using the full path.
295-
if( t->getName().size() > 0 )
296-
columns_.push_back( t->getName( ) );
295+
if( t->getColumnName().size() > 0 )
296+
columns_.push_back( t->getColumnName( ) );
297297
else
298298
columns_.push_back( moose::moosePathToUserPath( table.path() ) );
299299
}

builtins/Table.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ const Cinfo* Table::initCinfo()
7474
, &Table::getFormat
7575
);
7676

77-
static ValueFinfo< Table, string > name(
78-
"name"
79-
, "Name of the table."
80-
, &Table::setName
81-
, &Table::getName
77+
// relevant for Streamer class. When data is written to a datafile, this is
78+
// used to create column name.
79+
static ValueFinfo< Table, string > columnName(
80+
"columnName"
81+
, "Name of the table written in header of data file."
82+
, &Table::setColumnName
83+
, &Table::getColumnName
8284
);
8385

8486
//////////////////////////////////////////////////////////////
@@ -126,7 +128,7 @@ const Cinfo* Table::initCinfo()
126128
{
127129
&threshold, // Value
128130
&format, // Value
129-
&name, // Value
131+
&columnName, // Value
130132
&outfile, // Value
131133
&useStreamer, // Value
132134
handleInput(), // DestFinfo
@@ -347,15 +349,15 @@ string Table::getFormat( void ) const
347349
return format_;
348350
}
349351

350-
/* User defined name */
351-
string Table::getName( void ) const
352+
/* User defined column name for streamer */
353+
string Table::getColumnName( void ) const
352354
{
353-
return tableName_;
355+
return tableColumnName_;
354356
}
355357

356-
void Table::setName( const string name )
358+
void Table::setColumnName( const string colname )
357359
{
358-
tableName_ = name ;
360+
tableColumnName_ = colname ;
359361
}
360362

361363
/* Enable/disable streamer support. */

builtins/Table.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class Table: public TableBase
3737
void setFormat ( const string format );
3838
string getFormat( ) const;
3939

40-
void setName ( const string name );
41-
string getName( ) const;
40+
void setColumnName( const string colname );
41+
string getColumnName( ) const;
4242

4343
void setUseStreamer ( bool status );
4444
bool getUseStreamer ( void ) const;
@@ -84,7 +84,12 @@ class Table: public TableBase
8484
vector<string> columns_; /* Store the name of tables */
8585

8686
string tablePath_;
87-
string tableName_;
87+
88+
89+
/**
90+
* @brief Column name of this table. Use it when writing data to a datafile.
91+
*/
92+
string tableColumnName_;
8893

8994
/**
9095
* @brief If stream is set to true, then stream to outfile_. Default value
@@ -108,7 +113,7 @@ class Table: public TableBase
108113
bool outfileIsSet_;
109114

110115
/**
111-
* @brief format of data. Currently fixed to csv.
116+
* @brief format of data. Default to csv.
112117
*/
113118
string format_;
114119

pymoose/melement.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
180180
ostringstream err;
181181
// First see if there is an existing object with at path
182182
self->oid_ = ObjId(path);
183-
PyTypeObject * basetype = getBaseClass((PyObject*)self);
183+
PyTypeObject* basetype = getBaseClass((PyObject*)self);
184184
string basetype_str;
185185
if (type == NULL){
186186
if (basetype == NULL){
@@ -210,15 +210,26 @@ int moose_ObjId_init_from_path(_ObjId * self, PyObject * args,
210210
} else { // this is a non-root existing element
211211
// If the current class is a subclass of some predefined
212212
// moose class, do nothing.
213+
string className = self->oid_.element()->cinfo()->name();
214+
map <string, PyTypeObject * >::iterator ii =
215+
get_moose_classes().find( className );
216+
PyTypeObject * basetype = 0;
217+
if ( ii != get_moose_classes().end() ) {
218+
basetype = ii->second;
219+
basetype_str = string(basetype->tp_name).substr(6); // remove `moose.` prefix from type name
220+
} else {
221+
err << "Unknown class: " << className << endl;
222+
basetype = getBaseClass((PyObject*)self);
223+
}
213224
if ((basetype != NULL) && PyType_IsSubtype(mytype, basetype)){
214225
return 0;
215226
}
216227
// element exists at this path, but it does not inherit from any moose class.
217228
// throw an error
218229
err << "cannot convert "
219-
<< Field<string>::get(self->oid_, "className")
230+
<< className
220231
<< " to "
221-
<< basetype_str
232+
<< mytypename
222233
<< ". To get the existing object use `moose.element(obj)` instead.";
223234
PyErr_SetString(PyExc_TypeError, err.str().c_str());
224235
return -1;

python/moose/add_Delete_ChemicalSolver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33

44
def moosedeleteChemSolver(modelRoot):
5-
"""
6-
Delete solvers from Chemical Compartment
5+
"""Delete solvers from Chemical Compartment
6+
77
"""
88
compts = moose.wildcardFind(modelRoot + '/##[ISA=ChemCompt]')
99
for compt in compts:
@@ -13,7 +13,7 @@ def moosedeleteChemSolver(modelRoot):
1313
moose.delete(st)
1414
if moose.exists((st_ksolve).path):
1515
moose.delete(st_ksolve)
16-
print("Solver is deleted for modelpath ", modelRoot)
16+
print("Solver is deleted for modelpath %s " % modelRoot)
1717

1818

1919
def mooseaddChemSolver(modelRoot, solver):
@@ -79,4 +79,4 @@ def setCompartmentSolver(modelRoot, solver):
7979

8080
for i in stoichList:
8181
i.filterXreacs()
82-
print(" Solver is added to model path ", modelRoot)
82+
print( " Solver is added to model path %s" % modelRoot )

python/moose/moose.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121
sbmlSupport_, genesisSupport_ = True, True
2222
try:
2323
import SBML.readSBML
24-
import SBML.writeSBML
24+
import SBML.writeSBML
2525
except Exception as e:
26-
print('MOOSE could not load SBML support')
27-
print('\tError was %s' % e)
26+
print( 'MOOSE could not load SBML support due to %s' % e )
2827
sbmlSupport_ = False
2928

3029
try:
@@ -79,7 +78,7 @@ def mooseReadSBML(filepath, loadpath, solver='ee'):
7978
if not os.path.isfile(filepath):
8079
raise UserWarning('File %s not found' % filepath)
8180

82-
return SBML.readSBML.mooseReadSBML(filepath, loadpath, solver)
81+
return SBML.readSBML.mooseReadSBML( filepath, loadpath, solver )
8382

8483

8584
def mooseWriteSBML(modelpath, filenpath, sceneitems={}):

python/moose/neuroml/MorphML.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def set_compartment_param(self, compartment, name, value, mechanismname):
632632
moose.connect(channel,'channel',compartment,'channel')
633633
## if mechanism is present in compartment, just wrap it
634634
else:
635-
neutralObj = moose.Neutral(compartment.path+'/'+mechanismname)
635+
neutralObj = moose.element(compartment.path+'/'+mechanismname)
636636
if 'CaConc' == neutralObj.className: # Ion concentration pool
637637
caconc = moose.CaConc(compartment.path+'/'+mechanismname) # wraps existing channel
638638
channel = None

scripts/color.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)