idl_kernel icon indicating copy to clipboard operation
idl_kernel copied to clipboard

If .pro contains a stop, figures don't show up until another cell is executed

Open douglase opened this issue 10 years ago • 1 comments

Thanks for putting this together, great idea, install was easy and so far it's working great.

A small thing I've noticed, whenever I hit a stop in a procedure, the code returns without shown the plots up to that point.

For example, if I create a simple procedure based on the demo:

 pro demo_plot
x = 2*!PI*0.01*indgen(100)
y1 = sin(x)
 y2 = cos(x)
loadct,39 
window,xsize=800,ysize=500 
plot,x,y1,title='Trig Functions',xtitle='Radians',ytitle='Amplitude',xrange=   [0,6],charsize=1.5,background=255,color=0
oplot,x,y2,color=50
stop 
end

I run this in a cell, i.e.

demo_plot

then I have to run another cell with something in it (i.e. a print statement) to see the output figures, as seen in this example notebook: http://nbviewer.ipython.org/gist/douglase/9f02bcb3287ea4131e4f

running .continue as you would in IDL returns an error, not the plots, or the next bit of code, so essential this is just a report that the stop command doesn't work yet.

douglase avatar Jul 20 '15 23:07 douglase

Ok this was partially fixed in the last two commits. In order to get inline plots this kernel appends a post call to your code in the notebook cell that takes snapshots of open graphics windows and save them as pngs. Since you had a stop it never executed that code. This was partially fixed by having the graphics code run separately so that the graphics code will always run.

The reason this is not full fix is that after the stop it cant resume with .continue presumably because the cell input get printed to a temporary file and run using .run tmpfile. The reason for the tmp file was to allow writing procedures and functions.

A possible way to fix that is to write a parser that strips out the functions and procedures and treats them separately from the rest of the code.

lstagner avatar Jul 21 '15 07:07 lstagner