connectome_manipulator.model_building.pos_mapping

Module for building position mapping models based on a flatmap

connectome_manipulator.model_building.pos_mapping.build(nrn_ids, flat_pos, **_)[source]

Builds a flat space position mapping model from data.

Parameters:
  • nrn_ids (list-like) – List of mapped neuron IDs, as returned by extract()

  • flat_pos (numpy.ndarray) – Table of mapped neuron positions in 3D flat space of size <#neurons x 3>, as returned by extract()

Returns:

Resulting position mapping model

Return type:

connectome_manipulator.model_building.model_types.PosMapModel

connectome_manipulator.model_building.pos_mapping.extract(circuit, flatmap_path, xy_file, z_file, xy_scale=None, z_scale=None, nodes_pop_name=None, NN_only=False, CV_dict=None, **_)[source]

Extracts a position mapping from 3D atlas space (x/y/z) to 3D flat space (flat-x/flat-y/depth) of a given population of neurons.

Parameters:
  • circuit (bluepysnap.Circuit) – Input circuit

  • flatmap_path (str) – Base path to a flatmap

  • xy_file (str) – Filename of x/y mapping file as part of the flatmap

  • z_file (str) – Filename of z (= cortical depth) mapping file as part of the flatmap

  • xy_scale (list-like) – Two-element list with x/y scaling factors from a.u. (as in flatmap) to um

  • z_scale (float) – Scalar value with z scaling factor from a.u. (as in flatmap) to um

  • nodes_pop_name (str) – Name of SONATA nodes population to extract data from

  • NN_only (bool) – If selected, only nearest-neighbor interpolation will be used for position mapping (faster); otherwise, linear interpolation is applied, if possible (slower)

  • CV_dict (dict) – Cross-validation dictionary - Not supported

Returns:

Dictionary containing the extracted data elements, i.e., neuron positions in original and flat space

Return type:

dict

connectome_manipulator.model_building.pos_mapping.plot(out_dir, nrn_ids, nrn_lay, nrn_pos, model, **_)[source]

Visualizes neuron positions in original space vs. mapped space from model output.

Parameters:
  • out_dir (str) – Path to output directory where the results figures will be stored

  • nrn_ids (list-like) – List of mapped neuron IDs, as returned by extract()

  • nrn_lay (list-like) – List of layer property values for all mapped neurons, as returned by extract()

  • nrn_pos (numpy.ndarray) – Table of original neuron positions in 3D atlas space of size <#neurons x 3>, as returned by extract()

  • model (connectome_manipulator.model_building.model_types.PosMapModel) – Resulting position mapping model, as returned by build()