Skip to content
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

ZMT zurich med tech

  1. Home
  2. Sim4Life
  3. Simulations & Solvers
  4. T-Neuro
  5. Calculation of Selectivity Indices - Python API

Calculation of Selectivity Indices - Python API

Scheduled Pinned Locked Moved T-Neuro
selectivityindexneuron
1 Posts 1 Posters 656 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • AntoninoMCA Offline
    AntoninoMCA Offline
    AntoninoMC
    wrote on last edited by AntoninoMC
    #1

    Selectivity indices quantify how much a well defined electrostimulation setup (intended as the combination of and electrode geometry, electrode configuration and pulse shape) is able to recruit a specific (target) group of axons without recruiting the other axons in the system.
    Each group could be a spinal cord root, a fascicle within a complex multi-fascicular nerve models, or a collection of axons based on population characteristics e.g. fiber type (myelinated or unmyelinated), distribution of axon diameters, etc.

    A definition of selectivity indices can be found in this publication:
    Raspopovic S, Capogrosso M, Micera S. A computational model for the stimulation of rat sciatic nerve using a transverse intrafascicular multichannel electrode. IEEE Trans Neural Syst Rehabil Eng. 2011 Aug;19(4):333-44

    In Sim4life, the selectivity function is part of the Action Potential Sensor available as post-processing step in the Analysis Tab. In order to use it, the user must assign each axon/neuron in the simulation to a specific group. Groups are identified by numbers (group 1, group 2, etc.). This can be done using the GUI or using the Python API.

    The following script permit to set up the groups based on the name of the axon and the folder in the Model panel they belong to (I suggest to create subfolders in the Model panel, each one containing only axons of the same group).

    # -*- coding: utf-8 -*-
    import numpy
    import s4l_v1.analysis as analysis
    import s4l_v1.document as document
    import s4l_v1.model as model
    import s4l_v1.units as units
    from s4l_v1 import Unit
    
    ###################################################################################
    # Author:      Dr. Antonino M. Cassara'
    # Date:        13/04/2021
    ###################################################################################
    
    # Gets the Neuronal Simulation Name
    neuronsimname="Neuron_Simulation"
    
    # Adding a new SimulationExtractor
    simulation = document.AllSimulations[neuronsimname]
    simulation_extractor_2 = simulation.Results()
    
    # Adding a new SensorExtractor
    sensor_extractor = simulation_extractor_2["Action Potential Sensor"]
    document.AllAlgorithms.Add(sensor_extractor)
    
    # Adding a new SelectivityEvaluator
    inputs = [sensor_extractor.Outputs["Action Potential"]]
    selectivity_evaluator = analysis.neuron_evaluators.SelectivityEvaluator(inputs=inputs)
    selectivity_evaluator.UpdateAttributes()
    document.AllAlgorithms.Add(selectivity_evaluator)
    
    ## Gets the Group Names and assigns an ID - The group Names ares the Folder Names##
    neurons=simulation.GetNeuronEntities()
    groups=[]
    for neuro in neurons:
    	name=neuro.ParentGroup().Name
    	if name not in groups:
    		groups.append(name)
    
    ## Associates Each Fiber to Its Own Group. A group is the folder it belongs
    cnt=0
    for group in groups:
    	for neuro in neurons:
    		if group==neuro.ParentGroup().Name:
    			name=neuro.Name+'  ('+neuro.ParentGroup().Name+')'
    			selectivity_evaluator.SetNeuronAssignment(name,cnt)
    	cnt+=1
    selectivity_evaluator.Update()
    
    ## Extracts The Selectivity Maps
    select_map=selectivity_evaluator.SelectivityMap()
    cnt=0
    for key in select_map.keys():
    	print (key,groups[cnt],select_map[key])
    	cnt+=1
    
    # Adding a new DataTableHTMLViewer
    inputs = [selectivity_evaluator.Outputs["Selectivity score"]]
    data_table_html_viewer = analysis.viewers.DataTableHTMLViewer(inputs=inputs)
    data_table_html_viewer.Visible = False
    data_table_html_viewer.UpdateAttributes()
    document.AllAlgorithms.Add(data_table_html_viewer)
    
    1 Reply Last reply
    1
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Search