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. Python API
  4. Extract the EM E field along the Spline

Extract the EM E field along the Spline

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

    I want to extract the E field along the Spline from an EM simulation.
    My Sim4life version is V8.0.0.15165.
    Now I have a simple script that can extract the E field at a specific point, but there are still two Problems.
    First, how to get a series of points along the Spline?
    Then, how to project the E field to the direction vector of the Spline?

    SimulationName = 'test'
    PointPosition = (0.0, 0.0, 0.0)
    
    simulation = document.AllSimulations[SimulationName]
    simulation_extractor = simulation.Results()
    
    em_sensor_extractor = simulation_extractor["Overall Field"]
    document.AllAlgorithms.Add(em_sensor_extractor)
    
    efield_sensor = em_sensor_extractor['EM E(x,y,z,f0)']
    efield_sensor.Update()
    
    cell_index = efield_sensor.Data.Grid.FindCell(*PointPosition)
    point_index = efield_sensor.Data.Grid.ComputeCellIndex(*cell_index)
    point_efield = efield_sensor.Data.Field(0)[point_index]
    
    print(point_efield)
    

    In order to get the E field of the point, I use the cell index, but it seems a little complex.
    Is there any easier way to do that?
    In fact, I don't know the usage of parameter '0' in function 'Field', I just have a try and it works.
    Can anyone explain the meaning of this function and parameter?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      brown
      ZMT
      wrote on last edited by
      #2

      The parameter '0' is the 'snapshot' index. If you had a broadband simulation, and changed your field sensor to add certain 'Extracted Frequencies', you would change the snapshot accordingly.

      To extract the Etan, the easiest would be to interpolate onto your spline, then use the tangential field tool. See the attached gif. Then you can use 'To Python'.

      You can also investigate using the IMSAFE module if your license includes it.

      etan.gif

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aoshen
        wrote on last edited by
        #3

        Thank you so much for hour help with the technical issue!
        Your assistance made a big difference, and I truly appreciate your expertise and prompt support!

        1 Reply Last reply
        0
        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