#266 closed defect (fixed)
pyplot.show() hangs (at least on CASA)
Reported by: | Kana Sugimoto | Owned by: | Kana Sugimoto |
---|---|---|---|
Priority: | high | Milestone: | Unified development |
Component: | General | Version: | 2.0 |
Severity: | normal | Keywords: | |
Cc: | Malte.Marquarding@… |
Description
The issue is originally reported by Josh Marvil at NRAO.
When he invokes pylab.show() on casapy (and possibly on ipython based applications) on TkAgg backend, ipython enters Tk mainloop and never returns ipython prompt again.
pylab.show() tries to show ALL windows under under the control of matplotlib and pauses ipython shell until all the Tk windows are closed.
ASAP plotter was a special plotter which is based on but has not been under the control of matplotlib. So, it's not plotted by pylab.show() but Tk mainloop waits for ASAP plotter to be closed because it's Tk window.
Proper behaviors to be employed:
- ASAP plotter won't generate the hidden plotter window at the start-up, but it only be generated at the first invocation of plotting operation, e.g., asapplotter.plot().
- Once the plotter is generated, it should be under control of matplotlib, and pylab.show() should also show the ASAP plotter, so that user can close ASAP plotter explicitly to get back from Tk.mainloop.
- When ASAP plotter is closed, it should properly removed from the list of plotters under the control of matplotlib.
Change History (6)
comment:1 by , 13 years ago
Status: | new → assigned |
---|
comment:2 by , 13 years ago
Cc: | added |
---|
I modified ASAP plotter so that it won't generate the hidden plotter window at the start-up, but generate it at the first invocation of plotting operation, e.g., asapplotter.plot().
Technically speaking, asapplotter does not set asaplot instance to asapplotter._plotter at initialization (asapplotter.init). Instead, the initial value of asapplotter._plotter = None in new codes. This means plotter GUI window is not actually generated initially, because it's generated when asaplot instance is initialized. The asaplot instatnce is generated and set to asapplotter._plotter when user actually invokes plotting operation such as plot(), plottp(), figtext(), etc.
I've done some interactive plot tests before committing new codes and asapplotter worked fine. However, the changes may have moderate impacts to the whole ASAP plotter. Please let me know if you see any issue.
I'll close this ticket after some more testing, provided I won't hear any issue report by ~Apr.6.
[Summary of the commit]
Date: 2012/03/30
Rev.: r2451 @ asap-trunk
Codes: asapfitter.py, asaplot.py, asaplotgui.py, interactivemask.py, asapplotter.py, asapmath.py, asaplotbase.py, asaplotgui_qt4.py, asaplotgui_gtk.py, and flagplotter.py in asap/python
comment:3 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:4 by , 13 years ago
In order to make pl.show() work with asapplotter, the folowing changes are made:
- ASAP plotter generates plotter window and GUI at the first invocation of plotting operation, e.g., sdplot, but not at the start-up of CASA.
- ASAP plotter is put into and removed from the list of plots in matplotlib when it is generated and destroyed. This enables pl.show() show ASAP plotter and get CASA prompt back when all the plots (including ASAP plotter) are closed().
Several bugs found in interactive tests are also fixed.
comment:5 by , 13 years ago
Great work - thanks.
Did you see that I had to add
self.figmgr._cidgcf = None
to suppress atexit
errors.
comment:6 by , 13 years ago
Malte,
Yep. Thank you.
Could you describe the errors in more detail?
I haven't seen the error on CASA. So it could come from variation in matplotlib version. Anyway, asapplotter is working fine on CASA with your fixes. It's just that I'm curious.
The modifications to asapplotter and underlying classes may impact the whole ASAP which does plottings. I have tested various operations that I can imagine but there still may be unexpected side effects. Please let me know if you find any issues.
BTW, I forgot to list the additional commit number related to this issue when I close the ticket. Here is it:
r.2416, 2451 - 2453, 2535, 2541 @ trunk
2 & 3 are done on Feb. 21, 2012.
[Summary of the commit] Date: 2012/02/21 Rev.: r2416 @ asap-trunk Codes: asaplotgui.py, asaplotui_qt4.py, asapplotter.py, and customgui_tkagg.py in asap/python/