VisAD-Python update

The Windows "all-in-one, complete install" for Java, Java3D VisAD and
Python at:
   http://www.ssec.wisc.edu/~tomw/visadtutor/jyvis.exe
has been updated to Jython 2.1 and VisAD for January 25th.

A few items of potential interest that were in the Jan 25th release of
VisAD:

** due a name-collision problem with the Python built-in
functions, we've had to change the names of 3 methods in the
visad.python.JPythonMethods class:  abs(), max(), and min().  These
are now named:  abs_data(), max_data(), min_data(), respectively.  As
before, they only work on VisAD Data objects.

I appologize for having to make this change and hope the impact is
minimal.  This will allow you to
          from visad.python.JPythonMethods import *
and still use the built-in Jython functions to operate on non-VisAD
Data types.  (Note that this is always automatically supplied by the
JPythonEditor.)

** some signature addtions: two new method signatures have
been added to JPythonMethods to allow you to conveniently get the
RealTypes of the domain and range of a FunctionType.  In addition,
signatures were added to the 'makeDomain()' methods so that the string
representing the RealType can be used (see below).

** the subs.makeMaps() method has been modified to allow you to
specify the names (as strings) of the Types (you can still use the
Type, however).  This can sometimes eliminate the need to use
"RealType" or "RealTupleType", as seen in the following:

In this example, we pick up the Python code only after lots of
preceding code (not listed) that generates an array T[20][100][76] of
real numbers.  We want to interactively control the display of the 2-D
field for each T[k], so a VisADSlider was added to the bottom of the
panel.

......

from visad.python.JPythonMethods import *
from visad import FieldImpl
from visad.util import VisADSlider
import subs

ftype = makeType(" (liq_water -> ( (size, wavelen) -> reflectance) )")

fdom = makeDomain("liq_water", .05, 1.0, 20)
gdom = makeDomain("(size, wavelen)", 3,102,100,  1,76,76)

seq = FieldImpl(ftype, fdom)

for i in xrange(0,20):
  seq.setSample(i, field(gdom, "reflectance", T[i]) )

# at this point, you could simply:  plot(seq,1) to use a SpreadSheet cell

maps = subs.makeMaps("size","x",
                     "wavelen","y",
                     "reflectance","rgb", "reflectance","z",
                     "liq_water","selectvalue")

disp = subs.makeDisplay3D(maps)
showAxesScales(disp, 1)
subs.addData('reflect',seq, disp)
slide=VisADSlider(maps[4])
subs.showDisplay(disp, 400, 400, "Reflectance", bottom=slide)


Again, sorry for having to change the names...

tom

--
Tom Whittaker
University of Wisconsin-Madison
Space Science and Eng. Center
ph:  608.262.2759






  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: