Changeset 1897 for trunk/python


Ignore:
Timestamp:
08/25/10 11:05:30 (14 years ago)
Author:
Malte Marquarding
Message:

Ticket #202: add offset keyword to asapplotter.set_range

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r1862 r1897  
    5151        self._fp = FontProperties()
    5252        self._panellayout = self.set_panellayout(refresh=False)
     53        self._offset = None
    5354
    5455    def _translate(self, instr):
     
    103104            msg = "Input is not a scantable"
    104105            raise TypeError(msg)
    105         if scan: self.set_data(scan,refresh=False)
     106        if scan:
     107            self.set_data(scan, refresh=False)
    106108        self._plot(self._data)
    107109        if self._minmaxy is not None:
     
    293295                    # reset
    294296                    self._reset()
    295                     msg = "A new scantable is set to the plotter. The masks and data selections are reset."
     297                    msg = "A new scantable is set to the plotter. "\
     298                          "The masks and data selections are reset."
    296299                    asaplog.push( msg )
    297300            else:
     
    385388        return False
    386389
    387     def set_range(self,xstart=None,xend=None,ystart=None,yend=None,refresh=True):
     390    def set_range(self,xstart=None,xend=None,ystart=None,yend=None,refresh=True, offset=None):
    388391        """
    389392        Set the range of interest on the abcissa of the plot
     
    393396                      replotted based on the new parameter setting(s).
    394397                      Otherwise,the parameter(s) are set without replotting.
     398            offset:   shift the abcissa by the given amount. The abcissa label will
     399                      have '(relative)' appended to it.
    395400        Note:
    396401            These become non-sensical when the unit changes.
     
    398403
    399404        """
     405        self._offset = offset
    400406        if xstart is None and xend is None:
    401407            self._minmaxx = None
     
    804810        self._usermask = []
    805811        self._usermaskspectra = None
     812        self._offset = None
    806813        self.set_selection(None, False)
    807814
     
    869876                xlab = self._abcissa and self._abcissa[panelcount] \
    870877                       or scan._getabcissalabel()
     878                if self._offset and not self._abcissa:
     879                    xlab += " (relative)"
    871880                ylab = self._ordinate and self._ordinate[panelcount] \
    872881                       or scan._get_ordinate_label()
     
    895904                    if d[self._stacking](r) in self._maskselection[self._stacking]:
    896905                        m = logical_and(m, self._usermask)
    897                 x = scan._getabcissa(r)
    898906                from numpy import ma, array
     907                x = array(scan._getabcissa(r))
     908                if self._offset:
     909                    x += self._offset
    899910                y = ma.masked_array(y,mask=logical_not(array(m,copy=False)))
    900911                if self._minmaxx is not None:
Note: See TracChangeset for help on using the changeset viewer.