Exemplo n.º 1
0
def compare_channel(left, right):
    """Compare two channels on same field values"""
    #     result = almost_equal(left.Ek, right.Ek) and \
    #         almost_equal(left.Gbar, right.Gbar) and \
    #         almost_equal(left.Xpower, right.Xpower) and \
    #         almost_equal(left.Ypower, right.Ypower) and \
    #         almost_equal(left.Zpower, right.Zpower) and \
    #         almost_equal(left.instant, right.instant) and \
    #         almost_equal(left.Gk, right.Gk) and \
    #         almost_equal(left.Ik, right.Ik)
    result = almost_equal(left.Ek, right.Ek)
    if not result:
        print(left.path + ".Ek = " + str(left.Ek) + " <> " + right.path +
              ".Ek = " + str(right.Ek))
        return result

    result = almost_equal(left.Gbar, right.Gbar)
    if not result:
        print(left.path + ".Gbar = " + str(left.Gbar) + " <> " + right.path +
              ".Gbar = " + str(right.Gbar))
        return result

    result = almost_equal(left.Xpower, right.Xpower)

    if not result:
        print(left.path + ".Xpower = " + str(left.Xpower) + " <> " +
              right.path + ".Xpower = " + str(right.Xpower))
        return result

    result = almost_equal(left.Ypower, right.Ypower)
    if not result:
        print(left.path + ".Ypower = " + str(left.Ypower) + " <> " +
              right.path + ".Ypower = " + str(right.Ypower))
        return result

    result = almost_equal(left.Zpower, right.Zpower)
    if not result:
        print(left.path + ".Zpower = " + str(left.Zpower) + " <> " +
              right.path + ".Zpower = " + str(right.Zpower))
        return result

    result = almost_equal(left.instant, right.instant)
    if not result:
        print(left.path + ".instant = " + str(left.instant) + " <> " +
              right.path + ".instant = " + str(right.instant))
        return result

    result = almost_equal(left.Gk, right.Gk)
    if not result:
        print(left.path + ".Gk = " + str(left.Gk) + " <> " + right.path +
              ".Gk = " + str(right.Gk))
        return result

    result = almost_equal(left.Ik, right.Ik)
    if not result:
        print(left.path + ".Ik = " + str(left.Ik) + " <> " + right.path +
              ".Ik = " + str(right.Ik))
        return result

    return True
Exemplo n.º 2
0
def compare_channel(left, right):
    """Compare two channels on same field values"""
#     result = almost_equal(left.Ek, right.Ek) and \
#         almost_equal(left.Gbar, right.Gbar) and \
#         almost_equal(left.Xpower, right.Xpower) and \
#         almost_equal(left.Ypower, right.Ypower) and \
#         almost_equal(left.Zpower, right.Zpower) and \
#         almost_equal(left.instant, right.instant) and \
#         almost_equal(left.Gk, right.Gk) and \
#         almost_equal(left.Ik, right.Ik)
    result = almost_equal(left.Ek, right.Ek)
    if not result:
        print(left.path + ".Ek = " + str(left.Ek) + " <> " + right.path + ".Ek = " + str(right.Ek))
        return result
    
    result = almost_equal(left.Gbar, right.Gbar)
    if not result:
        print(left.path + ".Gbar = " + str(left.Gbar) + " <> " + right.path + ".Gbar = " + str(right.Gbar))
        return result

    result = almost_equal(left.Xpower, right.Xpower)

    if not result:
        print(left.path + ".Xpower = " + str(left.Xpower) + " <> " + right.path + ".Xpower = " + str(right.Xpower))
        return result

    result = almost_equal(left.Ypower, right.Ypower)
    if not result:
        print(left.path + ".Ypower = " + str(left.Ypower) + " <> " + right.path + ".Ypower = " + str(right.Ypower))
        return result

    result = almost_equal(left.Zpower, right.Zpower)
    if not result:
        print(left.path + ".Zpower = " + str(left.Zpower) + " <> " + right.path + ".Zpower = " + str(right.Zpower))
        return result

    result = almost_equal(left.instant, right.instant)
    if not result:
        print(left.path + ".instant = " + str(left.instant) + " <> " + right.path + ".instant = " + str(right.instant))
        return result

    result = almost_equal(left.Gk, right.Gk)
    if not result:
        print(left.path + ".Gk = " + str(left.Gk) + " <> " + right.path + ".Gk = " + str(right.Gk))
        return result

    result = almost_equal(left.Ik, right.Ik)
    if not result:
        print(left.path + ".Ik = " + str(left.Ik) + " <> " + right.path + ".Ik = " + str(right.Ik))
        return result


    return True
Exemplo n.º 3
0
def compare_compartment(left, right):
    """Compare if two compartments have same field values"""
#     return almost_equal(left.Em, right.Em) and \
#         almost_equal(left.Rm, right.Rm) and \
#         almost_equal(left.Cm, right.Cm) and \
#         almost_equal(left.Ra, right.Ra) and \
#         almost_equal(left.initVm, right.initVm)
    result = almost_equal(left.Em, right.Em)
    if not result:
        print left.path + ".Em = " + str(left.Em) + " <> " + right.path + ".Em = " + str(right.Em)
        return result
    result = almost_equal(left.Rm, right.Rm)
    if not result:
        print(left.path + ".Rm = " + str(left.Rm) + " <> " + right.path + ".Rm = " + str(right.Rm))
        return result

    result = almost_equal(left.Cm, right.Cm)
    if not result:
        print(left.path + ".Cm = " + str(left.Cm) + " <> " + right.path + ".Cm = " + str(right.Cm))
        return result
    result = almost_equal(left.Ra, right.Ra)
    if not result:
        print(left.path + ".Ra = " + str(left.Ra) + " <> " + right.path + ".Ra = " + str(right.Ra))
        return result

    result = almost_equal(left.initVm, right.initVm)
    if not result:
        print(left.path + ".initVm = " + str(left.initVm) + " <> " + right.path + ".initVm = " + str(right.initVm))
        return result

    result = almost_equal(left.Vm, right.Vm)
    if not result:
        print(left.path + ".Vm = " + str(left.Vm) + " <> " + right.path + ".Vm = " + str(right.Vm))
        return result
    leftchans = moose.context.getWildcardList(left.path + '/##[TYPE=HHChannel]', True)
    rightchans = moose.context.getWildcardList(right.path + '/##[TYPE=HHChannel]', True)
    result = len(leftchans) == len(rightchans)
    if not result:
        print(left.path + ":channel-count = " + str(len(leftchans)) + " <> " + right.path + ":channel-count = " + str(len(rightchans)))
        return result
    lchanset = set([moose.HHChannel(ch).name for cha in leftchans])
    rchanset = set([moose.HHChannel(ch).name for cha in rightchans])
    for ch in lchanset - rchanset:
        print ch.path, 'not in', right.path
        result = False
    for ch in rchanset - lchanset:
        print ch.path, 'not in', left.path
        result = False
    if not result:
        return result
    for ch in leftchans:
        lchan = moose.HHChannel(ch)
        rchan = moose.HHChannel('%s/%s' % (right.path, lchan.name))
        result = compare_channel(lchan, rchan)
    return result

    return True
Exemplo n.º 4
0
 def check_reversal_potentials(self):
     for num in range(SupLTS.num_comp):
         comp = self.comp[num + 1]
         for chan_id in comp.neighbours('channel'):
             chan = moose.HHChannel(chan_id)
             chan_class = eval(chan.name)
             key = None
             if issubclass(chan_class, NaChannel):
                 key = 'ENa'
             elif issubclass(chan_class, KChannel):
                 key = 'EK'
             elif issubclass(chan_class, CaChannel):
                 key = 'ECa'
             elif issubclass(chan_class, AR):
                 key = 'EAR'
             else:
                 pass
             assert trbutil.almost_equal(chan.Ek, SupLTS.chan_params[key])
Exemplo n.º 5
0
 def check_reversal_potentials(self):
     for num in range(SupLTS.num_comp):
         comp = self.comp[num + 1]
         for chan_id in comp.neighbours('channel'):
             chan = moose.HHChannel(chan_id)
             chan_class = eval(chan.name)
             key = None
             if issubclass(chan_class, NaChannel):
                 key = 'ENa'
             elif issubclass(chan_class, KChannel):
                 key = 'EK'
             elif issubclass(chan_class, CaChannel):
                 key = 'ECa'
             elif issubclass(chan_class, AR):
                 key = 'EAR'
             else:
                 pass
             assert trbutil.almost_equal(chan.Ek, SupLTS.chan_params[key])
def compare_compartment(left, right):
    """Compare if two compartments have same field values"""
#     return almost_equal(left.Em, right.Em) and \
#         almost_equal(left.Rm, right.Rm) and \
#         almost_equal(left.Cm, right.Cm) and \
#         almost_equal(left.Ra, right.Ra) and \
#         almost_equal(left.initVm, right.initVm)
    result = almost_equal(left.Em, right.Em)
    if not result:
        print left.path + ".Em = " + str(left.Em) + " <> " + right.path + ".Em = " + str(right.Em)
        return result
    result = almost_equal(left.Rm, right.Rm)
    if not result:
        print(left.path + ".Rm = " + str(left.Rm) + " <> " + right.path + ".Rm = " + str(right.Rm))
        return result

    result = almost_equal(left.Cm, right.Cm)
    if not result:
        print(left.path + ".Cm = " + str(left.Cm) + " <> " + right.path + ".Cm = " + str(right.Cm))
        return result
    result = almost_equal(left.Ra, right.Ra)
    if not result:
        print(left.path + ".Ra = " + str(left.Ra) + " <> " + right.path + ".Ra = " + str(right.Ra))
        return result

    result = almost_equal(left.initVm, right.initVm)
    if not result:
        print(left.path + ".initVm = " + str(left.initVm) + " <> " + right.path + ".initVm = " + str(right.initVm))
        return result

    result = almost_equal(left.Vm, right.Vm)
    if not result:
        print(left.path + ".Vm = " + str(left.Vm) + " <> " + right.path + ".Vm = " + str(right.Vm))
        return result

    return True
Exemplo n.º 7
0
def compare_compartment(left, right):
    """Compare if two compartments have same field values"""
    #     return almost_equal(left.Em, right.Em) and \
    #         almost_equal(left.Rm, right.Rm) and \
    #         almost_equal(left.Cm, right.Cm) and \
    #         almost_equal(left.Ra, right.Ra) and \
    #         almost_equal(left.initVm, right.initVm)
    result = almost_equal(left.Em, right.Em)
    if not result:
        print left.path + ".Em = " + str(
            left.Em) + " <> " + right.path + ".Em = " + str(right.Em)
        return result
    result = almost_equal(left.Rm, right.Rm)
    if not result:
        print(left.path + ".Rm = " + str(left.Rm) + " <> " + right.path +
              ".Rm = " + str(right.Rm))
        return result

    result = almost_equal(left.Cm, right.Cm)
    if not result:
        print(left.path + ".Cm = " + str(left.Cm) + " <> " + right.path +
              ".Cm = " + str(right.Cm))
        return result
    result = almost_equal(left.Ra, right.Ra)
    if not result:
        print(left.path + ".Ra = " + str(left.Ra) + " <> " + right.path +
              ".Ra = " + str(right.Ra))
        return result

    result = almost_equal(left.initVm, right.initVm)
    if not result:
        print(left.path + ".initVm = " + str(left.initVm) + " <> " +
              right.path + ".initVm = " + str(right.initVm))
        return result

    result = almost_equal(left.Vm, right.Vm)
    if not result:
        print(left.path + ".Vm = " + str(left.Vm) + " <> " + right.path +
              ".Vm = " + str(right.Vm))
        return result
    leftchans = moose.context.getWildcardList(
        left.path + '/##[TYPE=HHChannel]', True)
    rightchans = moose.context.getWildcardList(
        right.path + '/##[TYPE=HHChannel]', True)
    result = len(leftchans) == len(rightchans)
    if not result:
        print(left.path + ":channel-count = " + str(len(leftchans)) + " <> " +
              right.path + ":channel-count = " + str(len(rightchans)))
        return result
    lchanset = set([moose.HHChannel(ch).name for cha in leftchans])
    rchanset = set([moose.HHChannel(ch).name for cha in rightchans])
    for ch in lchanset - rchanset:
        print ch.path, 'not in', right.path
        result = False
    for ch in rchanset - lchanset:
        print ch.path, 'not in', left.path
        result = False
    if not result:
        return result
    for ch in leftchans:
        lchan = moose.HHChannel(ch)
        rchan = moose.HHChannel('%s/%s' % (right.path, lchan.name))
        result = compare_channel(lchan, rchan)
    return result

    return True
Exemplo n.º 8
0
 def check_Em(self):
     for comp_no in range(SupLTS.num_comp):
         assert trbutil.almost_equal(self.cell.comp[comp_no + 1].Em, -65e-3)
Exemplo n.º 9
0
 def check_Em(self):
     for comp_no in range(SupLTS.num_comp):
         assert trbutil.almost_equal(self.cell.comp[comp_no + 1].Em, -65e-3)