[753] | 1 | from asap import rcParams, print_log
|
---|
[709] | 2 | from numarray import logical_and
|
---|
[203] | 3 |
|
---|
| 4 | class asapplotter:
|
---|
[226] | 5 | """
|
---|
| 6 | The ASAP plotter.
|
---|
| 7 | By default the plotter is set up to plot polarisations
|
---|
| 8 | 'colour stacked' and scantables across panels.
|
---|
| 9 | Note:
|
---|
| 10 | Currenly it only plots 'spectra' not Tsys or
|
---|
| 11 | other variables.
|
---|
| 12 | """
|
---|
[734] | 13 | def __init__(self, visible=None):
|
---|
| 14 | self._visible = rcParams['plotter.gui']
|
---|
| 15 | if visible is not None:
|
---|
| 16 | self._visible = visible
|
---|
[710] | 17 | self._plotter = self._newplotter()
|
---|
| 18 |
|
---|
[203] | 19 | self._tdict = {'Time':'t','time':'t','t':'t','T':'t'}
|
---|
| 20 | self._bdict = {'Beam':'b','beam':'b','b':'b','B':'b'}
|
---|
| 21 | self._idict = {'IF':'i','if':'i','i':'i','I':'i'}
|
---|
| 22 | self._pdict = {'Pol':'p','pol':'p','p':'p'}
|
---|
| 23 | self._sdict = {'scan':'s','Scan':'s','s':'s','S':'s'}
|
---|
[525] | 24 | self._cdict = {'t':'len(self._cursor["t"])',
|
---|
| 25 | 'b':'len(self._cursor["b"])',
|
---|
| 26 | 'i':'len(self._cursor["i"])',
|
---|
| 27 | 'p':'len(self._cursor["p"])',
|
---|
[203] | 28 | 's':'len(scans)'}
|
---|
| 29 | self._ldict = {'b':'Beam',
|
---|
| 30 | 'i':'IF',
|
---|
| 31 | 'p':'Pol',
|
---|
| 32 | 's':'Scan'}
|
---|
| 33 | self._dicts = [self._tdict,self._bdict,
|
---|
| 34 | self._idict,self._pdict,
|
---|
| 35 | self._sdict]
|
---|
[554] | 36 | self._panelling = None
|
---|
| 37 | self._stacking = None
|
---|
| 38 | self.set_panelling()
|
---|
| 39 | self.set_stacking()
|
---|
[377] | 40 | self._rows = None
|
---|
| 41 | self._cols = None
|
---|
[203] | 42 | self._autoplot = False
|
---|
[525] | 43 | self._minmaxx = None
|
---|
| 44 | self._minmaxy = None
|
---|
[710] | 45 | self._datamask = None
|
---|
[203] | 46 | self._data = None
|
---|
[607] | 47 | self._lmap = None
|
---|
[226] | 48 | self._title = None
|
---|
[257] | 49 | self._ordinate = None
|
---|
| 50 | self._abcissa = None
|
---|
[709] | 51 | self._abcunit = None
|
---|
[525] | 52 | self._cursor = {'t':None, 'b':None,
|
---|
| 53 | 'i':None, 'p':None
|
---|
| 54 | }
|
---|
[710] | 55 | self._usermask = None
|
---|
| 56 | self._usermaskspectra = None
|
---|
[203] | 57 |
|
---|
[710] | 58 | def _newplotter(self):
|
---|
| 59 | if self._visible:
|
---|
| 60 | from asap.asaplotgui import asaplotgui as asaplot
|
---|
| 61 | else:
|
---|
| 62 | from asap.asaplot import asaplot
|
---|
| 63 | return asaplot()
|
---|
| 64 |
|
---|
| 65 |
|
---|
[203] | 66 | def _translate(self, name):
|
---|
| 67 | for d in self._dicts:
|
---|
| 68 | if d.has_key(name):
|
---|
| 69 | return d[name]
|
---|
| 70 | return None
|
---|
[709] | 71 |
|
---|
[525] | 72 | def plot(self, *args):
|
---|
[203] | 73 | """
|
---|
| 74 | Plot a (list of) scantables.
|
---|
| 75 | Parameters:
|
---|
[709] | 76 | one or more comma separated scantables
|
---|
[203] | 77 | Note:
|
---|
| 78 | If a (list) of scantables was specified in a previous call
|
---|
| 79 | to plot, no argument has to be given to 'replot'
|
---|
[525] | 80 | NO checking is done that the abcissas of the scantables
|
---|
[203] | 81 | are consistent e.g. all 'channel' or all 'velocity' etc.
|
---|
| 82 | """
|
---|
[710] | 83 | if self._plotter.is_dead:
|
---|
| 84 | self._plotter = self._newplotter()
|
---|
[600] | 85 | self._plotter.hold()
|
---|
[203] | 86 | self._plotter.clear()
|
---|
| 87 | if len(args) > 0:
|
---|
[709] | 88 | if self._data is not None:
|
---|
[525] | 89 | if list(args) != self._data:
|
---|
| 90 | self._data = list(args)
|
---|
[710] | 91 | # reset
|
---|
| 92 | self._reset()
|
---|
[525] | 93 | else:
|
---|
[710] | 94 | if isinstance(args[0], list):
|
---|
| 95 | self._data = args[0]
|
---|
| 96 | else:
|
---|
| 97 | self._data = list(args)
|
---|
| 98 | self._reset()
|
---|
[709] | 99 | # ranges become invalid when unit changes
|
---|
| 100 | if self._abcunit != self._data[0].get_unit():
|
---|
| 101 | self._minmaxx = None
|
---|
| 102 | self._minmaxy = None
|
---|
| 103 | self._abcunit = self._data[0].get_unit()
|
---|
[710] | 104 | self._datamask = None
|
---|
[554] | 105 | if self._panelling == 't':
|
---|
[626] | 106 | maxrows = 25
|
---|
[759] | 107 | if self._data[0].nrow() > maxrows and not (self._rows and self._cols):
|
---|
[603] | 108 | if self._cursor["t"] is None or \
|
---|
| 109 | (isinstance(self._cursor["t"],list) and \
|
---|
| 110 | len(self._cursor["t"]) > maxrows ):
|
---|
[753] | 111 | from asap import asaplog
|
---|
| 112 | msg ="Scan to be plotted contains more than %d rows.\n" \
|
---|
[603] | 113 | "Selecting first %d rows..." % (maxrows,maxrows)
|
---|
[753] | 114 | asaplog.push(msg)
|
---|
[603] | 115 | self._cursor["t"] = range(maxrows)
|
---|
[203] | 116 | self._plot_time(self._data[0], self._stacking)
|
---|
[554] | 117 | elif self._panelling == 's':
|
---|
[203] | 118 | self._plot_scans(self._data, self._stacking)
|
---|
| 119 | else:
|
---|
| 120 | self._plot_other(self._data, self._stacking)
|
---|
[709] | 121 | if self._minmaxy is not None:
|
---|
| 122 | self._plotter.set_limits(ylim=self._minmaxy)
|
---|
[203] | 123 | self._plotter.release()
|
---|
[753] | 124 | print_log()
|
---|
[203] | 125 | return
|
---|
| 126 |
|
---|
| 127 | def _plot_time(self, scan, colmode):
|
---|
| 128 | if colmode == 't':
|
---|
| 129 | return
|
---|
[525] | 130 | n = len(self._cursor["t"])
|
---|
[203] | 131 | cdict = {'b':'scan.setbeam(j)',
|
---|
| 132 | 'i':'scan.setif(j)',
|
---|
| 133 | 'p':'scan.setpol(j)'}
|
---|
[525] | 134 | cdict2 = {'b':'self._cursor["b"]',
|
---|
| 135 | 'i':'self._cursor["i"]',
|
---|
| 136 | 'p':'self._cursor["p"]'}
|
---|
| 137 | ncol = 1
|
---|
[203] | 138 | if self._stacking is not None:
|
---|
| 139 | ncol = eval(self._cdict.get(colmode))
|
---|
| 140 | if n > 1:
|
---|
[710] | 141 | ganged = rcParams['plotter.ganged']
|
---|
[377] | 142 | if self._rows and self._cols:
|
---|
| 143 | n = min(n,self._rows*self._cols)
|
---|
| 144 | self._plotter.set_panels(rows=self._rows,cols=self._cols,
|
---|
[710] | 145 | nplots=n,ganged=ganged)
|
---|
[377] | 146 | else:
|
---|
[710] | 147 | self._plotter.set_panels(rows=n,cols=0,nplots=n,ganged=ganged)
|
---|
[600] | 148 | else:
|
---|
| 149 | self._plotter.set_panels()
|
---|
[782] | 150 | allxlim=[]
|
---|
[525] | 151 | rows = self._cursor["t"]
|
---|
[759] | 152 | rows = rows[:n]
|
---|
[652] | 153 | self._plotter.palette(0)
|
---|
[525] | 154 | for rowsel in rows:
|
---|
| 155 | i = self._cursor["t"].index(rowsel)
|
---|
[203] | 156 | if n > 1:
|
---|
[652] | 157 | self._plotter.palette(0)
|
---|
[203] | 158 | self._plotter.subplot(i)
|
---|
[525] | 159 | colvals = eval(cdict2.get(colmode))
|
---|
| 160 | for j in colvals:
|
---|
| 161 | polmode = "raw"
|
---|
| 162 | jj = colvals.index(j)
|
---|
| 163 | savej = j
|
---|
| 164 | for k in cdict.keys():
|
---|
[709] | 165 | sel = eval(cdict2.get(k))
|
---|
[525] | 166 | j = sel[0]
|
---|
| 167 | if k == "p":
|
---|
| 168 | which = self._cursor["p"].index(j)
|
---|
| 169 | polmode = self._polmode[which]
|
---|
| 170 | j = which
|
---|
| 171 | eval(cdict.get(k))
|
---|
| 172 | j = savej
|
---|
| 173 | if colmode == "p":
|
---|
| 174 | polmode = self._polmode[self._cursor["p"].index(j)]
|
---|
[709] | 175 | #j = jj
|
---|
[203] | 176 | eval(cdict.get(colmode))
|
---|
| 177 | x = None
|
---|
| 178 | y = None
|
---|
| 179 | m = None
|
---|
[626] | 180 | if self._title is None:
|
---|
[709] | 181 | tlab = scan._getsourcename(rowsel)
|
---|
[226] | 182 | else:
|
---|
[626] | 183 | if len(self._title) >= n:
|
---|
[525] | 184 | tlab = self._title[rowsel]
|
---|
[226] | 185 | else:
|
---|
[525] | 186 | tlab = scan._getsourcename(rowsel)
|
---|
| 187 | x,xlab = scan.get_abcissa(rowsel)
|
---|
[257] | 188 | if self._abcissa: xlab = self._abcissa
|
---|
[525] | 189 | y = None
|
---|
[710] | 190 | m = scan._getmask(rowsel)
|
---|
| 191 | if self._usermask and self._usermask.count(j):
|
---|
| 192 | m = logical_and(self._usermask, m)
|
---|
[525] | 193 | if polmode == "stokes":
|
---|
| 194 | y = scan._getstokesspectrum(rowsel)
|
---|
| 195 | elif polmode == "stokes2":
|
---|
| 196 | y = scan._getstokesspectrum(rowsel,True)
|
---|
[541] | 197 | elif polmode == "circular":
|
---|
| 198 | y = scan._stokestopolspectrum(rowsel,False,-1)
|
---|
[525] | 199 | else:
|
---|
| 200 | y = scan._getspectrum(rowsel)
|
---|
[257] | 201 | if self._ordinate:
|
---|
| 202 | ylab = self._ordinate
|
---|
| 203 | else:
|
---|
[626] | 204 | ylab = scan._get_ordinate_label()
|
---|
[525] | 205 | m = scan._getmask(rowsel)
|
---|
[710] | 206 | if self._datamask is not None:
|
---|
| 207 | if len(m) == len(self._datamask):
|
---|
| 208 | m = logical_and(m,self._datamask)
|
---|
[226] | 209 | if self._lmap and len(self._lmap) > 0:
|
---|
[525] | 210 | llab = self._lmap[jj]
|
---|
[203] | 211 | else:
|
---|
[525] | 212 | if colmode == 'p':
|
---|
[603] | 213 | llab = self._get_pollabel(scan, polmode)
|
---|
[709] | 214 | else:
|
---|
[525] | 215 | llab = self._ldict.get(colmode)+' '+str(j)
|
---|
[203] | 216 | self._plotter.set_line(label=llab)
|
---|
[709] | 217 | if self._minmaxx is not None:
|
---|
| 218 | s,e = self._slice_indeces(x)
|
---|
| 219 | x = x[s:e]
|
---|
| 220 | y = y[s:e]
|
---|
| 221 | m = m[s:e]
|
---|
[710] | 222 | if len(x) > 1024 and rcParams['plotter.decimate']:
|
---|
| 223 | fac = len(x)/1024
|
---|
| 224 | x = x[::fac]
|
---|
| 225 | m = m[::fac]
|
---|
| 226 | y = y[::fac]
|
---|
[203] | 227 | self._plotter.plot(x,y,m)
|
---|
| 228 | xlim=[min(x),max(x)]
|
---|
[709] | 229 | if self._minmaxx is not None:
|
---|
[710] | 230 | xlim = self._minmaxx
|
---|
[782] | 231 | allxlim += xlim
|
---|
| 232 | allxlim.sort()
|
---|
| 233 | self._plotter.axes.set_xlim([allxlim[0],allxlim[-1]])
|
---|
[203] | 234 | self._plotter.set_axes('xlabel',xlab)
|
---|
| 235 | self._plotter.set_axes('ylabel',ylab)
|
---|
[709] | 236 | self._plotter.set_axes('title',tlab)
|
---|
[782] | 237 |
|
---|
[203] | 238 | return
|
---|
| 239 |
|
---|
[525] | 240 | def _plot_scans(self, scans, colmode):
|
---|
[753] | 241 | from asap import asaplog
|
---|
| 242 | msg = "Plotting mode is scans across panels. Can only plot one row per scan."
|
---|
| 243 | asaplog.push(msg)
|
---|
[203] | 244 | if colmode == 's':
|
---|
| 245 | return
|
---|
| 246 | cdict = {'b':'scan.setbeam(j)',
|
---|
| 247 | 'i':'scan.setif(j)',
|
---|
| 248 | 'p':'scan.setpol(j)'}
|
---|
[525] | 249 | cdict2 = {'b':'self._cursor["b"]',
|
---|
| 250 | 'i':'self._cursor["i"]',
|
---|
| 251 | 'p':'self._cursor["p"]'}
|
---|
[709] | 252 |
|
---|
[203] | 253 | n = len(scans)
|
---|
[525] | 254 | ncol = 1
|
---|
[203] | 255 | if self._stacking is not None:
|
---|
| 256 | scan = scans[0]
|
---|
| 257 | ncol = eval(self._cdict.get(colmode))
|
---|
| 258 | if n > 1:
|
---|
[710] | 259 | ganged = rcParams['plotter.ganged']
|
---|
[377] | 260 | if self._rows and self._cols:
|
---|
| 261 | n = min(n,self._rows*self._cols)
|
---|
[626] | 262 | self._plotter.set_panels(rows=self._rows,cols=self._cols,
|
---|
[710] | 263 | nplots=n,ganged=ganged)
|
---|
[377] | 264 | else:
|
---|
[710] | 265 | self._plotter.set_panels(rows=n,cols=0,nplots=n,ganged=ganged)
|
---|
[600] | 266 | else:
|
---|
| 267 | self._plotter.set_panels()
|
---|
[709] | 268 |
|
---|
[203] | 269 | for scan in scans:
|
---|
[652] | 270 | self._plotter.palette(0)
|
---|
[203] | 271 | if n > 1:
|
---|
[525] | 272 | self._plotter.subplot(scans.index(scan))
|
---|
| 273 | colvals = eval(cdict2.get(colmode))
|
---|
| 274 | rowsel = self._cursor["t"][0]
|
---|
[782] | 275 | allxlim=[]
|
---|
[525] | 276 | for j in colvals:
|
---|
| 277 | polmode = "raw"
|
---|
| 278 | jj = colvals.index(j)
|
---|
| 279 | savej = j
|
---|
| 280 | for k in cdict.keys():
|
---|
[709] | 281 | sel = eval(cdict2.get(k))
|
---|
[525] | 282 | j = sel[0]
|
---|
| 283 | eval(cdict.get(k))
|
---|
| 284 | if k == "p":
|
---|
| 285 | which = self._cursor["p"].index(j)
|
---|
| 286 | polmode = self._polmode[which]
|
---|
| 287 | j = which
|
---|
| 288 | j = savej
|
---|
| 289 | if colmode == "p":
|
---|
| 290 | polmode = self._polmode[self._cursor["p"].index(j)]
|
---|
[709] | 291 | #j = jj
|
---|
[203] | 292 | eval(cdict.get(colmode))
|
---|
| 293 | x = None
|
---|
| 294 | y = None
|
---|
| 295 | m = None
|
---|
[226] | 296 | tlab = self._title
|
---|
| 297 | if not self._title:
|
---|
[525] | 298 | tlab = scan._getsourcename(rowsel)
|
---|
| 299 | x,xlab = scan.get_abcissa(rowsel)
|
---|
[257] | 300 | if self._abcissa: xlab = self._abcissa
|
---|
[525] | 301 | if polmode == "stokes":
|
---|
| 302 | y = scan._getstokesspectrum(rowsel)
|
---|
| 303 | elif polmode == "stokes2":
|
---|
| 304 | y = scan._getstokesspectrum(rowsel,True)
|
---|
[541] | 305 | elif polmode == "circular":
|
---|
| 306 | y = scan._stokestopolspectrum(rowsel,False,-1)
|
---|
[525] | 307 | else:
|
---|
| 308 | y = scan._getspectrum(rowsel)
|
---|
[257] | 309 | if self._ordinate:
|
---|
| 310 | ylab = self._ordinate
|
---|
| 311 | else:
|
---|
[626] | 312 | ylab = scan._get_ordinate_label()
|
---|
[525] | 313 | m = scan._getmask(rowsel)
|
---|
[710] | 314 | if self._usermask and self._usermask.count(j):
|
---|
| 315 | m = logical_and(self._usermask, m)
|
---|
[257] | 316 | if self._lmap and len(self._lmap) > 0:
|
---|
[525] | 317 | llab = self._lmap[jj]
|
---|
[203] | 318 | else:
|
---|
[525] | 319 | if colmode == 'p':
|
---|
[603] | 320 | llab = self._get_pollabel(scan, polmode)
|
---|
[525] | 321 | else:
|
---|
| 322 | llab = self._ldict.get(colmode)+' '+str(j)
|
---|
[203] | 323 | self._plotter.set_line(label=llab)
|
---|
[709] | 324 | if self._minmaxx is not None:
|
---|
| 325 | s,e = self._slice_indeces(x)
|
---|
| 326 | x = x[s:e]
|
---|
| 327 | y = y[s:e]
|
---|
| 328 | m = m[s:e]
|
---|
[710] | 329 | if len(x) > 1024 and rcParams['plotter.decimate']:
|
---|
| 330 | fac = len(x)/1024
|
---|
| 331 | x = x[::fac]
|
---|
| 332 | m = m[::fac]
|
---|
| 333 | y = y[::fac]
|
---|
[203] | 334 | self._plotter.plot(x,y,m)
|
---|
| 335 | xlim=[min(x),max(x)]
|
---|
[709] | 336 | if self._minmaxx is not None:
|
---|
[710] | 337 | xlim = self._minmaxx
|
---|
[782] | 338 | allxlim += xlim
|
---|
| 339 | allxlim.sort()
|
---|
| 340 | self._plotter.axes.set_xlim([allxlim[0],allxlim[-1]])
|
---|
[203] | 341 | self._plotter.set_axes('xlabel',xlab)
|
---|
| 342 | self._plotter.set_axes('ylabel',ylab)
|
---|
| 343 | self._plotter.set_axes('title',tlab)
|
---|
[753] | 344 | print_log()
|
---|
[203] | 345 | return
|
---|
[709] | 346 |
|
---|
[203] | 347 | def _plot_other(self,scans,colmode):
|
---|
[554] | 348 | if colmode == self._panelling:
|
---|
[203] | 349 | return
|
---|
[525] | 350 | cdict = {'b':'scan.setbeam(i)',
|
---|
| 351 | 'i':'scan.setif(i)',
|
---|
| 352 | 'p':'scan.setpol(i)'}
|
---|
| 353 | cdict2 = {'b':'self._cursor["b"]',
|
---|
| 354 | 'i':'self._cursor["i"]',
|
---|
| 355 | 'p':'self._cursor["p"]',
|
---|
| 356 | 's': 'scans',
|
---|
| 357 | 't': 'self._cursor["t"]'}
|
---|
[203] | 358 | scan = scans[0]
|
---|
[554] | 359 | n = eval(self._cdict.get(self._panelling))
|
---|
[525] | 360 | ncol=1
|
---|
[709] | 361 | if self._stacking is not None:
|
---|
[203] | 362 | ncol = eval(self._cdict.get(colmode))
|
---|
| 363 | if n > 1:
|
---|
[710] | 364 | ganged = rcParams['plotter.ganged']
|
---|
[377] | 365 | if self._rows and self._cols:
|
---|
| 366 | n = min(n,self._rows*self._cols)
|
---|
| 367 | self._plotter.set_panels(rows=self._rows,cols=self._cols,
|
---|
[710] | 368 | nplots=n,ganged=ganged)
|
---|
[377] | 369 | else:
|
---|
[710] | 370 | self._plotter.set_panels(rows=n,cols=0,nplots=n,ganged=ganged)
|
---|
[600] | 371 | else:
|
---|
[709] | 372 | self._plotter.set_panels()
|
---|
| 373 | panels = self._cursor[self._panelling]
|
---|
[525] | 374 | for i in panels:
|
---|
[652] | 375 | self._plotter.palette(0)
|
---|
[525] | 376 | polmode = "raw"
|
---|
[554] | 377 | ii = self._cursor[self._panelling].index(i)
|
---|
[203] | 378 | if n>1:
|
---|
[525] | 379 | self._plotter.subplot(ii)
|
---|
[554] | 380 | if self._panelling == "p":
|
---|
[525] | 381 | polmode = self._polmode[ii]
|
---|
[753] | 382 |
|
---|
| 383 | eval(cdict.get(self._panelling))
|
---|
| 384 |
|
---|
[782] | 385 | allxlim=[]
|
---|
[525] | 386 | colvals = eval(cdict2.get(colmode))
|
---|
| 387 | for j in colvals:
|
---|
| 388 | rowsel = self._cursor["t"][0]
|
---|
| 389 | jj = colvals.index(j)
|
---|
| 390 | savei = i
|
---|
| 391 | for k in cdict.keys():
|
---|
[554] | 392 | if k != self._panelling:
|
---|
[525] | 393 | sel = eval(cdict2.get(k))
|
---|
| 394 | i = sel[0]
|
---|
| 395 | if k == "p":
|
---|
[557] | 396 | which = self._cursor["p"].index(i)
|
---|
[525] | 397 | polmode = self._polmode[which]
|
---|
[709] | 398 | i = which
|
---|
[525] | 399 | eval(cdict.get(k))
|
---|
| 400 | i = savei
|
---|
[203] | 401 | if colmode == 's':
|
---|
[525] | 402 | scan = j
|
---|
[203] | 403 | elif colmode == 't':
|
---|
[709] | 404 | rowsel = j
|
---|
[203] | 405 | else:
|
---|
[525] | 406 | savei = i
|
---|
| 407 | if colmode == 'p':
|
---|
| 408 | polmode = self._polmode[self._cursor["p"].index(j)]
|
---|
[753] | 409 |
|
---|
[525] | 410 | i = j
|
---|
[203] | 411 | eval(cdict.get(colmode))
|
---|
[525] | 412 | i = savei
|
---|
[783] | 413 | #if self._panelling == "p":
|
---|
| 414 | eval(cdict.get(self._panelling))
|
---|
[203] | 415 | x = None
|
---|
| 416 | y = None
|
---|
| 417 | m = None
|
---|
[525] | 418 | x,xlab = scan.get_abcissa(rowsel)
|
---|
[257] | 419 | if self._abcissa: xlab = self._abcissa
|
---|
[525] | 420 | if polmode == "stokes":
|
---|
| 421 | y = scan._getstokesspectrum(rowsel)
|
---|
| 422 | elif polmode == "stokes2":
|
---|
| 423 | y = scan._getstokesspectrum(rowsel,True)
|
---|
[541] | 424 | elif polmode == "circular":
|
---|
| 425 | y = scan._stokestopolspectrum(rowsel,False,-1)
|
---|
[525] | 426 | else:
|
---|
| 427 | y = scan._getspectrum(rowsel)
|
---|
| 428 |
|
---|
[257] | 429 | if self._ordinate:
|
---|
| 430 | ylab = self._ordinate
|
---|
| 431 | else:
|
---|
[626] | 432 | ylab = scan._get_ordinate_label()
|
---|
[525] | 433 | m = scan._getmask(rowsel)
|
---|
[710] | 434 | if self._usermask and self._usermask.count(j):
|
---|
| 435 | m = logical_and(self._usermask, m)
|
---|
| 436 |
|
---|
[203] | 437 | if colmode == 's' or colmode == 't':
|
---|
[525] | 438 | if self._title and len(self._title) > 0:
|
---|
| 439 | tlab = self._title[ii]
|
---|
[709] | 440 | else:
|
---|
| 441 | if self._panelling == 'p':
|
---|
| 442 | tlab = self._get_pollabel(scan, polmode)
|
---|
| 443 | else:
|
---|
| 444 | tlab = self._ldict.get(self._panelling)+' '+str(i)
|
---|
[607] | 445 | if self._lmap and len(self._lmap) > 0:
|
---|
| 446 | llab = self._lmap[jj]
|
---|
| 447 | else:
|
---|
| 448 | llab = scan._getsourcename(rowsel)
|
---|
[203] | 449 | else:
|
---|
[226] | 450 | if self._title and len(self._title) > 0:
|
---|
[525] | 451 | tlab = self._title[ii]
|
---|
[226] | 452 | else:
|
---|
[603] | 453 | if self._panelling == 'p':
|
---|
| 454 | tlab = self._get_pollabel(scan, polmode)
|
---|
| 455 | else:
|
---|
| 456 | tlab = self._ldict.get(self._panelling)+' '+str(i)
|
---|
[226] | 457 | if self._lmap and len(self._lmap) > 0:
|
---|
[525] | 458 | llab = self._lmap[jj]
|
---|
[203] | 459 | else:
|
---|
[525] | 460 | if colmode == 'p':
|
---|
[603] | 461 | llab = self._get_pollabel(scan, polmode)
|
---|
[525] | 462 | else:
|
---|
| 463 | llab = self._ldict.get(colmode)+' '+str(j)
|
---|
[203] | 464 | self._plotter.set_line(label=llab)
|
---|
[709] | 465 | if self._minmaxx is not None:
|
---|
| 466 | s,e = self._slice_indeces(x)
|
---|
| 467 | x = x[s:e]
|
---|
| 468 | y = y[s:e]
|
---|
| 469 | m = m[s:e]
|
---|
[710] | 470 | if len(x) > 1024 and rcParams['plotter.decimate']:
|
---|
| 471 | fac = len(x)/1024
|
---|
| 472 | x = x[::fac]
|
---|
| 473 | m = m[::fac]
|
---|
| 474 | y = y[::fac]
|
---|
[203] | 475 | self._plotter.plot(x,y,m)
|
---|
| 476 | xlim=[min(x),max(x)]
|
---|
[709] | 477 | if self._minmaxx is not None:
|
---|
[710] | 478 | xlim = self._minmaxx
|
---|
[782] | 479 | allxlim += xlim
|
---|
| 480 | allxlim.sort()
|
---|
| 481 | self._plotter.axes.set_xlim([allxlim[0],allxlim[-1]])
|
---|
[203] | 482 |
|
---|
| 483 | self._plotter.set_axes('xlabel',xlab)
|
---|
| 484 | self._plotter.set_axes('ylabel',ylab)
|
---|
| 485 | self._plotter.set_axes('title',tlab)
|
---|
[709] | 486 |
|
---|
[203] | 487 | return
|
---|
| 488 |
|
---|
| 489 |
|
---|
[226] | 490 | def set_mode(self, stacking=None, panelling=None):
|
---|
[203] | 491 | """
|
---|
[377] | 492 | Set the plots look and feel, i.e. what you want to see on the plot.
|
---|
[203] | 493 | Parameters:
|
---|
| 494 | stacking: tell the plotter which variable to plot
|
---|
[710] | 495 | as line color overlays (default 'pol')
|
---|
[203] | 496 | panelling: tell the plotter which variable to plot
|
---|
| 497 | across multiple panels (default 'scan'
|
---|
| 498 | Note:
|
---|
| 499 | Valid modes are:
|
---|
| 500 | 'beam' 'Beam' 'b': Beams
|
---|
| 501 | 'if' 'IF' 'i': IFs
|
---|
| 502 | 'pol' 'Pol' 'p': Polarisations
|
---|
| 503 | 'scan' 'Scan' 's': Scans
|
---|
| 504 | 'time' 'Time' 't': Times
|
---|
| 505 | """
|
---|
[753] | 506 | msg = "Invalid mode"
|
---|
| 507 | if not self.set_panelling(panelling) or \
|
---|
| 508 | not self.set_stacking(stacking):
|
---|
| 509 | if rcParams['verbose']:
|
---|
| 510 | print msg
|
---|
| 511 | return
|
---|
| 512 | else:
|
---|
| 513 | raise TypeError(msg)
|
---|
[226] | 514 | if self._data: self.plot()
|
---|
[203] | 515 | return
|
---|
| 516 |
|
---|
[554] | 517 | def set_panelling(self, what=None):
|
---|
| 518 | mode = what
|
---|
| 519 | if mode is None:
|
---|
| 520 | mode = rcParams['plotter.panelling']
|
---|
| 521 | md = self._translate(mode)
|
---|
[203] | 522 | if md:
|
---|
[554] | 523 | self._panelling = md
|
---|
[226] | 524 | self._title = None
|
---|
[203] | 525 | return True
|
---|
| 526 | return False
|
---|
| 527 |
|
---|
[377] | 528 | def set_layout(self,rows=None,cols=None):
|
---|
| 529 | """
|
---|
| 530 | Set the multi-panel layout, i.e. how many rows and columns plots
|
---|
| 531 | are visible.
|
---|
| 532 | Parameters:
|
---|
| 533 | rows: The number of rows of plots
|
---|
| 534 | cols: The number of columns of plots
|
---|
| 535 | Note:
|
---|
| 536 | If no argument is given, the potter reverts to its auto-plot
|
---|
| 537 | behaviour.
|
---|
| 538 | """
|
---|
| 539 | self._rows = rows
|
---|
| 540 | self._cols = cols
|
---|
| 541 | if self._data: self.plot()
|
---|
| 542 | return
|
---|
| 543 |
|
---|
[709] | 544 | def set_stacking(self, what=None):
|
---|
[554] | 545 | mode = what
|
---|
[709] | 546 | if mode is None:
|
---|
| 547 | mode = rcParams['plotter.stacking']
|
---|
[554] | 548 | md = self._translate(mode)
|
---|
[203] | 549 | if md:
|
---|
| 550 | self._stacking = md
|
---|
[226] | 551 | self._lmap = None
|
---|
[203] | 552 | return True
|
---|
| 553 | return False
|
---|
| 554 |
|
---|
[525] | 555 | def set_range(self,xstart=None,xend=None,ystart=None,yend=None):
|
---|
[203] | 556 | """
|
---|
| 557 | Set the range of interest on the abcissa of the plot
|
---|
| 558 | Parameters:
|
---|
[525] | 559 | [x,y]start,[x,y]end: The start and end points of the 'zoom' window
|
---|
[203] | 560 | Note:
|
---|
| 561 | These become non-sensical when the unit changes.
|
---|
| 562 | use plotter.set_range() without parameters to reset
|
---|
| 563 |
|
---|
| 564 | """
|
---|
[525] | 565 | if xstart is None and xend is None:
|
---|
| 566 | self._minmaxx = None
|
---|
[600] | 567 | else:
|
---|
| 568 | self._minmaxx = [xstart,xend]
|
---|
[525] | 569 | if ystart is None and yend is None:
|
---|
| 570 | self._minmaxy = None
|
---|
[600] | 571 | else:
|
---|
[709] | 572 | self._minmaxy = [ystart,yend]
|
---|
[525] | 573 | if self._data: self.plot()
|
---|
[203] | 574 | return
|
---|
[709] | 575 |
|
---|
[257] | 576 | def set_legend(self, mp=None):
|
---|
[203] | 577 | """
|
---|
| 578 | Specify a mapping for the legend instead of using the default
|
---|
| 579 | indices:
|
---|
| 580 | Parameters:
|
---|
| 581 | mp: a list of 'strings'. This should have the same length
|
---|
| 582 | as the number of elements on the legend and then maps
|
---|
[710] | 583 | to the indeces in order. It is possible to uses latex
|
---|
| 584 | math expression. These have to be enclosed in r'', e.g. r'$x^{2}$'
|
---|
[203] | 585 |
|
---|
| 586 | Example:
|
---|
[485] | 587 | If the data has two IFs/rest frequencies with index 0 and 1
|
---|
[203] | 588 | for CO and SiO:
|
---|
| 589 | plotter.set_stacking('i')
|
---|
[710] | 590 | plotter.set_legend(['CO','SiO'])
|
---|
[203] | 591 | plotter.plot()
|
---|
[710] | 592 | plotter.set_legend([r'$^{12}CO$', r'SiO'])
|
---|
[203] | 593 | """
|
---|
| 594 | self._lmap = mp
|
---|
[226] | 595 | if self._data: self.plot()
|
---|
| 596 | return
|
---|
| 597 |
|
---|
| 598 | def set_title(self, title=None):
|
---|
[710] | 599 | """
|
---|
| 600 | Set the title of the plot. If multiple panels are plotted,
|
---|
| 601 | multiple titles have to be specified.
|
---|
| 602 | Example:
|
---|
| 603 | # two panels are visible on the plotter
|
---|
| 604 | plotter.set_title(["First Panel","Second Panel"])
|
---|
| 605 | """
|
---|
[226] | 606 | self._title = title
|
---|
| 607 | if self._data: self.plot()
|
---|
| 608 | return
|
---|
| 609 |
|
---|
[257] | 610 | def set_ordinate(self, ordinate=None):
|
---|
[710] | 611 | """
|
---|
| 612 | Set the y-axis label of the plot. If multiple panels are plotted,
|
---|
| 613 | multiple labels have to be specified.
|
---|
| 614 | Example:
|
---|
| 615 | # two panels are visible on the plotter
|
---|
| 616 | plotter.set_ordinate(["First Y-Axis","Second Y-Axis"])
|
---|
| 617 | """
|
---|
[257] | 618 | self._ordinate = ordinate
|
---|
| 619 | if self._data: self.plot()
|
---|
| 620 | return
|
---|
| 621 |
|
---|
| 622 | def set_abcissa(self, abcissa=None):
|
---|
[710] | 623 | """
|
---|
| 624 | Set the x-axis label of the plot. If multiple panels are plotted,
|
---|
| 625 | multiple labels have to be specified.
|
---|
| 626 | Example:
|
---|
| 627 | # two panels are visible on the plotter
|
---|
| 628 | plotter.set_ordinate(["First X-Axis","Second X-Axis"])
|
---|
| 629 | """
|
---|
[257] | 630 | self._abcissa = abcissa
|
---|
| 631 | if self._data: self.plot()
|
---|
| 632 | return
|
---|
| 633 |
|
---|
[710] | 634 | def set_colors(self, colormap):
|
---|
[377] | 635 | """
|
---|
[710] | 636 | Set the colors to be used. The plotter will cycle through
|
---|
| 637 | these colors when lines are overlaid (stacking mode).
|
---|
| 638 | Example:
|
---|
| 639 | plotter.set_colors("red green blue")
|
---|
| 640 | # If for example four lines are overlaid e.g I Q U V
|
---|
| 641 | # 'I' will be 'red', 'Q' will be 'green', U will be 'blue'
|
---|
| 642 | # and 'V' will be 'red' again.
|
---|
| 643 | """
|
---|
| 644 | if isinstance(colormap,str):
|
---|
| 645 | colormap = colormap.split()
|
---|
| 646 | self._plotter.palette(0,colormap=colormap)
|
---|
| 647 | if self._data: self.plot()
|
---|
| 648 |
|
---|
| 649 | def set_linestyles(self, linestyles):
|
---|
| 650 | """
|
---|
[734] | 651 | Set the linestyles to be used. The plotter will cycle through
|
---|
| 652 | these linestyles when lines are overlaid (stacking mode) AND
|
---|
| 653 | only one color has been set.
|
---|
[710] | 654 | Parameters:
|
---|
| 655 | linestyles: a list of linestyles to use.
|
---|
| 656 | 'line', 'dashed', 'dotted', 'dashdot',
|
---|
| 657 | 'dashdotdot' and 'dashdashdot' are
|
---|
| 658 | possible
|
---|
| 659 |
|
---|
| 660 | Example:
|
---|
| 661 | plotter.set_colors("black")
|
---|
| 662 | plotter.set_linestyles("line dashed dotted dashdot")
|
---|
| 663 | # If for example four lines are overlaid e.g I Q U V
|
---|
| 664 | # 'I' will be 'solid', 'Q' will be 'dashed',
|
---|
| 665 | # U will be 'dotted' and 'V' will be 'dashdot'.
|
---|
| 666 | """
|
---|
| 667 | if isinstance(linestyles,str):
|
---|
| 668 | linestyles = linestyles.split()
|
---|
| 669 | self._plotter.palette(color=0,linestyle=0,linestyles=linestyles)
|
---|
| 670 | if self._data: self.plot()
|
---|
| 671 |
|
---|
| 672 | def save(self, filename=None, orientation=None, dpi=None):
|
---|
| 673 | """
|
---|
[377] | 674 | Save the plot to a file. The know formats are 'png', 'ps', 'eps'.
|
---|
| 675 | Parameters:
|
---|
| 676 | filename: The name of the output file. This is optional
|
---|
| 677 | and autodetects the image format from the file
|
---|
| 678 | suffix. If non filename is specified a file
|
---|
| 679 | called 'yyyymmdd_hhmmss.png' is created in the
|
---|
| 680 | current directory.
|
---|
[709] | 681 | orientation: optional parameter for postscript only (not eps).
|
---|
| 682 | 'landscape', 'portrait' or None (default) are valid.
|
---|
| 683 | If None is choosen for 'ps' output, the plot is
|
---|
| 684 | automatically oriented to fill the page.
|
---|
[710] | 685 | dpi: The dpi of the output non-ps plot
|
---|
[377] | 686 | """
|
---|
[709] | 687 | self._plotter.save(filename,orientation,dpi)
|
---|
[377] | 688 | return
|
---|
[709] | 689 |
|
---|
[541] | 690 | def set_cursor(self, row=None,beam=None,IF=None,pol=None, refresh=True):
|
---|
[525] | 691 | """
|
---|
| 692 | Specify a 'cursor' for plotting selected spectra. Time (rows),
|
---|
| 693 | Beam, IF, Polarisation ranges can be specified.
|
---|
| 694 | Parameters:
|
---|
| 695 | Default for all paramaters is to select all available
|
---|
| 696 | row: selects the rows (time stamps) to be plotted, this has
|
---|
| 697 | to be a vector of row indices, e.g. row=[0,2,5] or row=[2]
|
---|
| 698 | beam: select a range of beams
|
---|
| 699 | IF: select a range of IFs
|
---|
| 700 | pol: select Polarisations for plotting these can be by index
|
---|
| 701 | (raw polarisations (default)) or by names any of:
|
---|
| 702 | ["I", "Q", "U", "V"] or
|
---|
| 703 | ["I", "Plinear", "Pangle", "V"] or
|
---|
[541] | 704 | ["XX", "YY", "Real(XY)", "Imag(XY)"] or
|
---|
| 705 | ["RR", "LL"]
|
---|
[525] | 706 | Example:
|
---|
| 707 | plotter.set_mode('pol','time')
|
---|
| 708 | plotter.plot(myscan) # plots all raw polarisations colour stacked
|
---|
| 709 | plotter.set_cursor(pol=["I"]) # plot "I" only for all rows
|
---|
| 710 | # plot "I" only for two time stamps row=0 and row=2
|
---|
| 711 | plotter.set_cursor(row=[0,2],pol=["I"])
|
---|
[257] | 712 |
|
---|
[525] | 713 | Note:
|
---|
[709] | 714 | Be careful to select only exisiting polarisations.
|
---|
[525] | 715 | """
|
---|
| 716 | if not self._data:
|
---|
[753] | 717 | msg = "Can only set cursor after a first call to plot()"
|
---|
| 718 | if rcParams['verbose']:
|
---|
| 719 | print msg
|
---|
| 720 | return
|
---|
| 721 | else:
|
---|
| 722 | raise RuntimeError(msg)
|
---|
[709] | 723 |
|
---|
[525] | 724 | n = self._data[0].nrow()
|
---|
| 725 | if row is None:
|
---|
| 726 | self._cursor["t"] = range(n)
|
---|
| 727 | else:
|
---|
| 728 | for i in row:
|
---|
[554] | 729 | if i < 0 or i >= n:
|
---|
[753] | 730 | msg = "Row index '%d' out of range" % i
|
---|
| 731 | if rcParams['verbose']:
|
---|
| 732 | print msg
|
---|
[759] | 733 | return
|
---|
[753] | 734 | else:
|
---|
| 735 | raise IndexError(msg)
|
---|
[525] | 736 | self._cursor["t"] = row
|
---|
| 737 |
|
---|
| 738 | n = self._data[0].nbeam()
|
---|
| 739 | if beam is None:
|
---|
| 740 | self._cursor["b"] = range(n)
|
---|
| 741 | else:
|
---|
| 742 | for i in beam:
|
---|
[554] | 743 | if i < 0 or i >= n:
|
---|
[753] | 744 | msg = "Beam index '%d' out of range" % i
|
---|
| 745 | if rcParams['verbose']:
|
---|
| 746 | print msg
|
---|
[759] | 747 | return
|
---|
[753] | 748 | else:
|
---|
| 749 | raise IndexError(msg)
|
---|
| 750 |
|
---|
[525] | 751 | self._cursor["b"] = beam
|
---|
| 752 |
|
---|
| 753 | n = self._data[0].nif()
|
---|
| 754 | if IF is None:
|
---|
| 755 | self._cursor["i"] = range(n)
|
---|
| 756 | else:
|
---|
| 757 | for i in IF:
|
---|
[554] | 758 | if i < 0 or i >= n:
|
---|
[753] | 759 | msg = "IF index '%d' out of range" %i
|
---|
| 760 | if rcParams['verbose']:
|
---|
| 761 | print msg
|
---|
[759] | 762 | return
|
---|
[753] | 763 | else:
|
---|
| 764 | raise IndexError(msg)
|
---|
[709] | 765 | self._cursor["i"] = IF
|
---|
[525] | 766 |
|
---|
| 767 | n = self._data[0].npol()
|
---|
| 768 | dstokes = {"I":0,"Q":1,"U":2,"V":3}
|
---|
| 769 | dstokes2 = {"I":0,"Plinear":1,"Pangle":2,"V":3}
|
---|
| 770 | draw = {"XX":0, "YY":1,"Real(XY)":2, "Imag(XY)":3}
|
---|
[710] | 771 | dcirc = { "RR":0,"LL":1}#,"Real(RL)":2,"Imag(RL)":3}
|
---|
[709] | 772 |
|
---|
[525] | 773 | if pol is None:
|
---|
| 774 | self._cursor["p"] = range(n)
|
---|
| 775 | self._polmode = ["raw" for i in range(n)]
|
---|
| 776 | else:
|
---|
| 777 | if isinstance(pol,str):
|
---|
| 778 | pol = pol.split()
|
---|
| 779 | polmode = []
|
---|
| 780 | pols = []
|
---|
| 781 | for i in pol:
|
---|
| 782 | if isinstance(i,str):
|
---|
| 783 | if draw.has_key(i):
|
---|
| 784 | pols.append(draw.get(i))
|
---|
| 785 | polmode.append("raw")
|
---|
| 786 | elif dstokes.has_key(i):
|
---|
| 787 | pols.append(dstokes.get(i))
|
---|
| 788 | polmode.append("stokes")
|
---|
| 789 | elif dstokes2.has_key(i):
|
---|
| 790 | pols.append(dstokes2.get(i))
|
---|
| 791 | polmode.append("stokes2")
|
---|
| 792 | elif dcirc.has_key(i):
|
---|
| 793 | pols.append(dcirc.get(i))
|
---|
[541] | 794 | polmode.append("circular")
|
---|
[525] | 795 | else:
|
---|
[753] | 796 | msg = "Pol type '%s' not valid" %i
|
---|
| 797 | if rcParams['verbose']:
|
---|
| 798 | print msg
|
---|
[759] | 799 | return
|
---|
[753] | 800 | else:
|
---|
[759] | 801 | raise TypeError(msg)
|
---|
[525] | 802 | elif 0 > i >= n:
|
---|
| 803 | print "Pol index '%d' out of range" %i
|
---|
[753] | 804 | if rcParams['verbose']:
|
---|
| 805 | print msg
|
---|
[759] | 806 | return
|
---|
[753] | 807 | else:
|
---|
[759] | 808 | raise IndexError(msg)
|
---|
[525] | 809 | else:
|
---|
| 810 | pols.append(i)
|
---|
| 811 | polmode.append("raw")
|
---|
| 812 | self._cursor["p"] = pols
|
---|
| 813 | self._polmode = polmode
|
---|
[541] | 814 | if self._data and refresh: self.plot()
|
---|
[525] | 815 |
|
---|
[710] | 816 | def set_mask(self, mask=None, pol=None):
|
---|
[734] | 817 | """
|
---|
| 818 | Set a plotting mask for a specific polarization.
|
---|
| 819 | This is useful for masking out "noise" Pangle outside a source.
|
---|
| 820 | Parameters:
|
---|
| 821 | mask: a mask from scantable.create_mask
|
---|
| 822 | pol: the polarisation to apply the mask to, e.g
|
---|
| 823 | "Pangle" or "XX" etc.
|
---|
| 824 | Example:
|
---|
| 825 | """
|
---|
[710] | 826 | if not self._data:
|
---|
[753] | 827 | msg = "Can only set cursor after a first call to plot()"
|
---|
| 828 | if rcParams['verbose']:
|
---|
| 829 | print msg
|
---|
[759] | 830 | return
|
---|
[753] | 831 | else:
|
---|
[759] | 832 | raise RuntimeError(msg)
|
---|
[710] | 833 | if isinstance(mask, array):
|
---|
| 834 | self._usermask = mask
|
---|
| 835 | if isinstance(mask, list):
|
---|
| 836 | self._usermask = array(mask)
|
---|
| 837 | if mask is None and pol is None:
|
---|
| 838 | self._usermask = None
|
---|
| 839 | self._usermaskspectra = None
|
---|
| 840 |
|
---|
| 841 | dstokes = {"I":0,"Q":1,"U":2,"V":3}
|
---|
| 842 | dstokes2 = {"I":0,"Plinear":1,"Pangle":2,"V":3}
|
---|
| 843 | draw = {"XX":0, "YY":1,"Real(XY)":2, "Imag(XY)":3}
|
---|
| 844 | dcirc = { "RR":0,"LL":1}#,"Real(RL)":2,"Imag(RL)":3}
|
---|
| 845 | if isinstance(pol, str):
|
---|
| 846 | pol = pol.split()
|
---|
| 847 | if isinstance(pol, list):
|
---|
| 848 | if isinstance(pol[0], str):
|
---|
| 849 | pass
|
---|
| 850 | else:
|
---|
| 851 | cpos = self._cursor[self._stacking]
|
---|
| 852 | self._usermaskspectra =filter(lambda i: filter(lambda j: j==i ,cpos),pol)
|
---|
| 853 | else:
|
---|
| 854 | return
|
---|
| 855 | self.plot()
|
---|
| 856 |
|
---|
[603] | 857 | def _get_pollabel(self, scan, polmode):
|
---|
| 858 | tlab = ""
|
---|
| 859 | if polmode == "stokes":
|
---|
| 860 | tlab = scan._getpolarizationlabel(0,1,0)
|
---|
| 861 | elif polmode == "stokes2":
|
---|
| 862 | tlab = scan._getpolarizationlabel(0,1,1)
|
---|
| 863 | elif polmode == "circular":
|
---|
| 864 | tlab = scan._getpolarizationlabel(0,0,0)
|
---|
| 865 | else:
|
---|
| 866 | tlab = scan._getpolarizationlabel(1,0,0)
|
---|
| 867 | return tlab
|
---|
[709] | 868 |
|
---|
| 869 | def _slice_indeces(self, data):
|
---|
| 870 | mn = self._minmaxx[0]
|
---|
| 871 | mx = self._minmaxx[1]
|
---|
| 872 | asc = data[0] < data[-1]
|
---|
| 873 | start=0
|
---|
| 874 | end = len(data)-1
|
---|
| 875 | inc = 1
|
---|
| 876 | if not asc:
|
---|
| 877 | start = len(data)-1
|
---|
| 878 | end = 0
|
---|
| 879 | inc = -1
|
---|
| 880 | # find min index
|
---|
| 881 | while data[start] < mn:
|
---|
| 882 | start+= inc
|
---|
| 883 | # find max index
|
---|
| 884 | while data[end] > mx:
|
---|
| 885 | end-=inc
|
---|
| 886 | end +=1
|
---|
| 887 | if start > end:
|
---|
| 888 | return end,start
|
---|
| 889 | return start,end
|
---|
| 890 |
|
---|
[710] | 891 | def _reset(self):
|
---|
| 892 | self._usermask = None
|
---|
| 893 | self._usermaskspectra = None
|
---|
| 894 | self.set_cursor(refresh=False)
|
---|