Exemplo n.º 1
0
 def gen():
     buf1, buf2 = self._header_buffer(), self._header_buffer()
     start = t0
     step = stride * len(self.segy.offsets)
     stop = t0 + (length * step)
     for i in range(start, stop, step):
         x = Field.trace(buf1, traceno=i, segy=self.segy)
         buf2, buf1 = buf1, buf2
         yield x
Exemplo n.º 2
0
    def __getitem__(self, traceno, buf=None):
        if isinstance(traceno, tuple):
            return self.__getitem__(traceno[0], traceno[1])

        if isinstance(traceno, slice):
            gen_buf = self._header_buffer(buf)

            def gen():
                for i in xrange(*traceno.indices(self.segy.tracecount)):
                    yield self.__getitem__(i, gen_buf)

            return gen()

        return Field.trace(buf, traceno=traceno, segy=self.segy)
Exemplo n.º 3
0
    def __getitem__(self, traceno, buf=None):
        if isinstance(traceno, tuple):
            return self.__getitem__(traceno[0], traceno[1])

        buf = self._header_buffer(buf)

        if isinstance(traceno, slice):
            def gen():
                buf1, buf2 = self._header_buffer(), self._header_buffer()
                for i in range(*traceno.indices(self.segy.tracecount)):
                    x = self.__getitem__(i, buf1)
                    buf2, buf1 = buf1, buf2
                    yield x

            return gen()

        return Field.trace(buf, traceno=traceno, segy=self.segy)
Exemplo n.º 4
0
 def gen():
     start = t0
     stop = t0 + (length * stride)
     for i in xrange(start, stop, stride):
         yield Field.trace(buf, traceno=i, segy=self.segy)