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.
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
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.
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)
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.