Re: VisAD with Jython, but 2D only

Hi Frank,

> Hi, I've just joined the list, having downloaded, installed and played
> around with VisAD this afternoon.   I'm searching for an easy way to create
> images based on scientific data (mass spectra) in Jython. I've searched the
> mailing list archives in answer of this question to no avail, so I thought
> I'd ask it here:
>
> I want to be able to quickly prototype software that will draw 2D graphs,
> histograms, etc. Sounds (and looks) like VisAD is what I need. I don't know
> much about 3D graphics though, and have no need for them right now. The
> docs for VisAD say that I can do things in 2D, and that I only need java3d
> if I want 3D graphics (at least that's how I understood it). But I'm
> finding that even a simple jython script wants java3d:
>
>          from graph import *
>          a=[0, 7, 10, 8, 6, 4, 2, 1, 0]
>          b = field(a) # Is this the right thing to do?
>          histogram(b,40)
>
> gives this error message
>
>          Traceback (innermost last):
>            File "/d0/home/fgibbons/cvs/VisAD/quick_graph.py", line 6, in ?
>            File "/d0/home/fgibbons/cvs/VisAD/./graph.py", line 62, in 
> histogram
>          java.lang.NoClassDefFoundError: javax/media/j3d/Behavior
>                  at java.lang.ClassLoader.defineClass0(Native Method)
>                  at java.lang.ClassLoader.defineClass(ClassLoader.java:493)

You can create Java2D displays from python using:

  subs.makeDisplay2D(maps)

where maps is an array of ScalarMaps. See the
visad/python/image_line.py program (and others) for an example
of using subs.makeDisplay(maps). This is similar, just appends
the '2D'.

> I've gone to Blackdown's page, checked out the docs for Mesa3d, etc, and to
> be honest it scares me - I don't want to know about hardware! Is there any
> way that I can use VisAD without installing java3d?
>
> If I could play around with VisAD for a week or two, and can convince
> myself that it's really what I need, I might even invest the time in java3d
> (the images are so cool - I'm sure I could find a way to use them in my 
> work!).
>
> I did find one message from 1999
> (http://www.unidata.ucar.edu/staff/russ/visad/msg09429.html) discussing
> building VisAD without java3d, but the solution seems to be adding jars
> from 3d? I don't understand this, perhaps someone who has used this trick
> could elaborate?

You only need this trick with jar files if you want to compile
VisAD. However, you can use the precompiled VisAD classes in
visad.jar - just add it to your CLASSPATH (you are probably
doing this already).

> On the other hand, maybe VisAD is overkill for what I want to do (it sure
> looks good though).
>
> Thanks for your help. I'm blown away by VisAD's capabilities, especially
> when hooked up to Jython!

Glad you think so - we agree that VisAD with Jython has great
potential. Let the list know if you have any other problems.
Hopefully you've checked out Tom's VisAD/Python tutorial.

Good luck,
Bill