black window on fsc_surface & fsc_surface_log? [message #40472] |
Tue, 10 August 2004 12:48  |
u2s5thmember
Messages: 11 Registered: January 2004
|
Junior Member |
|
|
I have three arrays: x, y, z
x ranges from 180 to 250
y ranges from 1e-08 to 3e-04
z ranges from 0.002 to 1
Following the examples of some of Dave Fanning's programs I got this
far:
;-------------------------------------------------
WINDOWSIZE = 250
Triangulate, x, y, triangles, boundaryPts
s = Size(triangles, /Dimensions)
num_triangles = s[1]
gridSpace = [0.01, 0.05]
griddedData = TriGrid(x, y, z, triangles, gridSpace, $
XGrid=xvector, YGrid=yvector)
griddedData = TriGrid(x, y, z, triangles, gridSpace, XGrid=xvector, $
YGrid=yvector, /Quintic, Extrapolate=boundaryPts)
Window, /Free, Title='Uptake(Temp, PHNO3)', $
XSize=WINDOWSIZE*2, YSize=WINDOWSIZE*2, $
XPos=2*WINDOWSIZE*1.5 + 20, YPos=WINDOWSIZE + 30
Surface, griddedData, xvector, yvector, /NoData, /ylog, /zlog, $
xcharsize=3, ycharsize=3, zcharsize=2, Color=0, $
xrange=[180,250], yrange=[1e-8, 1.E-2], zrange=[1e-3, 1]
Surface, griddedData, xvector, yvector, XStyle=4, $
YStyle=4, ZStyle=4, /NoErase
;-------------------------------------------------
so from what I understand, the above code seems to work properly, but
I can't really see the output and I can't manipulate plot etc...
therefore,
I would like to view the above surface plot using fsc_surface or
fsc_surface_log instead of just using "surface", but all I get is a
black screen when I try either of the following commands:
fsc_surface, griddedData, xvector, yvector
fsc_surface_log, griddedData, xvector, yvector
So... in the above commands, is it correct to use the "griddedData"
array as the 2d data array called by fsc_surface and fsc_surface_log??
btw, The 2D array, "griddedData" has lots of negative numbers? why is
that, since none of my data are negative??? Is there a connection
between black screen as output of fsc_surface and negative numbers?
I don't have any idea how to proceed on this one & unfortunately, I
understand only the general idea of widgets & object programming, so
any info will probably need to be pretty specific.
Thank you in advance for your suggestions!
|
|
|
Re: black window on fsc_surface & fsc_surface_log? [message #40534 is a reply to message #40472] |
Thu, 12 August 2004 14:30  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
BG writes:
> scale_vector did the job, thanks! with scale_vector, GridData,
> y=alog10(y), z=alog10(z) and FSC_Surface.pro I got something which
> will be good enough to show my advisor... I think I might look into
> getting scale_vector.pro to make log scale data more evenly spaced,
> but it works great for right now.
>
> Back to FSC_Surface_log.pro though... I modified it to handle a log
> scale y-axis in addition to the the log scale z-axis you added:
>
> ------------------------------------------------------------
> ~line 1288:
> yAxis = Obj_New("IDLgrAxis", 1, Color=[0,255,0], Ticklen=0.1, $
> Minor=4, Title=ytitle, Range=yrange, Exact=exact[1], /LOG)
>
> ~line 1306 & ~line 1315:
> yrange_surf = [10^yrange[0], 10^yrange[1]]
>
> ~line 1330:
> thisSurface->SetProperty, XCoord_Conv=xs, $
> YCoord_Conv=yrange_surf, ZCoord_Conv=zrange_surf
> ; originally ZCoord_Conv=zsurf...
> ; shouldn't it be zrange_surf instead, b/c "zsurf" d.n.e. ?
> ------------------------------------------------------------
>
> these modifications make the axes look perfect, but somehow only a
> slice of the data gets plotted and the data is plotted about 1 order
> of magnitude too high.
I'm not sure what you mean by "about 1 order of
magnitude too high." The Z range looks fine to me.
But while the Y axis looks like a log axis, the grid
looks linear (as I am sure it is). Probably your
axis doesn't correspond to the gridded data. Somehow
you have to grid the data on a log grid. I'm not
sure how to do that (although I suspect it is probably
possible with GRIDDATA). If you could figure out how to
do that, your problems might be solved.
>
> with the above modifications to FSC_Surface_log.pro, here's an example
> program which, on my machine, only shows a slice of the data:
>
> ;--------------------------------------------------
> pro test_surface
>
> x=[180., 190., 200., 210.]
> y=[1.e-8, 1.e-7, 1.e-6, 1.e-5]
> z=[1.e-3, 1.e-2, 1.e-1, 1.]
>
>
> grid=GridData(x, y, z)
>
> s = Size(grid, /Dimensions)
> yy = Scale_Vector(Findgen(s[1]), Min(y), Max(y))
> xx = Scale_Vector(Findgen(s[0]), Min(x), Max(x))
>
> FSC_Surface_log, grid, xx, yy, Position=[0,1,0,1,0,1]
>
>
> end
> ;--------------------------------------------------
>
> does that show up incorrectly for you? Any ideas?
I think what shows up is what I expected would show
up. But I think the Y axis doesn't reflect the actual
Y data values.
I'm really shaky when it comes to log axes and
object graphics, though. If I give any more advice
it will be the blind leading the blind. :-)
Cheers,
David
P.S. I mean, more than usual.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: black window on fsc_surface & fsc_surface_log? [message #40535 is a reply to message #40472] |
Thu, 12 August 2004 13:54  |
u2s5thmember
Messages: 11 Registered: January 2004
|
Junior Member |
|
|
David Fanning writes:
> Oh, dear. :-(
Lol... I knew sooner or later you'd feel that way! ;)
scale_vector did the job, thanks! with scale_vector, GridData,
y=alog10(y), z=alog10(z) and FSC_Surface.pro I got something which
will be good enough to show my advisor... I think I might look into
getting scale_vector.pro to make log scale data more evenly spaced,
but it works great for right now.
Back to FSC_Surface_log.pro though... I modified it to handle a log
scale y-axis in addition to the the log scale z-axis you added:
------------------------------------------------------------
~line 1288:
yAxis = Obj_New("IDLgrAxis", 1, Color=[0,255,0], Ticklen=0.1, $
Minor=4, Title=ytitle, Range=yrange, Exact=exact[1], /LOG)
~line 1306 & ~line 1315:
yrange_surf = [10^yrange[0], 10^yrange[1]]
~line 1330:
thisSurface->SetProperty, XCoord_Conv=xs, $
YCoord_Conv=yrange_surf, ZCoord_Conv=zrange_surf
; originally ZCoord_Conv=zsurf...
; shouldn't it be zrange_surf instead, b/c "zsurf" d.n.e. ?
------------------------------------------------------------
these modifications make the axes look perfect, but somehow only a
slice of the data gets plotted and the data is plotted about 1 order
of magnitude too high.
with the above modifications to FSC_Surface_log.pro, here's an example
program which, on my machine, only shows a slice of the data:
;--------------------------------------------------
pro test_surface
x=[180., 190., 200., 210.]
y=[1.e-8, 1.e-7, 1.e-6, 1.e-5]
z=[1.e-3, 1.e-2, 1.e-1, 1.]
grid=GridData(x, y, z)
s = Size(grid, /Dimensions)
yy = Scale_Vector(Findgen(s[1]), Min(y), Max(y))
xx = Scale_Vector(Findgen(s[0]), Min(x), Max(x))
FSC_Surface_log, grid, xx, yy, Position=[0,1,0,1,0,1]
end
;--------------------------------------------------
does that show up incorrectly for you? Any ideas?
Thanks in Advance!
|
|
|
Re: black window on fsc_surface & fsc_surface_log? [message #40542 is a reply to message #40472] |
Thu, 12 August 2004 05:58  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
David Fanning wrote:
>
> Yeah, I've never been able to figure out GRIDDATA either.
> Maybe Mr. Tupper can fill us both in. I do notice that
> the examples RSI provides don't bother with such extravagances
> as the X and Y vectors either. Wonder if there is a reason
> for that. :-)
>
> I guess you could try something like this. Whether
> this is *accurate* or not, I just don't know.
>
> s = Size(griddedData, /Dimensions)
> xx = Scale_Vector(Findgen(s[0]), Min(x), Max(x))
> yy = Scale_Vector(Findgen(s[1]), Min(y), Max(y))
> FSC_Surface, griddedData, xx, yy, Position=[0,1,0,1,0,1]
>
> You might have a look at the DELTA keyword to GRIDDATA, too.
> I thought you were using the equivalent in an earlier try
> with TRIGRID.
>
As I recall, START, DELTA (same as BG's gridSpace) and DIMENSION are all input
keywords to GRIDDATA.
The only thing I would add is to calculate xx and yy with the following...
xx = FINDGEN(dimension[0]) * delta[0] + start[0]
yy = FINDGEN(dimension[1]) * delta[1] + start[1]
As far as the unexpected negatives on the triangulated surface are concerned,
hmmm. I dunno.
Ben
|
|
|
Re: black window on fsc_surface & fsc_surface_log? [message #40548 is a reply to message #40472] |
Wed, 11 August 2004 13:10  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I guess you could try something like this. Whether
> this is *accurate* or not, I just don't know.
>
> s = Size(griddedData, /Dimensions)
> xx = Scale_Vector(Findgen(s[0]), Min(x), Max(x))
> yy = Scale_Vector(Findgen(s[1]), Min(y), Max(y))
> FSC_Surface, griddedData, xx, yy, Position=[0,1,0,1,0,1]
Whoops! SCALE_VECTOR is found on my web page:
http://www.dfanning.com/programs/scale_vector.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: black window on fsc_surface & fsc_surface_log? [message #40549 is a reply to message #40472] |
Wed, 11 August 2004 13:00  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
BG writes:
> David, Your fsc_surface code is Great! I know it's me doing
> something incorrectly. Here's what I did which was incompatible with
> fsc_surface which produced the black window:
>
> I usually put the word "stop" just before the word "end" in my code,
> which allows me to examine or work with the variables after running my
> code.
Oh, dear. :-(
> If I take out the word "stop", idl doesn't seem to remember any
> of the variables it just used, i.e. it says all my variables are now
> undefined.
Well, variables have "scope" inside the procedure or function
where they are created. They can't be seen from outside that
scope. (If this weren't the case, we would have to have different
names for *every* variable we created in IDL! An anal person's
nightmare, to be sure!)
> If I remove the word "stop" from my code (I just read I could type
> ".con" instead), fsc_surface loads correctly and produces a plot. I'm
> not certain I have the correct plot yet though.
Yes, take the STOPs out and leave them out. Learn
how to put a breakpoint in your code, if and when you
really need to. :-)
> I do have a question re: GridData vs. Triangulate/TriGrid:
>
> For some reason using Triangulate/TriGrid produces negative z axis
> data, when it should range from 1e-3 to 1, so I'll *have* to figure
> out GridData.
Yeah, I've never been able to figure out GRIDDATA either.
Maybe Mr. Tupper can fill us both in. I do notice that
the examples RSI provides don't bother with such extravagances
as the X and Y vectors either. Wonder if there is a reason
for that. :-)
I guess you could try something like this. Whether
this is *accurate* or not, I just don't know.
s = Size(griddedData, /Dimensions)
xx = Scale_Vector(Findgen(s[0]), Min(x), Max(x))
yy = Scale_Vector(Findgen(s[1]), Min(y), Max(y))
FSC_Surface, griddedData, xx, yy, Position=[0,1,0,1,0,1]
You might have a look at the DELTA keyword to GRIDDATA, too.
I thought you were using the equivalent in an earlier try
with TRIGRID.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|