def show3Dimage(self): """Generate 3D view button has been pressed""" print_v("image3D button was clicked.") self.update_net_sim() self.tabs.setCurrentWidget(self.all_tabs[self.IMAGE_3D_TAB]) from neuromllite.NetworkGenerator import generate_neuroml2_from_network nml_file_name, nml_doc = generate_neuroml2_from_network(self.network, print_summary=True, format='xml', base_dir=None, copy_included_elements=False, target_dir=None, validate=False, simulation=self.simulation) post_args = "-png" from pyneuroml.pynml import run_jneuroml run_jneuroml("", nml_file_name, post_args, verbose = True) nml_view_file = nml_file_name.replace('.nml','.png') self.add_image(nml_view_file, self.IMAGE_3D_TAB)
def showLemsView(self): """Generate lemsView button has been pressed""" print_v("lemsView button was clicked.") self.update_net_sim() self.tabs.setCurrentWidget(self.all_tabs[self.LEMS_VIEW_TAB]) self.update_net_sim() from neuromllite.NetworkGenerator import generate_neuroml2_from_network from neuromllite.NetworkGenerator import generate_and_run lems_file_name = generate_and_run(self.simulation, simulator='jNeuroML_norun', network=self.network, return_results=True, base_dir=self.sim_base_dir) post_args = "-graph" from pyneuroml.pynml import run_jneuroml run_jneuroml("", lems_file_name, post_args, verbose = True) lems_view_file = lems_file_name.replace('.xml','.png') self.add_image(lems_view_file, self.LEMS_VIEW_TAB)
def validate_neuroml2_lems_file( nml2_lems_file_name, max_memory=DEFAULTS["default_java_max_memory"], exit_on_fail=True, return_string=False, ): # type: (str, str) -> bool """Validate a NeuroML 2 LEMS file using jNeuroML. Note that this uses jNeuroML and so is aware of the standard NeuroML LEMS definitions. TODO: allow inclusion of other paths for user-defined LEMS definitions (does the -norun option allow the use of -I?) :param nml2_lems_file_name: name of file to validate :type nml2_lems_file_name: str :param max_memory: memory to use for the Java virtual machine :type max_memory: str :param exit_on_fail: toggle whether command should exit if jnml fails :type exit_on_fail: bool :param return_string: toggle whether the output string should be returned :type return_string: bool :returns: Either a bool, or a tuple (bool, str): True if jnml ran without errors, false if jnml fails; along with the message returned by jnml """ post_args = "" post_args += "-norun" return run_jneuroml( "", nml2_lems_file_name, post_args, max_memory=max_memory, verbose=False, report_jnml_output=True, exit_on_fail=exit_on_fail, return_string=return_string, )
def convert_channels_to_mod(lems_file): from pyneuroml import pynml pynml.run_jneuroml("", lems_file, "-neuron")