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. Python API
  4. read output files

read output files

Scheduled Pinned Locked Moved Python API
3 Posts 2 Posters 1.7k 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.
  • M Offline
    M Offline
    michaelsch
    wrote on last edited by
    #1

    hi
    after simulation completed saved files :
    input.h5
    output.h5

    i want to use python to read the output data voltages x,y,z as generated after simulation completed

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

      Hi,
      I would recommend to perform the postprocessing in the GUI first, then right-click in the Explorer window of the Analysis tab and select "To-Python" in the context menu. This will generate a script (visible in the Scripter window) that reproduces your postprocessing pipeline. You can then modify the script to your liking.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        michaelsch
        wrote on last edited by michaelsch
        #3

        solved with h5py read :
        import h5py

        with h5py.File(fname,'r') as hdf:
        FieldGroups=hdf['FieldGroups']
        keygroup = list(FieldGroups.keys())
        valField = FieldGroups[keygroup[0]]
        AllFields = valField['AllFields']
        EMPotential = AllFields['EM Potential(x,y,z,f0)']
        EMPotentialObject = EMPotential['_Object']
        AdditionalFieldDataCollection =
        EMPotentialObject['AdditionalFieldDataCollection']
        Snapshots = EMPotentialObject['Snapshots']
        Potential = Snapshots['0']['comp0']

        #(n, m, k, 2)  numpy array
        PotentialData = Potential[()]
        

        ==========
        this can be plotted
        import pyvista as pv

        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