pyneuroml.lems package#

pyneuroml.lems.generate_lems_file_for_neuroml(sim_id, neuroml_file, target, duration, dt, lems_file_name, target_dir, nml_doc=None, include_extra_files=[], gen_plots_for_all_v=True, plot_all_segments=False, gen_plots_for_quantities={}, gen_plots_for_only_populations=[], gen_saves_for_all_v=True, save_all_segments=False, gen_saves_for_only_populations=[], gen_saves_for_quantities={}, gen_spike_saves_for_all_somas=False, gen_spike_saves_for_only_populations=[], gen_spike_saves_for_cells={}, spike_time_format='ID_TIME', copy_neuroml=True, report_file_name=None, lems_file_generate_seed=None, verbose=False, simulation_seed=12345)#
pyneuroml.lems.get_pop_index(quantity)#
pyneuroml.lems.safe_variable(quantity)#

pyneuroml.lems.LEMSSimulation module#

Helper class for generating LEMS xml files for simulations

class pyneuroml.lems.LEMSSimulation.LEMSSimulation(sim_id: str, duration: float, dt: float, target: Optional[str] = None, comment: str = '\n\n        This LEMS file has been automatically generated using PyNeuroML v0.7.3 (libNeuroML v0.4.1)\n\n    ', lems_file_generate_seed: Optional[Any] = None, simulation_seed: int = 12345)#

Bases: object

Helper class for creating LEMS Simulations for running NeuroML2 models.

TEMPLATE_FILE = '/home/docs/checkouts/readthedocs.org/user_builds/pyneuroml/checkouts/development/pyneuroml/lems/LEMS_TEMPLATE.xml'#
add_column_to_output_file(output_file_id: str, column_id: str, quantity: str) None#

Add a column to the output file with id output_file_id

Parameters
  • output_file_id (str) – id of output file (must be created first using create_output_file)

  • column_id (str) – id of column to add

  • quantity (str) – quantity to add

Returns

None

Raises

ValueError – if provided output_file_id has not been created yet.

add_line_to_display(display_id: str, line_id: str, quantity: str, scale: str = '1', color: Optional[str] = None, timeScale: str = '1ms') None#

Add a new line to the display

Parameters
  • display_id (str) – id of display

  • line_id (str) – id of line

  • quantity – name of quantity being represented

  • scale (str) – scale of line

  • color (str) – color of line, randomly chosen if None

  • timeScale (str) – scale of time axis

Returns

None

Raises

ValueError – if provided display_id has not been created yet.

add_selection_to_event_output_file(event_output_file_id: str, event_id: str, select: str, event_port: str) None#

Add a column to the event output file with id event_output_file_id.

Parameters
  • event_output_file_id (str) – id of output file (must be created first using create_output_file)

  • event_id (str) – id of event to add

  • select (str) – selection to add

  • event_port (str) – event port to add

Returns

None

Raises

ValueError – if provided event_output_file_id has not been created yet.

assign_simulation_target(target: str) None#

Assign a simulation target.

Parameters

target (str) – id of target component

Returns

None

create_display(id: str, title: str, ymin: str, ymax: str, timeScale: str = '1ms') None#

Create a new display

Parameters
  • id (str) – id of display

  • title (str) – title of display

  • ymin (str) – min y value of display

  • ymax (str) – max y value of display

  • timeScale (str) – time scale of display

Returns

None

create_event_output_file(id, file_name, format='ID_TIME')#

Create a new output file for storing events recorded from simulations.

For storing other outputs (not events), please see create_output_file instead.

TODO: list what formats are available

Parameters
  • id (str) – id of output file

  • file_name (str) – name of output file

  • format (str) – format of file

Returns

None

create_output_file(id: str, file_name: str)#

Create a new output file for storing values recorded for a simulation.

For storing events, such as spikes, please see create_event_output_file.

Parameters
  • id (str) – id of output file

  • file_name (str) – name of output file

Returns

None

include_lems_file(lems_file_name: str, include_included: bool = True) None#

Include additional LEMS file in the simulation.

Parameters
  • lems_file_name (str) – name of LEMS file to include

  • include_included (bool) – toggle to include files included by provided LEMS file

Returns

None

include_neuroml2_file(nml2_file_name: str, include_included: bool = True, relative_to_dir: str = '.') None#

Include additional NeuroML2 file.

This will only add the provided file if it has not already been included.

Parameters
  • nml2_file_name (str) – name of NeuroML2 file to include

  • include_included (bool) – toggle to include any files included in the provided file

  • relative_to_dir (str) – directory relative to which the provided nml2_file_name is being provided

Returns

None

lems_info = {}#
my_random = <random.Random object>#
save_to_file(file_name: Optional[str] = None)#

Save LEMSSimulation to a file.

Parameters

file_name – name of file to store to. LEMS_<some id string>.xml is the suggested format. Leave empty to use LEMS_<sim_id>.xml :type file_name: str

Returns

name of file

Return type

str

set_report_file(report_file_name: str) None#

Set a report file.

The report file is a short file saved after simulation with run time, simulator version etc.

Parameters

report_file_name (str) – name of report file

Returns

None

to_xml() str#

Export simulation to XML.

Returns

XML representation

Return type

str