pynn_brainscales.brainscales2.examples.chip_plotter_usage_example.ChipPlotter

class pynn_brainscales.brainscales2.examples.chip_plotter_usage_example.ChipPlotter(do_label_synapses: Optional[bool, None] = False, has_grid: Optional[bool, None] = True, color_is_source: Optional[bool, None] = True, alpha: Optional[float, None] = 0.9, custom_title: Optional[str, None] = None, population_contrast_groups: Optional[dict, None] = None)

Bases: object

How to use: call __init__(**params) call add_plot_matrix(**params) or add_plot_chipmap(**params)

to add plots to plot_list

call plot_all() or plot_by_id(idint) to plot plots from

plot_list

call save_all(**params) or save_by_id(**params) to save plots

from plot_list

plot_list syntax: [{“plot_type”: plot_type, “fig”:fig,
“ax”:ax, “settings”:settings},

{“plot_type”: plot_type, “fig”:fig,

“ax”:ax, “settings”:settings},

…]

__init__(do_label_synapses: Optional[bool, None] = False, has_grid: Optional[bool, None] = True, color_is_source: Optional[bool, None] = True, alpha: Optional[float, None] = 0.9, custom_title: Optional[str, None] = None, population_contrast_groups: Optional[dict, None] = None)

Defaultsettings for when adding plots. Args: :param do_label_synapses: (bool) add labels for each

projection in plot legend

Parameters
  • has_grid – (bool) add grid to plot

  • color_is_source – (bool) color of synapses corresponds to color of presynaptic population

  • alpha – (float) opacity of data points on plot

  • custom_title – (string) set custom title for plot

  • population_contrast_groups – (list<dict<string:list<int>>>) separate population ids into different groups that show with contrasting colors on the plot

Methods

__init__([do_label_synapses, has_grid, …])

Defaultsettings for when adding plots. Args: :param do_label_synapses: (bool) add labels for each projection in plot legend :param has_grid: (bool) add grid to plot :param color_is_source: (bool) color of synapses corresponds to color of presynaptic population :param alpha: (float) opacity of data points on plot :param custom_title: (string) set custom title for plot :param population_contrast_groups: (list<dict<string:list<int>>>) separate population ids into different groups that show with contrasting colors on the plot.

add_plot_chip_map([do_label_synapses, …])

adds chipmap plot to plotlist default setting will be used if argument not specified Args: :param do_label_synapses: (bool) add labels for each projection in plot legend :param has_grid: (bool) add grid to plot :param color_is_source: (bool): color of synapses corresponds to color of presynaptic population :param alpha: (float) opacity of data points on plot :param custom_title: (string) set custom title for plot :param population_contrast_groups: (list<dict<string:list<int>>>) separate population :param ids: into different groups that show with contrasting colors on the plot :param neuron_height: (int) height of neuron rows in units of synapse rows on plot if separate view false :param center: (list<int,int>) center of plot if separate view false :param sort_synapse_by_padi_bus: (bool) if false, synapse y coordinate corresponds to physical location. If true, synapse y corresponds to location on padibus :param highlight_empty_rows: (bool) highlight unused synapse rows in grey :param separate_view: (bool) plot neuron and synapse placement in 2 subplots or together.

add_plot_matrix([do_label_synapses, …])

adds matrix plot to plotlist default setting will be used if argument not specified Args: :param do_label_synapses: (bool) add labels for each projection in plot legend :param has_grid: (bool) add grid to plot :param color_is_source: (bool) color of synapses corresponds to color of presynaptic population :param alpha: (float) opacity of data points on plot :param custom_title: (string) set custom title for plot :param population_contrast_groups: (list<dict<string:list<int>>>) separate population ids into different groups that show with contrasting colors on the plot :param plot_each_neuron: (bool) plot connections between each individual neuron, or just populations

clear_all_plots()

clear_plot(plot_id)

convert_synapse_y_to_padi_coord(y_coord)

get_most_often_postneuron()

returns index of pop of most targetted, neuron on neuron matrix, most targetted neuron on neuron matrix and how many times it is targetted

get_padibus_pop_counts()

return: {‘external’[padibus0 external row count, padibus1…]:, ‘onChip’:[padibus0 internal row count, padibus1…]}

modify_plot(plot_id, setting_name, …)

plot_all()

plot all plots in plot_list

plot_by_id(plot_id)

plot plot_list[id]

remove_plot(plot_id)

retrieve_data(neuron_map, synapse_map, …)

gathers data :param neuron_map: (bool) retrieve neuron map, syntax: [[pop0 neuron0 pos, pop0 neuron1 pos, pop0 neuron…], [pop1 neuron0 pos, pop1 neuron1 pos, pop1 neuron…],[pop…]] retrieve external pops list, syntax: [[popindex, popsize, neuroncount until this pop],…] :param synapse_map: (bool) retrieve synapse map, syntax: [[[pop1,pop2],[synapse_x,synapse_y], [synapse_x,synapse_y],…],…]

save_all([folder, name, formats, dpi])

save all plots

save_by_id(plot_id[, folder, name, formats, …])

saves one plot

add_plot_chip_map(do_label_synapses: Optional[bool, None] = None, has_grid: Optional[bool, None] = None, color_is_source: Optional[bool, None] = None, alpha: Optional[float, None] = None, custom_title: Optional[str, None] = None, population_contrast_groups: Optional[dict, None] = None, neuron_height: Optional[int, None] = 50, center: Optional[tuple, None] = None, sort_synapse_by_padi_bus: Optional[bool, None] = True, highlight_empty_rows: Optional[bool, None] = True, separate_view: Optional[bool, None] = False)

adds chipmap plot to plotlist default setting will be used if argument

not specified

Args: :param do_label_synapses: (bool) add labels for

each projection in plot legend

Parameters
  • has_grid – (bool) add grid to plot

  • color_is_source – (bool): color of synapses corresponds to color of presynaptic population

  • alpha – (float) opacity of data points on plot

  • custom_title – (string) set custom title for plot

  • population_contrast_groups – (list<dict<string:list<int>>>) separate population

  • ids – into different groups that show with contrasting colors on the plot

  • neuron_height – (int) height of neuron rows in units of synapse rows on plot if separate view false

  • center – (list<int,int>) center of plot if separate view false

  • sort_synapse_by_padi_bus – (bool) if false, synapse y coordinate corresponds to physical location. If true, synapse y corresponds to location on padibus

  • highlight_empty_rows – (bool) highlight unused synapse rows in grey

  • separate_view – (bool) plot neuron and synapse placement in 2 subplots or together

add_plot_matrix(do_label_synapses: Optional[bool, None] = None, has_grid: Optional[bool, None] = None, color_is_source: Optional[bool, None] = None, alpha: Optional[float, None] = None, custom_title: Optional[str, None] = None, population_contrast_groups: Optional[dict, None] = None, plot_each_neuron: Optional[bool, None] = False)

adds matrix plot to plotlist default setting will be used if argument not specified Args: :param do_label_synapses: (bool) add labels for each

projection in plot legend

Parameters
  • has_grid – (bool) add grid to plot

  • color_is_source – (bool) color of synapses corresponds to color of presynaptic population

  • alpha – (float) opacity of data points on plot

  • custom_title – (string) set custom title for plot

  • population_contrast_groups – (list<dict<string:list<int>>>) separate population ids into different groups that show with contrasting colors on the plot

  • plot_each_neuron – (bool) plot connections between each individual neuron, or just populations

clear_all_plots()
clear_plot(plot_id: int)
convert_synapse_y_to_padi_coord(y_coord: int)
get_most_often_postneuron()

returns index of pop of most targetted, neuron on neuron matrix, most targetted neuron on neuron matrix and how many times it is targetted

get_padibus_pop_counts()

return: {‘external’[padibus0 external row count, padibus1…]:, ‘onChip’:[padibus0 internal row count, padibus1…]}

modify_plot(plot_id: int, setting_name: str, new_setting_value)
plot_all()

plot all plots in plot_list

plot_by_id(plot_id: int)

plot plot_list[id]

remove_plot(plot_id: int)
retrieve_data(neuron_map: bool, synapse_map: bool, pop_matrix: bool, neuron_matrix: bool)dict

gathers data :param neuron_map: (bool) retrieve neuron map, syntax:

[[pop0 neuron0 pos, pop0 neuron1 pos, pop0 neuron…], [pop1 neuron0 pos, pop1 neuron1 pos, pop1 neuron…],[pop…]] retrieve external pops list, syntax: [[popindex, popsize, neuroncount until this pop],…]

Parameters
  • synapse_map – (bool) retrieve synapse map, syntax: [[[pop1,pop2],[synapse_x,synapse_y], [synapse_x,synapse_y],…],…]

  • pop_matrix – (bool) retrieve population matrix, syntax: [[proj0,[pre0_index,post0_index]], [proj1,[pre1_index,post1_index]], …]

  • neuron_matrix – (bool) retrieve neuron matrix, syntax: [[proj0,[pre0_index,post0_index],[[neuron0,neuron1], [neuron1,neuron5]]], [proj1,[pre1_index,post1_index], [],[[neuron0,neuron1],[neuron1,neuron5],[neuron2,neuron5]]], …]

save_all(folder: Optional[str, None] = '', name: Optional[str, None] = '', formats=None, dpi=900)

save all plots

Args: :param folder: (string) folder :param name: (string) file name :param formats: (list<string>) formats to be saved as, e.g. [‘png’, ‘pdf’] :param dpi: (int) resolution for png or jpeg

save_by_id(plot_id, folder: Optional[str, None] = '', name: Optional[str, None] = '', formats: Optional[list, None] = None, dpi: Optional[int, None] = 900, sub_name: Optional[str, None] = '')

saves one plot

Args: :param plot_id: (int) id of plot in plot_list to be saved :param folder: (string) folder :param name: (string) file name :param sub_name: (string) optional name behind name :param formats: (list<string>) formats to be saved as, e.g. [‘png’, ‘pdf’] :param dpi: (int) resolution for png or jpeg