[visit-users] queries in the python interface

Meredith, Jeremy S. jsmeredith at ornl.gov
Mon Mar 29 16:05:35 EDT 2010


Looks like the elementname isn't displayed symbolically yet -- sorry, I was trying this on the upcoming 2.0 beta, where it should do what you want.  You've done it correctly, but for the moment you'd have to convert the string (67,0,0) into ASCII "C", ie. carbon, which matches the "6" value you get for "element".

In python you could easily do this with "map", "chr", and a string join, e.g.:
if you had the value (72,103,0), 
>>> "".join(map(chr, (72,103)))
... would give you "Hg".

Like I said, this should happen automagically in 2.0.

--
Jeremy Meredith
Oak Ridge National Laboratory


> -----Original Message-----
> From: Valmor de Almeida [mailto:val.lists at gmail.com]
> Sent: Monday, March 29, 2010 3:26 PM
> To: VisIt software users community
> Subject: Re: [visit-users] queries in the python interface
> 
> 
> Thanks for letting me know the additional query function control.
> 
> 
> Am I doing this right?
> 
> >>> PickByNode(0, 0, ("elementname","element"))
> VisIt: Message -
> E:  complex-01.pdb  timestep 0
> mesh
> Point: <0.6145, -0.0375, -0.1045>
> Zone:  71
> Incident Nodes:  26  27
> elementname:  <nodal>
>     (26) = (67,0,0) mag = 67
>     (27) = (67,0,0) mag = 67
> 
> element:  <nodal>
>     (26) = 6
>     (27) = 6
> 
> Should I see an atom symbol anywhere here?
> 
> Thanks,
> 
> --
> Valmor
> 
> 
> Meredith, Jeremy S. wrote:
> > I see Brad already responded to the query output.  In case it's
> useful, I thought I'd mention there's also a GetQueryOutputString()
> command, and you can do SuppressQueryOutputOn() (or ...Off) if it's
> important.
> >
> > About the atom name:  the easiest way if you know the node ID is with
> a node pick.  In the python interface, you might do this:
> > PickByNode(222, 0, "element")
> > print GetPickOutput()
> >
> > For some file formats, you can query "elementname" to get the atomic
> symbol instead of the atomic number.  ("He" instead of "2")
> >
> > If you need to figure out the atom index (the "222" above) based on a
> global position, that's where "NodePick" comes in, as you can give it
> world coordinates, e.g. "NodePick((20,-55,5))" will tell you atom index
> #222 is at that spot.  At that, point, though, you can just add the
> element variable and get it all in a single pass, e.g.:
> >  NodePick((20,-55,5), "element")
> >
> >
> > --
> > Jeremy Meredith
> > Oak Ridge National Laboratory
> >
> >
> >> -----Original Message-----
> >> From: Valmor de Almeida [mailto:val.lists at gmail.com]
> >> Sent: Monday, March 29, 2010 2:19 PM
> >> To: VisIt software users community
> >> Subject: [visit-users] queries in the python interface
> >>
> >>
> >> Hello,
> >>
> >> How can grab the information from Query("QueryName") into a
> variable.
> >> Say, this does not work:
> >>
> >>>>> tmp = Query("Centroid")
> >> VisIt: Message - Centroid = (0.00215143, -2.89472, 0.0108211)
> >>>>> tmp
> >> 1L
> >>
> >> Alternatively if I could get the value of NumNodes from
> >> Query("NumNodes") that should enable me to loop over the nodes and
> >> compute the centroid.
> >>
> >> In addition, I would like to query the name of the atom the node is
> >> associated to. Here the data is a molecule in pdb format.
> >>
> >> Thanks,
> >>
> >> --
> >> Valmor
> >> --
> >> List subscription information:
> >> https://email.ornl.gov/mailman/listinfo/visit-users
> >> Searchable list archives: https://email.ornl.gov/pipermail/visit-
> users
> >> VisIt Users Wiki: http://visitusers.org/
> >> Frequently Asked Questions for VisIt: http://visit.llnl.gov/FAQ.html
> >
> > --
> > List subscription information:
> https://email.ornl.gov/mailman/listinfo/visit-users
> > Searchable list archives: https://email.ornl.gov/pipermail/visit-
> users
> > VisIt Users Wiki: http://visitusers.org/
> > Frequently Asked Questions for VisIt: http://visit.llnl.gov/FAQ.html
> >
> 
> --
> List subscription information:
> https://email.ornl.gov/mailman/listinfo/visit-users
> Searchable list archives: https://email.ornl.gov/pipermail/visit-users
> VisIt Users Wiki: http://visitusers.org/
> Frequently Asked Questions for VisIt: http://visit.llnl.gov/FAQ.html



More information about the visit-users mailing list