Animation issues with saving files and Python trace

Hi,

This topic probably has multiple issues but they may be related so I figured I’d put it all together. I’m using ParaView 5.9 downloaded from the main location. What I wanted to do was to load a time-series data, use a Slice filter, animate the location of that slice filter plane’s location through the Slice Offset Values and save that as a time series dataset. In addition, I wanted to use the Python trace on the entire workflow for later use. The generated Python trace output was (note that I disabled the output of rendering components in the Python trace since I just wanted the data files):

# trace generated using paraview version 5.9.0

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# create a new 'XML Partitioned Image Data Reader'
input_ = XMLPartitionedImageDataReader(registrationName='input_*', FileName=['/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_0.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_5.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_10.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_15.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_20.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_25.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_30.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_35.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_40.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_45.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_50.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_55.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_60.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_65.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_70.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_75.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_80.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_85.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_90.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_95.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_99.pvti'])
input_.CellArrayStatus = ['pressure']
input_.PointArrayStatus = ['velocity']

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()

UpdatePipeline(time=0.0, proxy=input_)

# rename source object
RenameSource('input', input_)

# create a new 'Slice'
slice1 = Slice(registrationName='Slice1', Input=input_)
slice1.SliceType = 'Plane'
slice1.HyperTreeGridSlicer = 'Plane'
slice1.SliceOffsetValues = [0.0]

# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [35.0, 33.0, 28.6]

# init the 'Plane' selected for 'HyperTreeGridSlicer'
slice1.HyperTreeGridSlicer.Origin = [35.0, 33.0, 28.6]

UpdatePipeline(time=0.0, proxy=slice1)

# get animation track
slice1ContourValuesTrack = GetAnimationTrack('ContourValues', index=-1, proxy=slice1)

# create keyframes for this animation track

# create a key frame
keyFrame15535 = CompositeKeyFrame()
keyFrame15535.KeyValues = [-55.96391694654691]

# create a key frame
keyFrame15536 = CompositeKeyFrame()
keyFrame15536.KeyTime = 1.0
keyFrame15536.KeyValues = [55.96391694654691]

# initialize the animation track
slice1ContourValuesTrack.KeyFrames = [keyFrame15535, keyFrame15536]

# save data
SaveData('/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/timedslice.vtp', proxy=slice1, PointDataArrays=['velocity'],
    CellDataArrays=['pressure'],
    FieldDataArrays=['TimeValue', '__CatalystChannel__'],
    Writetimestepsasfileseries=1)

So a couple of issues here:

  1. When I saved the data in the GUI it didn’t animate the location of the slice plane Slice Offset Values property though it did generate the time series data properly. The animation was set up correctly though since if I played the animation with the VCR controls I see the slice plane moving.
  2. The Python trace isn’t capturing the modifications to the animation KeyValue changes. I changed them from -55.96391694654691 to -10 and 55.96391694654691 to 10.
  3. If I run the script with pvpython the slice location also doesn’t move though this is probably to be expected.

So which of the above issues are expected behaviors and which ones are bugs? Note that I also tried animating the slice plane through the filter’s Slice.Origin value and had similar results.

Thanks,
Andy

  1. SaveData does not animate, it simply saves the temporal data as seen by the pipeline. Try the Extractors instead. They will animate the scene and then generate extracts per timestep.
  2. Sounds like a bug indeed.
  3. See 1. Same reason as 1.

Thanks for the reply. It looks like the Extractors output isn’t capturing the animation information. Below is what 5.9 is outputting:

# script-version: 2.0
# Catalyst state generated using paraview version 5.9.0

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------

# create a new 'XML Partitioned Image Data Reader'
input = XMLPartitionedImageDataReader(registrationName='input', FileName=['/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_0.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_5.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_10.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_15.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_20.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_25.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_30.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_35.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_40.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_45.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_50.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_55.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_60.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_65.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_70.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_75.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_80.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_85.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_90.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_95.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_99.pvti'])
input.CellArrayStatus = ['pressure']
input.PointArrayStatus = ['velocity']

# create a new 'Slice'
slice1 = Slice(registrationName='Slice1', Input=input)
slice1.SliceType = 'Plane'
slice1.HyperTreeGridSlicer = 'Plane'
slice1.SliceOffsetValues = [0.0]

# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [35.0, 33.0, 28.6]

# init the 'Plane' selected for 'HyperTreeGridSlicer'
slice1.HyperTreeGridSlicer.Origin = [35.0, 33.0, 28.6]

# ----------------------------------------------------------------
# setup extractors
# ----------------------------------------------------------------

# create extractor
vTP1 = CreateExtractor('VTP', slice1, registrationName='VTP1')
# trace defaults for the extractor.
# init the 'VTP' selected for 'Writer'
vTP1.Writer.FileName = 'Slice1_%.6ts.pvtp'

# ----------------------------------------------------------------
# restore active source
SetActiveSource(vTP1)
# ----------------------------------------------------------------

# ------------------------------------------------------------------------------
# Catalyst options
from paraview import catalyst
options = catalyst.Options()
options.GlobalTrigger = 'TimeStep'
options.CatalystLiveTrigger = 'TimeStep'

# ------------------------------------------------------------------------------
if __name__ == '__main__':
    from paraview.simple import SaveExtractsUsingCatalystOptions
    # Code for non in-situ environments; if executing in post-processing
    # i.e. non-Catalyst mode, let's generate extracts using Catalyst options
    SaveExtractsUsingCatalystOptions(options)

If I modify the script to include animation information it seems to work with pvpython but not with the Catalyst/CxxImageDataExample (the slice plane moves properly when running the script with pvpython but not when running through Catalyst). The modified script is:

# script-version: 2.0
# Catalyst state generated using paraview version 5.9.0

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# get animation scene
animationScene1 = GetAnimationScene()

# update animation scene based on data timesteps
animationScene1.UpdateAnimationUsingDataTimeSteps()


# ----------------------------------------------------------------
# setup the data processing pipelines
# ----------------------------------------------------------------

# create a new 'XML Partitioned Image Data Reader'
input = XMLPartitionedImageDataReader(registrationName='input', FileName=['/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_0.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_5.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_10.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_15.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_20.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_25.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_30.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_35.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_40.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_45.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_50.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_55.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_60.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_65.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_70.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_75.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_80.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_85.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_90.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_95.pvti', '/home/acbauer/Code/ParaView/JUNK/Catalyst/CxxImageDataExample/input_99.pvti'])
input.CellArrayStatus = ['pressure']
input.PointArrayStatus = ['velocity']

# create a new 'Slice'
slice1 = Slice(registrationName='Slice1', Input=input)
slice1.SliceType = 'Plane'
slice1.HyperTreeGridSlicer = 'Plane'
slice1.SliceOffsetValues = [0.0]

# init the 'Plane' selected for 'SliceType'
slice1.SliceType.Origin = [35.0, 33.0, 28.6]

# init the 'Plane' selected for 'HyperTreeGridSlicer'
slice1.HyperTreeGridSlicer.Origin = [35.0, 33.0, 28.6]

# get animation track
slice1ContourValuesTrack = GetAnimationTrack('ContourValues', index=-1, proxy=slice1)

# create keyframes for this animation track

# create a key frame
keyFrame15535 = CompositeKeyFrame()
keyFrame15535.KeyValues = [-10.]

# create a key frame
keyFrame15536 = CompositeKeyFrame()
keyFrame15536.KeyTime = 1.0
keyFrame15536.KeyValues = [10.]

# initialize the animation track
slice1ContourValuesTrack.KeyFrames = [keyFrame15535, keyFrame15536]

# ----------------------------------------------------------------
# setup extractors
# ----------------------------------------------------------------

# create extractor
vTP1 = CreateExtractor('VTP', slice1, registrationName='VTP1')
# trace defaults for the extractor.
# init the 'VTP' selected for 'Writer'
vTP1.Writer.FileName = 'Slice1_%.6ts.pvtp'

# ----------------------------------------------------------------
# restore active source
SetActiveSource(vTP1)
# ----------------------------------------------------------------

# ------------------------------------------------------------------------------
# Catalyst options
from paraview import catalyst
options = catalyst.Options()
options.GlobalTrigger = 'TimeStep'
options.CatalystLiveTrigger = 'TimeStep'

# ------------------------------------------------------------------------------
if __name__ == '__main__':
    from paraview.simple import SaveExtractsUsingCatalystOptions
    # Code for non in-situ environments; if executing in post-processing
    # i.e. non-Catalyst mode, let's generate extracts using Catalyst options
    SaveExtractsUsingCatalystOptions(options)

So I can kind of get things to work in Catalyst by making the following changes to do_catalyst_execute() in v2_internals.py:

def do_catalyst_execute(module):
    log(log_level(), "called do_catalyst_execute %r", module)

    from paraview import servermanager
    if not servermanager.ActiveConnection:
        raise RuntimeError ("Missing active session")
    session = servermanager.ActiveConnection.Session
    controller = servermanager.ParaViewPipelineController()
    scene = controller.GetAnimationScene(session)
    scene.AnimationTime = _get_active_data_description().GetTime()
    scene.UpdateAnimationUsingDataTimeSteps()

    # call 'catalyst_execute' on module, if exists
    if hasattr(module, "catalyst_execute"):
        log(log_level(), "calling '%s.%s'", module.__name__, "catalyst_execute")

        dataDescription = _get_active_data_description()
        if dataDescription:
            info = CatalystV1Information(dataDescription)
        else:
            info = CatalystV2Information()
        module.catalyst_execute(info)
        return True

    return False

The issue here is that I think the AnimationTime wants to be scaled to values between 0 and 1 while for in situ processing the simulation may not know ahead of time how long the simulation will be running for, and thus impossible to scale. The only thing that comes close to specifying how long the simulation will be running for is for the extracts to specify when to stop outputting.