Skip to content
  • Search
Skins
  • Light
  • Brite
  • 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. Analysis & Postprocessing
  4. Post analysis in python code

Post analysis in python code

Scheduled Pinned Locked Moved Analysis & Postprocessing
2 Posts 2 Posters 1.4k Views 2 Watching
  • 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.
  • F Offline
    F Offline
    Fariba_karimi
    wrote on last edited by
    #1

    Dear supporter,
    I run neurostimulation in Sim4LifeLight V 5.0.1.4765 and then, I plot my results by means of following code:
    #start of my code
    def AnalyzeSimulation(sim):
    import s4l_v1.analysis as analysis
    import s4l_v1.analysis.neuron_evaluators

    # Create extractor for a given simulation output file
    results = sim.Results()
    
    inputs = []
    for sensor in results.keys():
    	if "PointSensor" in sensor:
    		sensor_extractor = results[sensor]
    		document.AllAlgorithms.Add(sensor_extractor)
    		sensor_extractor.Update()
    		inputs.append(sensor_extractor["v"])
    		
    plot_viewer = analysis.viewers.PlotViewer(inputs=inputs)
    plot_viewer.Update()
    document.AllAlgorithms.Add(plot_viewer)
    

    AnalyzeSimulation(simNeuro)
    #end of my code
    I want to do some post processing on my plotted data, but unfortunately, I do not know how can I access data through python code.
    Thanks for your help.
    Fariba

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sylvain
      ZMT
      wrote on last edited by
      #2

      after the line sensor_extractor.Update() you can access the data using either:

      • sensor_extractor["v"].Data.GetComponent(0) (if 1D data)
      • sensor_extractor["v"].Data.Field(0) (if 3D data)

      these return the numpy array holding the raw data. Type dir(sensor_extractor["v"].Data) in the Console to get a list of available functions that can be useful for Data objects.

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      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