Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Display Connection Matrix #963

Open
Open
@SoundsSerious

Description

@SoundsSerious

Hi,

I wanted to expand on#925 and display a sparse graph of all the system connections, some of which had the same signal name, which is a case I found the new connection table feature a bit confusing for so I wrote this short function to display the connection matrix directly using matplotlib imshow.

defmake_connection_plot(self):iinx= {}oinx= {}sinx= {}# Go through the system list and keep track of counts, offsetsforsysidx,sysinenumerate(self.syslist):forstinrange(sys.nstates):iinx[max(iinx.keys())+1ifiinxelse0+st]=f'{sys.name}.{sys.state_labels[st]}'forstinrange(sys.noutputs):oinx[max(oinx.keys())+1ifoinxelse0+st]=f'{sys.name}.{sys.output_labels[st]}'forstinrange(sys.ninputs):sinx[max(sinx.keys())+1ifsinxelse0+st]=f'{sys.name}.{sys.input_labels[st]}'cmm=self.connect_map.copy()cmm[cmm==0]=np.nanimshow(cmm)grid()title(f'Connection Map:{self.name}')xticks(ticks=list(oinx.keys()),labels=list(oinx.values()),rotation=90)yticks(ticks=list(sinx.keys()),labels=list(sinx.values()))xlabel('Outputs')ylabel('Inputs')tight_layout()

This code results in this plot, displaying the gain via color as well as the scoped input and output names.
Connectionmap

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp