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