1 | from asap.asapplotter import asapplotter
|
---|
2 | from asap.logging import asaplog, asaplog_post_dec
|
---|
3 |
|
---|
4 | from asap.parameters import rcParams
|
---|
5 | from asap.selector import selector
|
---|
6 | from asap.scantable import scantable
|
---|
7 | import matplotlib.axes
|
---|
8 | from matplotlib.font_manager import FontProperties
|
---|
9 | from matplotlib.text import Text
|
---|
10 |
|
---|
11 | class 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)
|
---|