Displaying the corresponding value as the file changes during animation

I have a set of 15 vtk files. Each vtk file represents data at a given redshift " z ".
I want to create the animation of the given vtk files. i.e animation playing 15 vtk files
But during the animation, as the file changes, in the GUI I want to display the corresponding redshift " z " value too.
For reference
VTK file | Redshift Z

HI002 | 13.221
HI004 | 9.938
HI006 | 9.611
HI008 | 9.308
. up to HI030 redshift z = 7.221 )

So during the animation, first HI002 will be displayed then HI004 so on. So during the display of HI002 I want redshift z = 13.221 to be displayed alongside. Next, as HI004 is displayed I want redshift = 9.938 to be displayed and it should be continued up to HI030

I have created animation, The method I used was to use the python annotation filter and use the expression " Redshift Z =( 16.095 - ((16.095-7.221)*t_value)/12)"
But the problem here is that as the files change in the animation the corresponding redshift value isn’t displayed. It displays a different value. Please find the attached video here.

I can provide the VTK files too. Here is a file for reference
VTK: https://drive.google.com/open?id=16NE3L2Ue_Rz23ZHbhIpWgH0-Wdg_szJd

But can anyone help me with the problem that I am facing?
I will be grateful as I am working on my thesis project

please avoid one-upping topic, especially less than 24h after posting.

Looking at your video, I see the redshift changing, not sure what makes the visible value invalid.

I can’t download 1Gb of data right now.

Each file represents data at a particular redshfit “z” . So during the animation of 15 files, the visualization changes as the files changes right.
The present redshift values is invalid because it shows a different redshift value rather than the redshift value the file is corresponding to.

You are applying the solution determined in Display of variable to a different set of values. I wouldn’t expect that to work with an entirely different set of values.

Probably the simplest thing to do for this situation is to set the Expression in the Python Annotation filter to

[13.221, 9.938, 9.611, 9.308 ... 7.221][time_index]

Basically, you are explicitly defining the time values for each value in a Python list, then using ParaView’s current time_index to pick the value to display. This isn’t a general solution for every set of VTK files with variable defined for the entire dataset, but should be good enough to get you the result you need for your thesis project.

1 Like

Hey, @cory.quammen thank you for your reply.

I am getting the following error when I used your method.
I am using " sequence mode " in animation.

This works in " snap to timestamps mode" in animation. But it won’t work in “sequence mode”. Since saving animation in sequence mode gives a better result, I want to make it work in sequence mode.

Is there anything I am missing here?

following exception stack should provide additional developer specific information. This typically implies a malformed expression. Verify that the expression is valid.

Variables in current scope are [‘input’, ‘time_value’, ‘t_value’, ‘time_steps’, ‘t_steps’, ‘time_range’, ‘t_range’, ‘time_index’, ‘t_index’, ‘HIdensity’]

Traceback (most recent call last):
File “E:\Studies\ParaView-5.7.0-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\paraview\detail\annotation.py”, line 95, in execute
result = calculator.compute(inputs, expression, ns=ns)
File “E:\Studies\ParaView-5.7.0-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\paraview\detail\calculator.py”, line 143, in compute
retVal = eval(expression, globals(), mylocals)
File “”, line 1, in
TypeError: list indices must be integers or slices, not float

It works for me in 5.7 and 5.8 with “Sequence Mode” enabled. Make sure your list of values is the same length as the number of data files you have. If it is too short, you will get the error you are seeing.


I have attached the state file.
I have kept the list of values the same as the number of data files. But I am still getting the same error. I am using ParaView 5.8
This file takes a lot of time to load and run
Paraview_HI_state.pvsm (176.0 KB)

I have done the same thing using smaller data. You can check using this file
HI_data.pvsm (193.0 KB)


I am still not able to rectify the problem

Your expression in the state file is: [13.221, 9.938, 9.661, 9.308][time_value]. You need to change time_value to time_index and it should work fine.

Hello @cory.quammen

time_index doesn’t work in sequence mode hence I have kept it as time_value.
I am using sequence mode for better animation.

The first line of the error states this,

following exception stack should provide additional developer specific information. This typically implies a malformed expression. Verify that the expression is valid.

I am not able to understand why exactly the error is occurring.

time_index is available in ‘Sequence mode for me’. I don’t know why it isn’t available for you.

If it truly isn’t available on your system, you’ll have to figure out how to convert your floating point time_value to the right integer to use in the list index lookup. You can cast a floating point number to integer with int(5.5) for example. Good luck.

1 Like


Really appreciate your time and help. I have got the solution for my problem.

[13.221, 9.938…][int(time_value)].