[Paraview] Python + ParaView
David E DeMarle
dave.demarle at kitware.com
Wed Jun 8 12:16:04 EDT 2011
The python programmable filter (and the easier to use python programmable
calculator variant of that) will get you beyond all of those limitations.
David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109
On Wed, Jun 8, 2011 at 12:11 PM, Nico Schlömer <nico.schloemer at gmail.com>wrote:
> > If you want to do arbitrary arithmetic, you will have to first
> > generate the array using something like a "Calculator" filter and then
> > color using the generated array.
>
> Oh, if I remember correctly I did look into this before, and found the
> calculator filter too limited on the arithmetics that you could
> perform. Is it still the case that you have a set of like ten
> functions (add, multiply, sine, cosine,...) to mix and match? I need
> to to something like
>
> for x in data_values:
> if x[0] > 0 and x[1] > 0
> return bla
> elseif ...
>
> -- atan2() that is.
>
>
> > Yes, RGBPoints defines the mapping between scalar and color. It's a
> > list of 4 tuples (scalar, r, g, b), repeated sequentially.
>
> Hm, I'll look into it. Where's the proper spot for documentation of this?
>
> Cheers,
> Nico
>
>
>
>
>
>
>
> On Wed, Jun 8, 2011 at 5:25 PM, Utkarsh Ayachit
> <utkarsh.ayachit at kitware.com> wrote:
> > Magnitude corresponds to the magnitude of a vector, so yes, it takes
> > the square root.
> >
> > If you want to do arbitrary arithmetic, you will have to first
> > generate the array using something like a "Calculator" filter and then
> > color using the generated array.
> >
> > Yes, RGBPoints defines the mapping between scalar and color. It's a
> > list of 4 tuples (scalar, r, g, b), repeated sequentially.
> >
> > Utkarsh
> >
> > On Wed, Jun 8, 2011 at 11:19 AM, Nico Schlömer <nico.schloemer at gmail.com>
> wrote:
> >> Thanks for the hints.
> >>
> >> The Trace function in indeed quite useful in that it get you where you
> >> want to be. When looking at the code there's still a lot of me to
> >> understand though, the GetLookupTableForArray() call seems to be
> >> crucial for example.
> >>
> >> * The VectorMode='Magnitude' parameter seems to be responsible for
> >> merging the two components into one scalar, but I'm not quite sure how
> >> this is done: with a sqrt() or without? Is is possible to customize
> >> this? I'd like to have something like ATAN2 there as well.
> >>
> >> * Is the RGBPoints=[0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0],
> >> parameter responsible for the colormap?
> >>
> >> Cheers,
> >> Nico
> >>
> >>
> >>
> >>
> >>
> >> On Wed, Jun 8, 2011 at 3:13 PM, Utkarsh Ayachit
> >> <utkarsh.ayachit at kitware.com> wrote:
> >>> The following wiki page talks about how to color using arrays:
> >>>
> http://www.paraview.org/Wiki/ParaView/Python_Scripting#Representations_and_Views
> >>>
> >>> The easiest way to figure out Python code equivalents is to use the
> >>> Trace functionality to generate python trace files for actions
> >>> performed in the GUI (accessible from Tools menu). You "Start Trace",
> >>> do a set of actions and then "Stop Trace" and you should be able to
> >>> view the resulting Python code.
> >>>
> >>> Utkarsh
> >>>
> >>>
> >>>
> >>> On Wed, Jun 8, 2011 at 9:05 AM, Nico Schlömer <
> nico.schloemer at gmail.com> wrote:
> >>>> Hi,
> >>>>
> >>>> I'm just taking first steps with ParaView's Python interface and
> >>>> figured out so far that
> >>>>
> >>>> ================ *snip* ================
> >>>> exodusReader = ExodusIIReader( FileName="solution.e" )
> >>>> Show( exodusReader )
> >>>> Render()
> >>>> ================ *snap* ================
> >>>>
> >>>> would plot the mesh that is stored in the ExodusII file solution.e,
> >>>> and that can play around with GetActiveView() to adjust camera angles
> >>>> and such.
> >>>>
> >>>> What I haven't found out though is how to plot actual point data. I
> get
> >>>>
> >>>>
> >>>>>>> exodusReader.PointData[:]
> >>>> [Array: GlobalNodeId, Array: PedigreeNodeId, Array: A, Array: psi,
> >>>> Array: thickness]
> >>>>
> >>>> and l'm looking at the 2-component array "psi". For example, I'd like
> >>>> to do something like
> >>>>
> >>>> res = sqrt( component1**2 + component2**2 )
> >>>>
> >>>> and have res[:] rendered on the mesh with a certain color map.
> >>>>
> >>>> Any hints?
> >>>>
> >>>> Cheers,
> >>>> Nico
> >>>> _______________________________________________
> >>>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110608/91240770/attachment-0001.htm>
More information about the ParaView
mailing list