comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: An IDL cron job, true color plots, Xvfb, Z-buffer, and all sorts of troubles
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: An IDL cron job, true color plots, Xvfb, Z-buffer, and all sorts of troubles [message #58592 is a reply to message #58591] Thu, 07 February 2008 03:10 Go to previous messageGo to previous message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Feb 7, 10:06 am, "kathryn....@gmail.com" <kathryn....@gmail.com>
wrote:
> Hi folks,
>
> This newsgroup has been a huge help to me with these sorts of problems
> in the past, and I am hoping once again to draw on your expertise.
>
> My problem is a little complicated. I have a particular plotting
> routine that uses a color scale to represent signal response over a
> grid of detectors. I use this a lot and it's really handy. It also
> took me a really long time to get it to work and to be able to
> write_png files from it without getting goofy colors. What I would
> like to do is automate this routine and run it with a cron job,
> outputting png files to include in a daily web page.
>
> I have noticed that quite a few people have tried to do similar things
> and run into problems. I have problems with all of the suggested
> solutions. Any one of them would be fine but I can't get them to
> work. So here goes:
>
> option 1) use the Z buffer: Here I think I am running into problems
> with my understanding of true-color display issues in IDL. My plot
> routine includes a line 'Device, decomposed = 0' and the Z-buffer
> doesn't work the same way as the X buffer. That's problem number
> one. Problem number two is that I can't figure out how to take the Z-
> buffer plot and make a png file out of it with correct colors.
>
> option 2) write to a ps file and convert it to png after the fact. I
> have similar problems here with my Device, decomposed = 0, and I don't
> understand how to translate my plotting routine so that it will do the
> same thing with the ps device that it does with standard X output.
>
> option 3) use the /pixmap option with an X window, and then use Xvfb
> to run a virtual X session so that I can run this from cron. I have
> Xvfb installed and with some fiddling, I can get the authentication to
> work out so that I don't get an immediate Xlib: connection to ":1.0"
> refused by server, but even then I still get WINDOW: Unable to connect
> to X Windows display: :1.0 errors, even though the DISPLAY variable
> looks to be set correctly to me. I really hoped I could get this to
> work, because doing window, 1, /pixmap, running the plotter, and then
> calling write_png, 'file.png', tvrd(/true) works wonderfully and gives
> exactly what I want... just not through cron.
>
> I think the main reason I'm having so much trouble here is I'm trying
> to get something to work with color tables and true-color display
> without really understanding them. A stripped-down version of the
> plotting routine is below. I would invoke it with something like>plot_test, [0,2,3],[0.2,0.7,1.0]. Before I run this, I have quite a
>
> few graphics setup calls in my idl_startup file. Between running it,
> I typically do
> loadct, 0
> !p.color = !black
> !p.background = !white
> to make the display look right each time.
>
> Sorry for the long-winded question. Sample plotting routine follows:
>
> pro plot_test, indices, color_scale,$
> title=title
>
> if n_elements(title) eq 0 then title=''
>
> ; example simple grid of 4 points:
> x_pos=[1., 2., 1., 2.]
> y_pos=[1.,1.,2.,2]
>
> ;plot, the center points for each detector:
> plot, x_pos, y_pos, xrange=[0,3],yrange=[0,3],/xstyle,/ystyle,/iso,$
> psym = 3, title = title
> Device, decomposed = 0
> LoadCT, 33
> ; determine the color scale to use
> color_scale=float(color_scale)
>
> color_values = ((color_scale - min(color_scale))/(max(color_scale)-
> min(color_scale)))* 255
>
> ;plot circles filled with the colors in the scale
> for i=0,n_elements(indices)-1 do begin
> polyfill, circle(x_pos[indices[i]],y_pos[indices[i]],0.25),
> color=color_values[i]
> endfor
>
> colorbar, /vertical, format='(F6.2)',$
> range=[min(color_scale),max(color_scale)]
>
> end
>
> - Kathryn

This may be a clumsy way of going about it, I admit I've not had to
use PostScript output much, but what happens if you replace:

Device, decomposed = 0
With:

IF !D.NAME EQ 'PS' THEN DEVICE, /COLOR, BITS = 8 ELSE DEVICE,
DECOMPOSED = 0

(assuming you've already set your filename when you called SET_PLOT if
you're using postscript)

As far as I can work out, LOADCT should work just like TVLCT in
Postscript mode, no?

If I'm wrong about this, I'd love to know why - I'm posting this to
learn as much as anything :-)

Anyway, hope it helps,
Chris
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Multi bands mean
Next Topic: Singing New Tune

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 13:49:38 PDT 2025

Total time taken to generate the page: 1.59522 seconds