Hello,
I am trying to plot my data over a moving probe location in time. Currently, I use the probe location to extract the local data and I know beforehand the movement of the probe over time (just along a simple line). This movement I can also animate with the animation view, by setting the coordinates of the location.
Now I would like to plot the local data over time, at the location of the moving probe. My first idea was to just use the plot over time filter. But as far as I can see it does not work: The plot is fixed at the location and plots the data over time at this fixed point, instead of moving with the probe.
Is there a direct way to achieve this, or do I have to read out the data at each time step manually?
Hopefully, it is clear what I am trying and I am grateful for any idea.
Thanks
Append a simplified case of what I want to do. The location of the probe is animated in Paraview and now I would like to plot my data over a line in time at the probe location. (If my data is called f, I want to plot f(t, x_probe(t))).
Adding the Plot Data Over Time filter seems to do exactly what you are describing. In this screenshot, I added the Plot Data Over Time filter to the Probe Location filter, turned off the Only Report Selection Statistics option, and turned off all fields except the f_5 field in the display.
The resulting plot seems to follow the value of the moving probe over time. In the screenshot above, you can see from the tooltip that the value on the plot matches what is reported in the information panel.
Here is a state file of what I did although like I said I just added this one filter.
But once the animation advances to the next time step the line from Plot Data Over Time changes (at least in my Paraview version). When observing the values at the probe in the SpreadSheedView one can see that they have a max. at t=0.5. I also want the corresponding line from the values of the SpreadSheedView, meaning a line that has a peak in the center
If I am not mistaken, it appears that Plot Data Over Time takes at each time step the current probe location, but then plots the time history at that current location. But does not consider that at the next time step, we need to evaluate at another location?
Maybe I just can not explain so well what I want to achieve…
Ah. I see what you are saying. Somehow I missed that the time plot was changing each timestep.
Now that I think about it, the problem is that the animation track is changing the position of the probe outside of the pipeline. So, when the Plot Data Over Time filter iterates its upstream over time outside of ParaView’s control, it does not move the probe location, and thus you get a different plot profile each timestep, which I see is not what you want.
What you need is something that can update the probe location based on the time without needing a ParaView animation track to set it. I can think of two ways to do it.
The first way would be to set up a Point Source and animate it just like you did for the probe location. Then save out that data (such as a series of .vtp files). Once you have saved the moving point, reset or restart ParaView and load both your data file and the point you just saved. Create a Resample With Dataset filter setting the Source Data Arrays to your mesh and the Destination Mesh to the moving point file you just created. That should make the animation of the moving probe, and should work when you add the Plot Data Over Time filter.
The second way is a little more complex but takes fewer steps. For this, just load your mesh data. Then, add a Programmable Filter. Set the Output Data Set Type to vtkPolyData. Set the Script to the following:
def GetUpdateTimestep(algorithm):
"""Returns the requested time value, or None if not present"""
executive = algorithm.GetExecutive()
outInfo = executive.GetOutputInformation(0)
return outInfo.Get(executive.UPDATE_TIME_STEP()) \
if outInfo.Has(executive.UPDATE_TIME_STEP()) else None
time = GetUpdateTimestep(self)
xLocation = 0.8 - (0.7/1.1)*time
import vtk
probeLocation = vtk.vtkPointSource()
probeLocation.SetNumberOfPoints(1)
probeLocation.SetRadius(0)
probeLocation.SetCenter(xLocation, 0.5, 0.5)
probe = vtk.vtkProbeFilter()
probe.SetInputConnection(probeLocation.GetOutputPort())
probe.SetSourceData(inputs[0].VTKObject)
probe.Update()
output.DeepCopy(probe.GetOutput())
This programmable filter is all you need to probe from the moving location. Add the Plot Data Over Time to this programmable filter, and it should work just fine.
Here is a state file implementing that second method: moving-probe.py (697 Bytes)