def selectZsecs(self, start=0, stop=None, pattern=[1], pickWhich=1): """ stores section indices to be picked up when doing copy region pattern: smallest pattern of elements eg. [1,1,0,2] pickWich: sections corresponding this number in the pattern is picked up """ if stop is None: stop = self.cropbox_u[0] if start is None: start = self.cropbox_l[0] unit = len(pattern) idx = N.arange(self.nz) repeat = N.ceil(self.nz / float(unit)) repPat = N.tile(pattern, repeat)[:self.nz] ids = N.compress(repPat == pickWhich, idx) self._zIdx = [i for i in ids if i >= start and i < stop] if not self._zIdx: self._zIdx = [0] print self._zIdx self.cropbox_l[0] = start self.cropbox_u[0] = stop if self.cropbox_l[0] == self.cropbox_u[0]: self.cropbox_u[0] += 1 self._zPtrn = pattern self._zPick = pickWhich
def selectTimes(self, start=None, stop=None, pattern=[1], pickWhich=1): """ stores section indices to be picked up when doing copy region pattern: smallest pattern of elements eg. [1,1,0,2] pickWich: sections corresponding this number in the pattern is picked up """ if stop is None: stop = self.nt if start is None: start = 0 unit = len(pattern) idx = N.arange(self.nt) repeat = N.ceil(self.nt / float(unit)) repPat = N.tile(pattern, repeat)[:len(idx)] ids = N.compress(repPat == pickWhich, idx) self._tIdx = [i for i in ids if i >= start and i < stop] self._tPtrn = pattern self._tPick = pickWhich