Re: Newbie trying out IDL scripts [message #80481] |
Wed, 13 June 2012 20:20 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, June 13, 2012 10:18:06 PM UTC-4, gokop...@gmail.com wrote:
> On Wednesday, June 13, 2012 9:31:08 PM UTC-4, Craig Markwardt wrote:
>> On Wednesday, June 13, 2012 8:25:59 PM UTC-4, gokop...@gmail.com wrote:
>>> On Wednesday, June 13, 2012 5:09:48 PM UTC-4, gokop...@gmail.com wrote:
>>>> On Wednesday, June 13, 2012 5:06:18 PM UTC-4, Craig Markwardt wrote:
>>>> > On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
>>>> > > Hey guys,
>>>> > >
>>>> > > I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>>>> > >
>>>> > > We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>>>> > >
>>>> > > I found this script to do error catching, notify users that they their scripts are not compatible with our system...
>>>> > > http://www.idlcoyote.com/code_tips/hasdisplay.html
>>>> > >
>>>> > >
>>>> > > How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>>>> > >
>>>> > > At the end, I need to put that command in a .sh shell script file...
>>>> > >
>>>> > > Example:
>>>> > > IDL> IF NOT CanConnect() THEN PRINT, "hello"
>>>> > > % WINDOW: Unable to connect to X Windows display: :0.0
>>>> > > hello
>>>> > >
>>>> > > Okay.. this looks okay....
>>>> > >
>>>> > > But, I don't need to run PRINT, I need to run a script....
>>>> > > I took my plots.pro and data file from here
>>>> > > http://math.arizona.edu/~swig/documentation/idl/
>>>> > >
>>>> > > TIps?
>>>> >
>>>> > You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
>>>> > That kind of script-running is limited to the interactive command line (or an @-file).
>>>> >
>>>> > You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
>>>> > IF NOT CanConnect() THEN PLOTS
>>>> > (I would recommend a better name than PLOTS however)
>>>> >
>>>> > You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
>>>> >
>>>> > IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
>>>> > SET_PLOT, 'Z'
>>>> > withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
>>>> >
>>>> > Craig
>>>>
>>>> Thanks for the suggestion.
>>>> Just wondering... suppose you supply some IDL scripts. Do I have to add something like "set_plot, 'z'" manually to every plot procedure?
>>>>
>>>> Is there a global effect? That's the issue we really have....
>>>>
>>>> I have a starter plot example which uses the Z buffer to output the image.
>>>> Thanks
>>>
>>> I just tried to unset the DISPLAY. But
>> ...
>>
>> How did you unset it?
>
> Hi Craig,
>
> I did this in the terminal
> unset DISPLAY
> I tried this as well
> unset DISPLAY
> export DISPLAY
>
> and your suggestion
> unset DISPLAY; export DISPLAY
> bash="unset DISPLAY; export DISPLAY"
>
>
> then immediately I fired up idl
> idl > .run plots
>
> It is still reading display=:0.0 as you can see from the error...
What shell are you using? I gave you two different sets of instructions depending on which shell you use.
If you are using bash,
unset DISPLAY; export DISPLAY
if you are using csh or tcsh
unsetenv DISPLAY
Then start IDL.
Then
set_plot, 'z'
Then run whatever you want.
Are you saying after that, it is still trying to connect to X?
Craig
|
|
|
Re: Newbie trying out IDL scripts [message #80482 is a reply to message #80481] |
Wed, 13 June 2012 19:18  |
John Yeukhon Wong
Messages: 5 Registered: February 2012
|
Junior Member |
|
|
On Wednesday, June 13, 2012 9:31:08 PM UTC-4, Craig Markwardt wrote:
> On Wednesday, June 13, 2012 8:25:59 PM UTC-4, gokop...@gmail.com wrote:
>> On Wednesday, June 13, 2012 5:09:48 PM UTC-4, gokop...@gmail.com wrote:
>>> On Wednesday, June 13, 2012 5:06:18 PM UTC-4, Craig Markwardt wrote:
>>>> On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
>>>> > Hey guys,
>>>> >
>>>> > I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>>>> >
>>>> > We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>>>> >
>>>> > I found this script to do error catching, notify users that they their scripts are not compatible with our system...
>>>> > http://www.idlcoyote.com/code_tips/hasdisplay.html
>>>> >
>>>> >
>>>> > How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>>>> >
>>>> > At the end, I need to put that command in a .sh shell script file...
>>>> >
>>>> > Example:
>>>> > IDL> IF NOT CanConnect() THEN PRINT, "hello"
>>>> > % WINDOW: Unable to connect to X Windows display: :0.0
>>>> > hello
>>>> >
>>>> > Okay.. this looks okay....
>>>> >
>>>> > But, I don't need to run PRINT, I need to run a script....
>>>> > I took my plots.pro and data file from here
>>>> > http://math.arizona.edu/~swig/documentation/idl/
>>>> >
>>>> > TIps?
>>>>
>>>> You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
>>>> That kind of script-running is limited to the interactive command line (or an @-file).
>>>>
>>>> You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
>>>> IF NOT CanConnect() THEN PLOTS
>>>> (I would recommend a better name than PLOTS however)
>>>>
>>>> You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
>>>>
>>>> IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
>>>> SET_PLOT, 'Z'
>>>> withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
>>>>
>>>> Craig
>>>
>>> Thanks for the suggestion.
>>> Just wondering... suppose you supply some IDL scripts. Do I have to add something like "set_plot, 'z'" manually to every plot procedure?
>>>
>>> Is there a global effect? That's the issue we really have....
>>>
>>> I have a starter plot example which uses the Z buffer to output the image.
>>> Thanks
>>
>> I just tried to unset the DISPLAY. But
> ...
>
> How did you unset it?
Hi Craig,
I did this in the terminal
unset DISPLAY
I tried this as well
unset DISPLAY
export DISPLAY
and your suggestion
unset DISPLAY; export DISPLAY
bash="unset DISPLAY; export DISPLAY"
then immediately I fired up idl
idl > .run plots
It is still reading display=:0.0 as you can see from the error...
Thanks. I am using Ubuntu.
|
|
|
Re: Newbie trying out IDL scripts [message #80483 is a reply to message #80482] |
Wed, 13 June 2012 18:31  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, June 13, 2012 8:25:59 PM UTC-4, gokop...@gmail.com wrote:
> On Wednesday, June 13, 2012 5:09:48 PM UTC-4, gokop...@gmail.com wrote:
>> On Wednesday, June 13, 2012 5:06:18 PM UTC-4, Craig Markwardt wrote:
>>> On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
>>>> Hey guys,
>>>>
>>>> I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>>>>
>>>> We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>>>>
>>>> I found this script to do error catching, notify users that they their scripts are not compatible with our system...
>>>> http://www.idlcoyote.com/code_tips/hasdisplay.html
>>>>
>>>>
>>>> How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>>>>
>>>> At the end, I need to put that command in a .sh shell script file...
>>>>
>>>> Example:
>>>> IDL> IF NOT CanConnect() THEN PRINT, "hello"
>>>> % WINDOW: Unable to connect to X Windows display: :0.0
>>>> hello
>>>>
>>>> Okay.. this looks okay....
>>>>
>>>> But, I don't need to run PRINT, I need to run a script....
>>>> I took my plots.pro and data file from here
>>>> http://math.arizona.edu/~swig/documentation/idl/
>>>>
>>>> TIps?
>>>
>>> You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
>>> That kind of script-running is limited to the interactive command line (or an @-file).
>>>
>>> You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
>>> IF NOT CanConnect() THEN PLOTS
>>> (I would recommend a better name than PLOTS however)
>>>
>>> You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
>>>
>>> IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
>>> SET_PLOT, 'Z'
>>> withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
>>>
>>> Craig
>>
>> Thanks for the suggestion.
>> Just wondering... suppose you supply some IDL scripts. Do I have to add something like "set_plot, 'z'" manually to every plot procedure?
>>
>> Is there a global effect? That's the issue we really have....
>>
>> I have a starter plot example which uses the Z buffer to output the image.
>> Thanks
>
> I just tried to unset the DISPLAY. But
...
How did you unset it?
|
|
|
Re: Newbie trying out IDL scripts [message #80484 is a reply to message #80483] |
Wed, 13 June 2012 17:25  |
John Yeukhon Wong
Messages: 5 Registered: February 2012
|
Junior Member |
|
|
On Wednesday, June 13, 2012 5:09:48 PM UTC-4, gokop...@gmail.com wrote:
> On Wednesday, June 13, 2012 5:06:18 PM UTC-4, Craig Markwardt wrote:
>> On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
>>> Hey guys,
>>>
>>> I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>>>
>>> We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>>>
>>> I found this script to do error catching, notify users that they their scripts are not compatible with our system...
>>> http://www.idlcoyote.com/code_tips/hasdisplay.html
>>>
>>>
>>> How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>>>
>>> At the end, I need to put that command in a .sh shell script file...
>>>
>>> Example:
>>> IDL> IF NOT CanConnect() THEN PRINT, "hello"
>>> % WINDOW: Unable to connect to X Windows display: :0.0
>>> hello
>>>
>>> Okay.. this looks okay....
>>>
>>> But, I don't need to run PRINT, I need to run a script....
>>> I took my plots.pro and data file from here
>>> http://math.arizona.edu/~swig/documentation/idl/
>>>
>>> TIps?
>>
>> You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
>> That kind of script-running is limited to the interactive command line (or an @-file).
>>
>> You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
>> IF NOT CanConnect() THEN PLOTS
>> (I would recommend a better name than PLOTS however)
>>
>> You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
>>
>> IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
>> SET_PLOT, 'Z'
>> withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
>>
>> Craig
>
> Thanks for the suggestion.
> Just wondering... suppose you supply some IDL scripts. Do I have to add something like "set_plot, 'z'" manually to every plot procedure?
>
> Is there a global effect? That's the issue we really have....
>
> I have a starter plot example which uses the Z buffer to output the image.
> Thanks
I just tried to unset the DISPLAY. But
IDL> .run plots
will still give me
% Compiled module: $MAIN$.
% WINDOW: Unable to connect to X Windows display: :0.0
% WINDOW: Unable to open X Windows display.
Is your DISPLAY environment variable set correctly?
% Execution halted at: $MAIN$ 11 /home/machine/idl_scripts/plots.pro
|
|
|
Re: Newbie trying out IDL scripts [message #80485 is a reply to message #80484] |
Wed, 13 June 2012 14:09  |
John Yeukhon Wong
Messages: 5 Registered: February 2012
|
Junior Member |
|
|
On Wednesday, June 13, 2012 5:06:18 PM UTC-4, Craig Markwardt wrote:
> On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
>> Hey guys,
>>
>> I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>>
>> We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>>
>> I found this script to do error catching, notify users that they their scripts are not compatible with our system...
>> http://www.idlcoyote.com/code_tips/hasdisplay.html
>>
>>
>> How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>>
>> At the end, I need to put that command in a .sh shell script file...
>>
>> Example:
>> IDL> IF NOT CanConnect() THEN PRINT, "hello"
>> % WINDOW: Unable to connect to X Windows display: :0.0
>> hello
>>
>> Okay.. this looks okay....
>>
>> But, I don't need to run PRINT, I need to run a script....
>> I took my plots.pro and data file from here
>> http://math.arizona.edu/~swig/documentation/idl/
>>
>> TIps?
>
> You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
> That kind of script-running is limited to the interactive command line (or an @-file).
>
> You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
> IF NOT CanConnect() THEN PLOTS
> (I would recommend a better name than PLOTS however)
>
> You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
>
> IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
> SET_PLOT, 'Z'
> withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
>
> Craig
Thanks for the suggestion.
Just wondering... suppose you supply some IDL scripts. Do I have to add something like "set_plot, 'z'" manually to every plot procedure?
Is there a global effect? That's the issue we really have....
I have a starter plot example which uses the Z buffer to output the image.
Thanks
|
|
|
Re: Newbie trying out IDL scripts [message #80486 is a reply to message #80485] |
Wed, 13 June 2012 14:06  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Wednesday, June 13, 2012 3:13:21 PM UTC-4, gokop...@gmail.com wrote:
> Hey guys,
>
> I am an undergraduate student working on a scientific collaborative platform. One of the languages we supported is IDL.
>
> We don't have X Windows setup properly. We have trouble doing that, and in fact we don't want windows to popup because we are running CRON jobs. SO everything has to be done on the background, and our front-end needs to display the results...
>
> I found this script to do error catching, notify users that they their scripts are not compatible with our system...
> http://www.idlcoyote.com/code_tips/hasdisplay.html
>
>
> How do you use this to run a script called "plots.pro"? What should be put after the THEN? How should it be used?
>
> At the end, I need to put that command in a .sh shell script file...
>
> Example:
> IDL> IF NOT CanConnect() THEN PRINT, "hello"
> % WINDOW: Unable to connect to X Windows display: :0.0
> hello
>
> Okay.. this looks okay....
>
> But, I don't need to run PRINT, I need to run a script....
> I took my plots.pro and data file from here
> http://math.arizona.edu/~swig/documentation/idl/
>
> TIps?
You can't "run a script" the way that you want, if you mean ".RUN PLOTS"
That kind of script-running is limited to the interactive command line (or an @-file).
You would be better off turning plots.pro into a true procedure which you can call like any other procedure by typing its name. Then you can do,
IF NOT CanConnect() THEN PLOTS
(I would recommend a better name than PLOTS however)
You make it confusing whether you want to disable graphics or enable them. If you want to truly disable X graphics for a cron job, then I recommend making sure that the DISPLAY shell variable is undefined *before* calling IDL. (tcsh="unsetenv DISPLAY" or bash="unset DISPLAY; export DISPLAY")
IDL will not attempt to use X graphics if the Unix shell variable DISPLAY is undefined. You can also immediately run
SET_PLOT, 'Z'
withing IDL immediately after starting up, which will make doubly sure that graphics commands go to the Z-buffer.
Craig
|
|
|