If you have the source code, you can look at the <pv source>/Plugins/CoProcessingScriptGenerator/cp_export.py. It might be a bit confusing but the section you'll want to look at is below. I think you're problem is that you don't have any slice object to get the data information from.<br>
<br>Andy<br><br>=========<br> if %s : # rescale data range<br> import math<br> for view in cp_views:<br> if timestep %% view.cpFrequency == 0 or datadescription.GetForceOutput() == True:<br> reps = view.Representations<br>
for rep in reps:<br> if hasattr(rep, 'Visibility') and rep.Visibility == 1 and hasattr(rep, 'MapScalars') and rep.MapScalars != '':<br> input = rep.Input<br>
input.UpdatePipeline() #make sure range is up-to-date<br> lut = rep.LookupTable<br> if lut == None:<br> continue<br> if rep.ColorAttributeType == 'POINT_DATA':<br>
datainformation = input.GetPointDataInformation()<br> elif rep.ColorAttributeType == 'CELL_DATA':<br> datainformation = input.GetCellDataInformation()<br>
else:<br> print 'something strange with color attribute type', rep.ColorAttributeType<br><br> if lut.VectorMode != 'Magnitude' or \<br>
datainformation.GetArray(rep.ColorArrayName).GetNumberOfComponents() == 1:<br> datarange = datainformation.GetArray(rep.ColorArrayName).GetRange(lut.VectorComponent)<br>
else:<br> datarange = [0,0]<br> for i in range(datainformation.GetArray(rep.ColorArrayName).GetNumberOfComponents()):<br> for j in range(2):<br>
datarange[j] += datainformation.GetArray(rep.ColorArrayName).GetRange(i)[j]*datainformation.GetArray(rep.ColorArrayName).GetRange(i)[j]<br> datarange[0] = math.sqrt(datarange[0])<br>
datarange[1] = math.sqrt(datarange[1])<br><br> rgbpoints = lut.RGBPoints.GetData()<br> numpts = len(rgbpoints)/4<br> minvalue = min(datarange[0], rgbpoints[0])<br>
maxvalue = max(datarange[1], rgbpoints[(numpts-1)*4])<br> if minvalue != rgbpoints[0] or maxvalue != rgbpoints[(numpts-1)*4]:<br> # rescale all of the points<br>
oldrange = rgbpoints[(numpts-1)*4] - rgbpoints[0]<br> newrange = maxvalue - minvalue<br> newrgbpoints = list(rgbpoints)<br> for v in range(numpts):<br>
newrgbpoints[v*4] = minvalue+(rgbpoints[v*4] - rgbpoints[0])*newrange/oldrange<br><br> lut.RGBPoints.SetData(newrgbpoints)<br><br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 6:35 AM, Kisler <span dir="ltr"><<a href="mailto:Roman.Kisler@tnt.tu-berlin.de" target="_blank">Roman.Kisler@tnt.tu-berlin.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everyone,<br>
<br>
I write a python script (Paraview 3.14.1 64-bit) in which a loop loads files,<br>
makes slices etc., prints an image and deletes all variables within each<br>
iteration step. Therefore I need a python code which rescales the colorbar in<br>
each step.<br>
<br>
So far I found this code in another mailing conversation (see<br>
<a href="http://www.paraview.org/pipermail/paraview/2009-January/010809.html).Unfortunately" target="_blank">http://www.paraview.org/pipermail/paraview/2009-January/010809.html).Unfortunately</a><br>
the command<br>
<br>
range=slice.GetDataInformation().GetPointDataInformation().GetArrayInformation(0).GetComponentRange(0)<br>
<br>
doesn't work in my script and delivers the following error message:<br>
<br>
" AttributeError: 'NoneType' object has no attribute 'GetDataInformation' "<br>
<br>
and refers to the line written above (range=...).<br>
<br>
I would appreciate any help, be it a more detailed explanation of the script<br>
which can be found in the link posted above or another possibility of<br>
implementing it.<br>
<br>
Kindest regards,<br>
Roman<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</blockquote></div><br>