[Paraview] Trying example in Paraview manual section 13.2.2 - can't get it to work

Adam Lyon lyon at fnal.gov
Thu Mar 12 02:55:24 EDT 2015


Hi, I'm trying to write a Python Programmable Source that can read files
based on a time stamp (e.g. pick the file using the "VCR" buttons in
Paraview). I see a nice example in the new Paraview manual (PDF) in section
13.2.2 - CSV file series, but I can't get that example to work. The
UPDATE_TIME_STEP is always a value like 0.11111, 0.22222, 0.33333, up to 1.
It's never from the set of times specified by the RequestInformation
script.   I'm using Paraview v4.3.1 64-bit Mac Yosemite. Here's what I
did...

I have a Programmable Source as the only item in my pipeline. The output
dataset type is vtkTable. The "Script" is,

# -- Script --
import numpy as np

def GetUpdateTimestep(algorithm):
    executive = algorithm.GetExecutive()
    outInfo = executive.GetOutputInformation(0)
    print outInfo.Get(executive.TIME_STEPS())
    return outInfo.Get(executive.UPDATE_TIME_STEP()) if
outInfo.Has(executive.UPDATE_TIME_STEP()) else None

req_time = GetUpdateTimestep(self)
a = np.array([req_time] )

output.RowData.append(a, "Adam")
#---------------

And the "RequestInformation" script is (taken verbatim from the example in
the manual)...

# -- RequestInformation --
def setOutputTimesteps(algorithm , timesteps):
    "helper routine to set timestep information"
    executive = algorithm.GetExecutive()
    outInfo = executive.GetOutputInformation(0)
    outInfo.Remove(executive.TIME_STEPS())

    for timestep in timesteps:
        outInfo.Append(executive.TIME_STEPS(), timestep)

    outInfo.Remove(executive.TIME_RANGE())
    outInfo.Append(executive.TIME_RANGE(), timesteps[0])
    outInfo.Append(executive.TIME_RANGE(), timesteps[-1])

setOutputTimesteps(self, (1.0, 2.0, 20.0, 30.0))
----

So as you can see, I'm just copying the value of UPDATE_TIME_STEP into the
output table, which I can look at in the spreadsheet view. When I hit the
"VCR buttons", the values I get are 0.111111, 0.222222, ... -- not the
values that I had set in TIME_STEPS.

Note that in the top script I have a line,
print outInfo.Get(executive.TIME_STEPS())
which prints out the right thing ... (1.0, 2.0, 20.0, 30.0)
I can print out TIME_RANGE and that's correct too (1.0, 30.0)

So I think everything is set correctly, but for some reason Paraview is
ignoring the settings. Do I need to call something to tell Paraview to
notice my changing of TIME_STEPS/TIME_RANGE?

Thanks in advance for any help!  -- Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150312/782417ae/attachment.html>


More information about the ParaView mailing list