Exemplo n.º 1
0
    def showMatrix(self):
        """Generate matrix buttom has been pressed"""

        print_v("Matrix button was clicked.")

        if len(self.network.projections) == 0:
            self.dialog_popup(
                "No projections present in network, and so no matrix to show"
            )
            return

        self.update_net_sim()
        self.tabs.setCurrentWidget(self.matrixTab)

        from neuromllite.MatrixHandler import MatrixHandler

        level = 2

        handler = MatrixHandler(level, nl_network=self.network)

        from neuromllite.NetworkGenerator import generate_network

        generate_network(self.network, handler, always_include_props=True, base_dir=".")

        print_("Done with MatrixHandler...", self.verbose)
Exemplo n.º 2
0
    def showGraph(self):
        """Generate graph buttom has been pressed"""

        print_v("Graph button was clicked.")

        self.update_net_sim()
        self.tabs.setCurrentWidget(self.all_tabs[self.GRAPH_TAB])

        from neuromllite.GraphVizHandler import GraphVizHandler

        engine = str(self.graphTypeComboBox.currentText()).split(" - ")[1]
        level = int(self.graphLevelComboBox.currentText())

        show_ext_inputs = self.graphShowExtInputs.isChecked()
        show_input_pops = self.graphShowInputPops.isChecked()

        format = "svg"
        format = "png"

        handler = GraphVizHandler(
            level,
            engine=engine,
            nl_network=self.network,
            output_format=format,
            view_on_render=False,
            include_ext_inputs=show_ext_inputs,
            include_input_pops=show_input_pops,
        )

        from neuromllite.NetworkGenerator import generate_network

        generate_network(self.network, handler, always_include_props=True, base_dir=".")

        print_("Done with GraphViz...", self.verbose)

        if format == "svg":
            genFile = "%s.gv.svg" % self.network.id

            self.add_image(genFile, self.GRAPH_TAB)
            """
            svgWidget = QSvgWidget(genFile)
            svgWidget.resize(svgWidget.sizeHint())
            svgWidget.show()
            self.graphTabLayout.addWidget(svgWidget, 0, 0)"""

        elif format == "png":
            genFile = "%s.gv.png" % self.network.id

            self.add_image(genFile, self.GRAPH_TAB)
Exemplo n.º 3
0
    )
)
net.synapses.append(
    Synapse(
        id="ampa", neuroml2_source_file="../../../examples/test_files/ampa.synapse.nml"
    )
)


print(net.to_json())
new_file = net.to_json_file("%s.json" % net.id)


################################################################################
###   Use a handler which just prints info on positions, etc.

def_handler = DefaultNetworkHandler()

generate_network(net, def_handler)


################################################################################
###   Export to some formats, e.g. try:
###        python Example2.py -graph2

from neuromllite.NetworkGenerator import check_to_generate_or_run
from neuromllite import Simulation
import sys

check_to_generate_or_run(sys.argv, Simulation(id="Sim%s" % net.id, network=new_file))