Re: hist_test.py ?...thanks - it was just what I needed..

Great..
Regards James

From: Tom Whittaker <tomw@xxxxxxxxxxxxx>
To: James Peterson <depalma_a@xxxxxxxxxxx>
CC: <visad-list@xxxxxxxxxxxxx>
Subject: Re: hist_test.py  ?
Date: Sat, 5 May 2001 10:09:22 -0500 (CDT)

James:

You might need the VisAD source to get this, so here is hist_test.py:

--------------------------
from visad.python.JPythonMethods import *
# load a McIDAS area file
area = load("../examples/AREA0008")

# compute a 2-D histogram of the first two bands of the area
histogram = hist(area, [0, 1])

# plot the histogram
clearplot()
plot(histogram)

------------------------------------

The "AREA" file that is read is a multi-channel image file, and this form
of calling "hist()" says to make a histogram of both channels.  You'll
note that this uses the general-purpose VisAD plot (which uses the
SpreadSheet's basic cell). When the plot comes up, you might want to click
on "mappings" and change the mappings so that "count" maps to the Z-axis.

If you don't have any sample data like that, you can also generate
something for testing...random numbers are always good ;-). That might
looks something like this (I've not tried this...):

from visad.python.JPythonMethods import *
import random
x=[]
for i in range(0,1000):
  x.append(random.random())
f = field(x)
h = hist(f, [0])
plot(h)


For everyone's info, I am working on a Jython-VisAD library of "quick
look"  plots, that will also include a histogram (in fact, it will use
hist() to create the proper VisAD object)  that is presented in a more
"traditional" (bar-graph like) style for single parameters.

Hope this helps...

tom


On Sat, 5 May 2001, James Peterson wrote:

> Thanks for the responses
>
> Unfortunately I haven't been able to locate the "hist_test.py"-file
> In my "visad/python"-directory I have 8 class files
> (JPythonEditor, JPythonFrame1, JPythonFrame, JPythonMethods1,
> JPythonMethods2, JPythonMethods3, JPythonMethods4, JPythonMethods)
> but no .py-files ?
>
> Maybe someone could attach the hist_test.py-file ?
>
> anyway thanks once again
> James
>
>
> >From: Tom Whittaker <tomw@xxxxxxxxxxxxx>
> >To: James Peterson <depalma_a@xxxxxxxxxxx>
> >CC: visad-list@xxxxxxxxxxxxx
> >Subject: Re: Questions from a newcomer..
> >Date: Fri, 04 May 2001 12:10:31 -0500
>
>
> > > Secondly I would also like to know if anybody has done any work
> > > with histograms in Visad (and even better if you know of any tutorials
> > > regarding histograms in Visad)....exapmles seem to work for me,
> > > rather than only reading the javadocs ;)
> >
> >In the visad package, you'll find a very simple example in Jython
> >(visad/python/hist_test.py) which produces a 2D histogram. I've not yet
> >completed the tutorial on VisAD-Jython yet, but this will be one of the
> >examples, along with it's degenerate 1D case...
> >
> >tom
> >
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


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