snudda.utils.cut

class snudda.utils.cut.SnuddaCut(network_file, cut_equation='z>0', out_file_name=None, plot_only=False, show_plot=True)[source]

Cuts part of the volume, to simulate creating a slice of tissue, or other cut.

Constructor.

Parameters
  • network_file (str) – Path to network file

  • cut_equation (str) – Cut equation, e.g. “z>0”

  • out_file_name (str) – Path to new network file

  • plot_only (bool) – Only create a plot of cut

  • show_plot (bool) – Show plot on screen

filter_neurons_synapses(neuron_id, keep_flag=None, data_type='synapses')[source]

Filter synapse matrix, to only keep those synapses that belong to neuronID.

Parameters
  • neuron_id – Neuron ID to keep

  • keep_flag – Which synapses are available to pick from

  • data_type – “synapses” or “gapJunctions”

Returns

bool array with which synapses to keep

Return type

keep_flag

open_input_file(network_file)[source]

Opens original network_file

plot_cut(include_synapses=True, include_gap_junctions=True, show_plot=True)[source]

Plot the cut to verify it is what we want.

Parameters
  • include_synapses (bool) – Plot synapses?

  • include_gap_junctions (bool) – Plot gap junctions?

  • show_plot (bool) – Plot, or just write to file?

setup_output_file(out_file_name)[source]

Creates output network file, out_file_name

soma_inside(cut_equation_lambda)[source]

Check if soma are inside cut_equation_lambda. Returns a boolean numpy array.

synapses_inside(cut_equation_lambda, data_type='synapses')[source]

Check if synapses are inside cut_equation_lambda. Returns a numpy bool array.

Parameters
  • cut_equation_lambda – lambda function representing cut

  • data_type – e.g. ‘synapses’ or ‘gapJunctions’

write_cut_slice(cut_equation_lambda)[source]

Write cut slice to file.

Parameters

cut_equation_lambda – lamba function with cut equation