source: trunk/python/flagplotter.py@ 1996

Last change on this file since 1996 was 1996, checked in by Kana Sugimoto, 14 years ago

New Development: Yes

JIRA Issue: Yes (CAS-1306)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: New plotter and toolbar for graphical flagging

Test Programs:

scan = asap.scantable(filename=sdfile,average=False)
guiflagger = asap.flagplotter(visible=True)
guiflagger.plot(scan)
## modify flag on the plot
scan.save(name='flagged_file.asap',format='ASAP')

Put in Release Notes: Yes

Module(s): itself

Description:

A new flagplotter module is added for graphical flagging.
A new flagtoolbar module is added for the plotter.

File size: 2.1 KB
Line 
1from asap.asapplotter import asapplotter
2from asap.logging import asaplog, asaplog_post_dec
3
4from asap.parameters import rcParams
5from asap.selector import selector
6from asap.scantable import scantable
7import matplotlib.axes
8from matplotlib.font_manager import FontProperties
9from matplotlib.text import Text
10
11class flagplotter(asapplotter):
12 """
13 The flag plotter
14 Only row based panneling is allowed.
15
16 Example:
17 scan = asap.scantable(filename='your_filename',average=False)
18 guiflagger = asap.flagplotter(visible=True)
19 guiflagger.plot(scan)
20 ### flag/Unflag data graphically.
21 scan.save(name='flagged_file.asap',format='ASAP')
22
23 NOTICE:
24 The flagged data is not saved until you explicitly run scantable.save
25 """
26 def __init__(self, visible=None, **kwargs):
27 self._scan=None
28 asapplotter.__init__(self,visible=visible, **kwargs)
29 self._panelling = 'r'
30 self._stacking = 's'
31
32 def _newcasabar(self):
33 backend=matplotlib.get_backend()
34 if self._visible and backend == "TkAgg":
35 #from asap.casatoolbar import CustomToolbarTkAgg
36 #return CustomToolbarTkAgg(self)
37 from asap.flagtoolbar import CustomFlagToolbarTkAgg
38 return CustomFlagToolbarTkAgg(self)
39 return None
40
41 def set_mode(self, stacking=None, panelling=None, refresh=True):
42 """ This function is not available for the class flagplotter """
43 self._invalid_func(name='set_mode')
44
45 def set_panelling(self, what=None):
46 """ This function is not available for the class flagplotter """
47 self._invalid_func(name='set_panelling')
48
49 def set_stacking(self, what=None):
50 """ This function is not available for the class flagplotter """
51 self._invalid_func(name='set_stacking')
52
53 @asaplog_post_dec
54 def _invalid_func(self, name):
55 msg = "Invalid function 'flagplotter."+name+"'"
56 asaplog.push(msg)
57 asaplog.post('ERROR')
58
59 def save_data(self, name=None, format=None, overwrite=False):
60 # simply calls scantable.save
61 self._data.save(name,format,overwrite)
Note: See TracBrowser for help on using the repository browser.