BhallaLab / moose-core

C++ basecode and python scripting interface
https://moose.ncbs.res.in
GNU General Public License v3.0
15 stars 27 forks source link

Connections and showmsg inconsistency #488

Open subhacom opened 1 month ago

subhacom commented 1 month ago

While src and dest fields are unambiguous in the directionality of connections, that via shared message is bidirectional. If MOOSE is automatically ordering the subfields (dest and src) in a shared messaged, the outcomes should be identical irrespective of the order of the arguments to moose.connect. But in the example below, where I create two HHChannels, x and y and connect them a to a compartment comp, this is not the case:

In [1]: comp = moose.Compartment('comp')

In [2]: ch = moose.HHChannel('x')

In [3]: moose.connect(ch, 'channel', comp, 'channel')
Out[3]: <moose.SingleMsg id=5 dataIndex=6 path=/Msgs[0]/singleMsg[6]>

In [4]: moose.showmsg(ch)
INCOMING:
  /x, [parentMsg] <-- /, [childOut]
  /x, [process,reinit] <-- /clock, [process4,reinit4]

OUTGOING:
  /x, [childOut] --> /x[0]/gateX, [parentMsg]
  /x, [childOut] --> /x[0]/gateY, [parentMsg]
  /x, [childOut] --> /x[0]/gateZ, [parentMsg]
  /x, [channelOut] --> /comp, [handleChannel]

In [5]: moose.showmsg(comp)
INCOMING:
  /comp, [parentMsg] <-- /, [childOut]
  /comp, [initProc,initReinit] <-- /clock, [process2,reinit2]
  /comp, [process,reinit] <-- /clock, [process3,reinit3]
  /comp, [handleChannel] <-- /x, [channelOut]

OUTGOING:
  /x, [channelOut] --> /comp, [handleChannel]

In [6]: ch2 = moose.HHChannel('y')

In [7]: moose.connect(comp, 'channel', ch2, 'channel')
Out[7]: <moose.SingleMsg id=5 dataIndex=7 path=/Msgs[0]/singleMsg[7]>

In [8]: moose.showmsg(ch2)
INCOMING:
  /y, [parentMsg] <-- /, [childOut]
  /y, [process,reinit] <-- /clock, [process4,reinit4]
  /y, [Vm] <-- /comp, [VmOut]

OUTGOING:
  /y, [childOut] --> /y[0]/gateX, [parentMsg]
  /y, [childOut] --> /y[0]/gateY, [parentMsg]
  /y, [childOut] --> /y[0]/gateZ, [parentMsg]
  /comp, [VmOut] --> /y, [Vm]

In [9]: moose.showmsg(comp)
INCOMING:
  /comp, [parentMsg] <-- /, [childOut]
  /comp, [initProc,initReinit] <-- /clock, [process2,reinit2]
  /comp, [process,reinit] <-- /clock, [process3,reinit3]
  /comp, [handleChannel] <-- /x, [channelOut]

OUTGOING:
  /x, [channelOut] --> /comp, [handleChannel]
  /comp, [VmOut] --> /y, [Vm]

Also, the incoming and outgoing message listings seem confusing.