<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, Jean.<br>
<br>
Thank you for helping. On your suggestion, I tried removing the
Fetch, but then I was getting empty objects. From googling around a
bit, I realized that I needed to call wake_out.UpdatePipeline()
before moving on.<br>
<br>
Because this is pretty ad-hoc, I'd prefer to avoid creating a
filter, and just keep the macro self-contained. I'm having
difficulty finding how to connect inputs and outputs. I've spent a
lot of time with google, and with the dir() command, but still don't
see how to get at the data.<br>
<br>
Thanks for your contiuned help. Below is what I currently have.<br>
<br>
Greg<br>
<br>
##########################<br>
# this part seems good<br>
<br>
filename =
'/raid/schussma/work2/ace3p/paraview/macros/wakeplot/wake.out'<br>
wake_out = CSVReader(FileName=filename,<br>
FieldDelimiterCharacters = ' ',<br>
HaveHeaders = 0)<br>
wake_out.UpdatePipeline() # this is necessary! blank objects
otherwise...<br>
<br>
##########################<br>
# here is the mystery<br>
<br>
di = wake_out.GetDataInformation()<br>
ri = di.GetRowDataInformation()<br>
<br>
scale = 1.0/ri.GetArrayInformation(2).GetComponentRange(0)[1]<br>
<br>
input = ??? # what goes here?<br>
<br>
import vtk<br>
newcol0 = vtk.vtkDoubleArray()<br>
newcol0.DeepCopy(input.GetColumn(1))<br>
<br>
for i in range(newcol0.GetNumberOfTuples()):<br>
newcol0.SetValue(i, scale * newcol0.GetValue(i)) # rescale<br>
<br>
output = ???.GetOutputDataObject(0)<br>
output.AddColumn(newcol0)<br>
<br>
##########################<br>
# this was good without the scaling<br>
<br>
pd = PlotData(???) # is no longer wake_out, correct?<br>
dr = Show(pd,<br>
XArrayName = 'Field 0',<br>
AttributeType = 'Row Data',<br>
SeriesVisibility = ['vtkOriginalIndices', '0'])<br>
<br>
Render()<br>
<br>
<br>
<br>
On 09/15/2011 02:05 AM, Favre Jean wrote:
<blockquote
cite="mid:0EB9B6375711A04B820E6B6F5CCA9F6812349DFB@MBX10.d.ethz.ch"
type="cite">
<div class="moz-text-plain" wrap="true" graphical-quote="true"
style="font-family: -moz-fixed; font-size: 24px;"
lang="x-western">
<pre wrap="">Greg,
I would not use Fetch to do what you need. Here is something that should work:
# reuse your wake_out proxy
di = wake_out.GetDataInformation()
rowInfo = di.GetRowDataInformation()
# get largest magnitude value from column 2
rowInfo.GetArrayInformation(1).GetComponentRange(0)[1]
#You then use a programmable filter with the following copy op.
#one deepcopy to get your initial array, and then you scale it the way you want
# you may discard the old array later
import vtk
input = self.GetInput()
newcol0 = vtk.vtkDoubleArray()
newcol0.DeepCopy(input.GetColumn(0))
for i in range(newcol0.GetNumberOfTuples()):
newcol0.SetValue(i, 2.0 * newcol0.GetValue(i)) # rescale by a factor of 2
output = self.GetOutputDataObject(0)
output.AddColumn(newcol0)
print output.GetNumberOfColumns()
-----------------
Jean M. Favre
Swiss National Supercomputing Center
</pre>
</div>
</blockquote>
<br>
</body>
</html>