Not sure what's going on. The attached script worked just fine for me. On Thu, Mar 30, 2017 at 1:02 PM, John Haase <jhaa...@nd.edu> wrote: > Utkarsh, > > Using the script attached, and the same data sets as before. I get the error > > Traceback (most recent call last): > > File "<string>", line 22, in <module> > > File "<string>", line 5, in RequestData > > File "C:\Program Files\ParaView > 5.2.0-Qt4-OpenGL2-Windows-64bit\bin\lib\site-packages\vtk\numpy_interface\dataset_adapter.py", > line 660, in append > > arrLength = narray.shape[0] > > IndexError: tuple index out of range > > > on the last line. > > Regards, > > John R. Haase > jhaa...@nd.edu > > On Thu, Mar 30, 2017 at 12:32 PM, Utkarsh Ayachit > <utkarsh.ayac...@kitware.com> wrote: >> >> John, >> >> That's the script for a "Programmable Filter", not simply to be added >> to your script, similar to what you're doing with `squareDiff`. >> >> e.g. >> >> myfilter = ProgrammableFilter(Input=integrateSqrVarOverSpace) >> myfilter.Script = "...." # the script I provided. >> myfilter.UpdatePipeline() >> ... >> >> Utkarsh >> >> On Thu, Mar 30, 2017 at 12:09 PM, John Haase <jhaa...@nd.edu> wrote: >> > Exploring 'integrateSqrVarOverSpace', it doesn't have a 'RowData' >> > object. >> > >> > dir(integrateSqrVarOverSpace) >> > >> > ['CellData', 'FieldData', 'FileNameChanged', 'GetCellDataInformation', >> > 'GetDataInformation', 'GetFieldDataInformation', >> > 'GetPointDataInformation', >> > 'GetProperty', 'GetPropertyValue', 'Initialize', 'InitializeFromProxy', >> > 'Input', 'ListProperties', 'Observed', 'ObserverTag', >> > 'OnlyReportSelectionStatistics', 'PointData', 'Port', 'SMProxy', >> > 'Selection', 'SetPropertyWithName', 'UpdatePipeline', >> > 'UpdatePipelineInformation', '_Proxy__ConvertArgumentsAndCall', >> > '_Proxy__GetActiveCamera', '_Proxy__LastAttrName', '_Proxy__Properties', >> > '__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__eq__', >> > '__format__', '__getattr__', '__getattribute__', '__getitem__', >> > '__hash__', >> > '__init__', '__iter__', '__module__', '__ne__', '__new__', '__reduce__', >> > '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', >> > '__subclasshook__', '__weakref__', 'add_attribute'] >> > >> > >> > So, using the script you posted, I get the error "IndexError: tuple >> > index >> > out of range". >> > >> > >> > Regards, >> > >> > John R. Haase >> > jhaa...@nd.edu >> > >> > On Thu, Mar 30, 2017 at 10:35 AM, Utkarsh Ayachit >> > <utkarsh.ayac...@kitware.com> wrote: >> >> >> >> Isn't that simply a sum of all the rows in the output of >> >> integrateSqrVarOverSpace filter? >> >> >> >> If so, that can be done by using another ProgrammableFilter with the >> >> following Script: >> >> >> >> from numpy import sum >> >> for inTable, outTable in zip(inputs[0], output): >> >> >> >> for aname in inTable.RowData.keys(): >> >> >> >> outTable.RowData.append(sum(inTable.RowData[aname]), aname) >> >> >> >> >> >> Utkarsh >> >> >> >> >> >> >> >> >> >> On Wed, Mar 29, 2017 at 1:15 PM, John Haase <jhaa...@nd.edu> wrote: >> >>> >> >>> Sorry, that's not what I wanted. I want to integrate the variable >> >>> "integrateSqrVarOverSpace", over time as well. >> >>> >> >>> Regards, >> >>> >> >>> John R. Haase >> >>> jhaa...@nd.edu >> >>> >> >>> On Wed, Mar 29, 2017 at 1:05 PM, Utkarsh Ayachit >> >>> <utkarsh.ayac...@kitware.com> wrote: >> >>>> >> >>>> Your script worked for me for the most part with ParaView 5.3. All I >> >>>> did >> >>>> was added a plot view to show the results (attached). If that what >> >>>> you were >> >>>> looking for? >> >>>> >> >>>> On Wed, Mar 29, 2017 at 12:30 PM, John Haase <jhaa...@nd.edu> wrote: >> >>>>> >> >>>>> They are very large. I believe you should be able to access them >> >>>>> through this link >> >>>>> >> >>>>> https://notredame.box.com/s/qy0p9y5jg71jwxtzfey80xiq9i9udk5s >> >>>>> >> >>>>> Regards, >> >>>>> >> >>>>> John R. Haase >> >>>>> jhaa...@nd.edu >> >>>>> >> >>>>> On Wed, Mar 29, 2017 at 12:06 PM, Utkarsh Ayachit >> >>>>> <utkarsh.ayac...@kitware.com> wrote: >> >>>>>> >> >>>>>> John, >> >>>>>> >> >>>>>> Can you send me the datafiles too (feel free to do it off the >> >>>>>> mailing >> >>>>>> list) so I can figure out what could be going wrong. >> >>>>>> >> >>>>>> Thanks >> >>>>>> Utkarsh >> >>>>>> >> >>>>>> On Wed, Mar 29, 2017 at 12:01 PM, John Haase <jhaa...@nd.edu> >> >>>>>> wrote: >> >>>>>>> >> >>>>>>> Hello Paraviewers, >> >>>>>>> >> >>>>>>> I'm trying to integrate variables over time. I found this thread >> >>>>>>> where it had been brought up previously. >> >>>>>>> >> >>>>>>> >> >>>>>>> >> >>>>>>> http://paraview.markmail.org/search/?q=integral+over+time#query:integral%20over%20time+page:1+mid:z75bede26onth4eu+state:results >> >>>>>>> >> >>>>>>> However, when I try and open the state file, paraview crashes. So >> >>>>>>> what commands do I use to do the integral over time? I'm trying to >> >>>>>>> integrate >> >>>>>>> a PlotSelectionOverTime filter (with row data). >> >>>>>>> >> >>>>>>> I'm doing this programmatically, so attached is the python script. >> >>>>>>> I >> >>>>>>> have so far. >> >>>>>>> >> >>>>>>> Regards, >> >>>>>>> >> >>>>>>> John R. Haase >> >>>>>>> jhaa...@nd.edu >> >>>>>>> >> >>>>>>> _______________________________________________ >> >>>>>>> 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 >> >>>>>>> >> >>>>>>> Search the list archives at: >> >>>>>>> http://markmail.org/search/?q=ParaView >> >>>>>>> >> >>>>>>> Follow this link to subscribe/unsubscribe: >> >>>>>>> http://public.kitware.com/mailman/listinfo/paraview >> >>>>>>> >> >>>>>> >> >>>>> >> >>>> >> >>> >> >> >> > > >
#### import the simple module from the paraview from paraview.simple import * import glob, re, os
def CreateCellSelection(ids): source = IDSelectionSource() source.FieldType = "CELL" sids = [] for i in ids: sids.append(0) #proc-id sids.append(i) #cell-id source.IDs = sids return source path = 'C:\\Users\\John\\Box Sync\\paraview\\' files = ['SteadyState_out.e', 'FinalCycle_out.e' ] reader = [] for idx, fl in enumerate(files): reader.append(ExodusIIReader(FileName=path+fl)) reader[idx].GenerateObjectIdCellArray = 1 reader[idx].GenerateGlobalElementIdArray = 1 ElementVariables = reader[idx].ElementVariables.Available ElementVariables.remove('x') reader[idx].ElementVariables = ElementVariables reader[idx].PointVariables = reader[idx].PointVariables.Available reader[idx].ElementBlocks = reader[idx].ElementBlocks.Available reader[-1].ElementVariables = reader[-1].ElementVariables.Available temporalShift = [] for idx, r in enumerate(reader): temporalShift.append(TemporalShiftScale(Input=r)) temporalShift[idx].PreShift = -r.TimestepValues[0] squareDiff = ProgrammableFilter(Input=temporalShift) script = "output.CellData.append(inputs[-1].CellData['x'], 'x')\n" for var in reader[0].ElementVariables: script=script + "output.CellData.append((inputs[0].CellData['" + var + "'] - inputs[1].CellData['" + var + "'])**2 , '" + var + "')\n" squareDiff.Script=script squareDiff.UpdatePipeline() integrateVariables = IntegrateVariables(Input=squareDiff) selection = CreateCellSelection(ids=[0]) integrateSqrVarOverSpace = PlotSelectionOverTime(Input=integrateVariables, Selection=selection) integrateSqrVarOverSpace.OnlyReportSelectionStatistics = 0 integrateSqrVarOverSpace.UpdatePipeline() integrateSqrVarOverST = ProgrammableFilter(Input=integrateSqrVarOverSpace) integrateSqrVarOverST.Script = """ from numpy import sum for inTable, outTable in zip(inputs[0], output): for aname in inTable.RowData.keys(): outTable.RowData.append(sum(inTable.RowData[aname]), aname) """ integrateSqrVarOverST.UpdatePipeline()
_______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview