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