[1996] | 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)
|
---|
[1997] | 29 | self._plotter.window.title('Flag Plotter')
|
---|
[1996] | 30 | self._panelling = 'r'
|
---|
| 31 | self._stacking = 's'
|
---|
| 32 |
|
---|
| 33 | def _newcasabar(self):
|
---|
| 34 | backend=matplotlib.get_backend()
|
---|
| 35 | if self._visible and backend == "TkAgg":
|
---|
| 36 | #from asap.casatoolbar import CustomToolbarTkAgg
|
---|
| 37 | #return CustomToolbarTkAgg(self)
|
---|
| 38 | from asap.flagtoolbar import CustomFlagToolbarTkAgg
|
---|
| 39 | return CustomFlagToolbarTkAgg(self)
|
---|
| 40 | return None
|
---|
| 41 |
|
---|
| 42 | def set_mode(self, stacking=None, panelling=None, refresh=True):
|
---|
| 43 | """ This function is not available for the class flagplotter """
|
---|
| 44 | self._invalid_func(name='set_mode')
|
---|
| 45 |
|
---|
| 46 | def set_panelling(self, what=None):
|
---|
| 47 | """ This function is not available for the class flagplotter """
|
---|
| 48 | self._invalid_func(name='set_panelling')
|
---|
| 49 |
|
---|
| 50 | def set_stacking(self, what=None):
|
---|
| 51 | """ This function is not available for the class flagplotter """
|
---|
| 52 | self._invalid_func(name='set_stacking')
|
---|
| 53 |
|
---|
| 54 | @asaplog_post_dec
|
---|
| 55 | def _invalid_func(self, name):
|
---|
| 56 | msg = "Invalid function 'flagplotter."+name+"'"
|
---|
| 57 | asaplog.push(msg)
|
---|
| 58 | asaplog.post('ERROR')
|
---|
| 59 |
|
---|
| 60 | def save_data(self, name=None, format=None, overwrite=False):
|
---|
| 61 | # simply calls scantable.save
|
---|
| 62 | self._data.save(name,format,overwrite)
|
---|