|
10 | 10 | __email__ = "hrani@ncbs.res.in" |
11 | 11 | __status__ = "Development" |
12 | 12 | __updated__ = "Jan 08 2020" |
| 13 | + |
13 | 14 | #Jan 8: added a line to add compartment info |
14 | 15 | # permeability from moose is in uM which to be converted to mM for genesis |
15 | 16 | #2020 |
@@ -253,7 +254,7 @@ def writeConcChan(modelpath,f,sceneitems): |
253 | 254 | if len(moose.element(cChan).neighbors['setNumChan']) == 1: |
254 | 255 | chanParent = moose.element(moose.element(cChan).neighbors['setNumChan'][0]) |
255 | 256 |
|
256 | | - if not (isinstance(chanParent,moose.PoolBase)): |
| 257 | + if not chanParent.isA['PoolBase']: |
257 | 258 | print(" raise exception Channel doesn't have pool as parent %s",moose.element(cChan).path) |
258 | 259 | return False,"raise exception Channel doesn't have pool as parent" |
259 | 260 | else: |
@@ -307,7 +308,7 @@ def writeEnz( modelpath,f,sceneitems): |
307 | 308 | if len(moose.element(enz).neighbors['enzDest']) == 1: |
308 | 309 | enzParent = moose.element(moose.element(enz).neighbors['enzDest'][0]) |
309 | 310 |
|
310 | | - if not (isinstance(enzParent,moose.PoolBase)): |
| 311 | + if not enzParent.isA['PoolBase']: |
311 | 312 | print(" raise exception enz doesn't have pool as parent %s",moose.element(enz).path) |
312 | 313 | return False |
313 | 314 | else: |
@@ -431,29 +432,28 @@ def writeReac(modelpath,f,sceneitems): |
431 | 432 | return reacList,error |
432 | 433 |
|
433 | 434 | def trimPath(mobj): |
434 | | - original = mobj |
435 | 435 | mobj = moose.element(mobj) |
436 | | - found = False |
437 | | - while not isinstance(mobj,moose.ChemCompt) and mobj.path != "/": |
| 436 | + original = mobj |
| 437 | + while not mobj.isA['ChemCompt'] and mobj.path != "/": |
438 | 438 | mobj = moose.element(mobj.parent) |
439 | | - found = True |
| 439 | + |
440 | 440 | if mobj.path == "/": |
441 | | - print(original, " object doesn't have compartment as a parent ") |
| 441 | + print("%s object doesn't have a parent compartment as a parent." % original) |
442 | 442 | return |
443 | | - #other than the kinetics compartment, all the othername are converted to group in Genesis which are place under /kinetics |
| 443 | + |
| 444 | + # other than the kinetics compartment, all the othername are converted to group in Genesis which are place under /kinetics |
444 | 445 | # Any moose object comes under /kinetics then one level down the path is taken. |
445 | 446 | # e.g /group/poolObject or /Reac |
446 | | - if found: |
447 | | - if mobj.name != "kinetics":# and ( (mobj.className != "CubeMesh") and (mobj.className != "CylMesh") and (mobj.className != "EndoMesh") and (mobj.className != "NeuroMesh")): |
448 | | - splitpath = original.path[(original.path.find(mobj.name)):len(original.path)] |
449 | | - else: |
450 | | - pos = original.path.find(mobj.name) |
451 | | - slash = original.path.find('/',pos+1) |
452 | | - splitpath = original.path[slash+1:len(original.path)] |
453 | | - splitpath = re.sub(r"\[[0-9]+\]", "", splitpath) |
454 | | - s = splitpath.replace("_dash_",'-') |
455 | | - s = splitpath.replace("_space_","_") |
456 | | - return s |
| 447 | + if mobj.name != "kinetics":# and ( (mobj.className != "CubeMesh") and (mobj.className != "CylMesh") and (mobj.className != "EndoMesh") and (mobj.className != "NeuroMesh")): |
| 448 | + splitpath = original.path[(original.path.find(mobj.name)):len(original.path)] |
| 449 | + else: |
| 450 | + pos = original.path.find(mobj.name) |
| 451 | + slash = original.path.find('/',pos+1) |
| 452 | + splitpath = original.path[slash+1:len(original.path)] |
| 453 | + splitpath = re.sub(r"\[[0-9]+\]", "", splitpath) |
| 454 | + s = splitpath.replace("_dash_",'-') |
| 455 | + s = splitpath.replace("_space_","_") |
| 456 | + return s |
457 | 457 |
|
458 | 458 | # def writeSumtotal( modelpath,f): |
459 | 459 | # funclist = moose.wildcardFind(modelpath+'/##[ISA=Function]') |
@@ -585,22 +585,24 @@ def writePool(modelpath,f,volIndex,sceneitems): |
585 | 585 |
|
586 | 586 | for p in moose.wildcardFind(modelpath+'/##[0][ISA=PoolBase]'): |
587 | 587 | if findCompartment(p) == moose.element('/'): |
588 | | - error = error + " \n "+p.path+ " doesn't have compartment ignored to write to genesis" |
| 588 | + error += "\n%s doesn't have compartment ignored to write to genesis" % p |
589 | 589 | else: |
590 | 590 | slave_enable = 0 |
591 | | - if (p.className == "BufPool" or p.className == "ZombieBufPool"): |
| 591 | + if p.isA["BufPool"] or p.isA["ZombieBufPool"]: |
592 | 592 | pool_children = p.children |
593 | 593 | if pool_children== 0: |
594 | 594 | slave_enable = 4 |
595 | 595 | else: |
596 | 596 | for pchild in pool_children: |
597 | | - if not(pchild.className == "ZombieFunction") and not(pchild.className == "Function"): |
| 597 | + if (not pchild.isA["ZombieFunction"]) and (not pchild.isA["Function"]): |
598 | 598 | slave_enable = 4 |
599 | 599 | else: |
600 | 600 | slave_enable = 0 |
601 | 601 | break |
602 | | - if (p.parent.className != "Enz" and p.parent.className !='ZombieEnz'): |
603 | | - #Assuming "p.parent.className !=Enzyme is cplx which is not written to genesis" |
| 602 | + |
| 603 | + pp = moose.element(p.parent) |
| 604 | + if (not pp.isA['Enz']) and (not pp.isA['ZombieEnz']): |
| 605 | + # Assuming "p.parent.className !=Enzyme is cplx which is not written to genesis" |
604 | 606 |
|
605 | 607 | # x = sceneitems[p]['x'] |
606 | 608 | # y = sceneitems[p]['y'] |
|
0 commit comments