PyTuflow: Difference between revisions

Content deleted Content added
No edit summary
Line 200:
: '''Count:''' ''int''
:: Number of connected channels
'''ExamplesExample'''
<pre>
import pytuflow as tu
Line 217:
# print to console
print('{0} channels connected to {1}'.format(conn_count, node))
else:
# did not load correctly, print error message to console
print(message)
</pre>
==channelConnections==
 
<b>channelConnections (</b> Node ID <b>)</b><br>
Returns a list of the channels connected to a given node<br>
;Parameters:
: '''Node ID:''' ''str''
:: Name or ID of node e.g. 'Chan_A.1'
;Returns:
: '''Out:''' ''list''
:: List of connected channels e.g. ['Chan_A', 'Chan_B']
'''Example'''
<pre>
import pytuflow as tu
 
# Initialise result class
res = tu.ResData()
 
# load .tpc result file
path = r'C:\TUFLOW\results\M04_5m_001.tpc'
err, message = res.load(path)
 
# check results were loaded successfully before calling function
if not err:
node = 'Chan_A.1'
conn_chans = res.channelConnections(node)
# print to console
print('Channels connected to {0}:'.format(node))
for chan in conn_chans:
print(chan)
else:
# did not load correctly, print error message to console