Exemple #1
0
    def changeUnit(self, unit):
        #save old unit
        oldunit = self.unit()

        #use parent class's changeUnit, but please remember:
        if self.__isslice:
            msg =  "This axis %r is a slice. cannot change unit." % self.name()
            raise RuntimeError, msg
        
        #there is a problem with mapper!!!!
        Dataset.changeUnit(self, unit)
        
        #mapper need to be reset
        self._mapper = createMapper( self._storage.asList(), self._mapper.__class__ )
        #!!! need to remove cache!!!
        self._cache = {}
        #also need to update centers if necssary
        if self._centers is not None:
            self._centers = N.array(self._centers) * (oldunit/self.unit())
        return