[Paraview] [EXT] Re: Is the PythonAnnotation documentation obsolete?
Dennis Conklin
dennis_conklin at goodyear.com
Fri Sep 9 13:28:28 EDT 2016
Utkarsh,
Okay, thanks for that explanation. I have some comments.
The documentation is very confusing and/or incomplete and misleading. Hovering over the expression box produces a popup which makes it seem as though t-index is the way to access things. No real distinction is made between Field, Cell and Point variables
<<The expression is evaluated and the resulting scalar value or numpy array is added to the output as an array>>
What?? The expression is added to the row data, which I have never seen or used before. And this is PythonAnnotation, not PythonCalculator - the object is to display it on the screen. So why can I only format Field data on the screen?
"Vertical Force: %g" %REACTZ_901 works and outputs formatted, labelled text on screen because it is a Field Variable
"FBFORCE1: %g" %FBFORCE[0] prints (error) to the screen because it is a cell variable. What is the point of including cell and point variables into an Annotation filter in a way which makes it impossible to format the annotation? I'm not able to think of a situation in which this is useful. Perhaps I'm not creative enough.
I couldn't find an explanation of all of this anywhere in the documentation, so my title for this thread stands. I think the documentation might be expanded a little. And I would suggest a new name of PythonFieldVariableAnnotation. I have used it to annotate Field Variables, but I don't know how I can use unlabeled, unformatted Cell or Point data annotations to add value to a picture or animation.
Re-reading this it seems harsher than I intended. Just my disappointment at not being able to Annotate Cell Values. I appreciate your support and explanations, I just would like to capture this information somewhere in the documentation.
Thanks again,
Dennis
-----Original Message-----
From: Utkarsh Ayachit [mailto:utkarsh.ayachit at kitware.com]
Sent: Friday, September 09, 2016 10:54 AM
To: Dennis Conklin <dennis_conklin at goodyear.com>
Cc: Paraview (paraview at paraview.org) <paraview at paraview.org>
Subject: [EXT] Re: [Paraview] Is the PythonAnnotation documentation obsolete?
Dennis,
Python Annotation only works with what's available in the current timestep. If you look at the "Field Data" in the SpreadSheet view, you'll see that the Exodus reader puts out an array with values for all timesteps for variables like REACTZ_901 and hence you can offset into it using t_index irrespective of which timestep you are at.
For Point/Cell data, you have access to the field values for all points/cells for the current timestep only. Thus, t_index doesn't make much sense for those cases. For understanding how indexing works when dealing with multblock datasets, I'd recommend reading Berk's blog post [1].
Hope that helps.
Utkarsh
[1] https://blog.kitware.com/improved-vtk-numpy-integration-part-5/
On Thu, Sep 8, 2016 at 2:32 PM, Dennis Conklin <dennis_conklin at goodyear.com> wrote:
> All,
>
>
>
> I have tried to use PythonAnnotation but it only seems to work
> properly with FieldVariables.
>
>
>
> So for instance, with field variables of REACTZ_901 and REACTZ_902,
> the following expressions work and display the values as expected
>
>
>
> REACTZ_901 displays array of values for all
> timesteps
>
> REACTZ_901[t_index] displays single number (no brackets)
>
> Int(REACTZ_901) (error)
>
> Int(REACTZ_901[t_index] displays truncated integer value (no
> brackets)
>
>
>
> To try to work with CellData I have made an ExtractSelection of a
> single Cell. I have a Cell variable of FBFORCE1
>
> I want to use PythonAnnotation to print out the FBFORCE1 for that cell
> over time (with formatting)
>
>
>
> FBFORCE1 [VTKArray([154.2])] shouldn’t
> this have a value for each timestep?
>
> FBFORCE1[t_index] (error)
>
> FBFORCE1[0] [ 154.2]
>
> FBFORCE1[1] (error)
>
> Int(FBFORCE1) (error)
>
> Int(FBFORCE1[0]) (error)
>
>
>
> 2nd try – Ran PythonAnnotation on an entire file – many cells, with
> following results
>
> FBFORCE1 VTKArray([ value1, value2
> ………value_final]) – seems like 1 value per timestep (shouldn’t there be
> array of # of cells by # of timesteps?
>
>
>
> FBFORCE1[t_index] [131.4] - again- should be array
> of # of cells? Which cell is this
>
> FBFORCE1[t_index][0] (error)
>
> Int(FBFORCE1[t_index]) error)
>
>
>
> So it seems that Field Variables are numpy-friendly in that formatting
> works with them, while Cell Variables are still VTK Array variables
> and not numpy-friendly.
>
>
>
> It’s possible that I am completely missing something here, but it
> seems Cell Variables are not very useable in the PythonAnnotation. Is
> there a way for me to Annotate with individual cell values, either by
> running PythonAnnotation on a single cell, or by manipulating the
> variables which are available in the filter?
>
>
>
> At this point I don’t know why Cell and Point Variables are included
> in the filter since I can only figure out how to use Field Variables
>
>
>
> Thanks for any hints
>
>
>
> Dennis
>
>
> _______________________________________________
> 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
>
More information about the ParaView
mailing list