Пример #1
0
    def test_read_line_mmap(self):
        f, metrics, iline_idx, xline_idx = self.read_small(True)

        tr0 = metrics['trace0']
        bsz = metrics['trace_bsize']
        samples = metrics['sample_count']
        xline_stride = metrics['xline_stride']
        iline_stride = metrics['iline_stride']
        offsets = metrics['offset_count']

        xline_trace0 = _segyio.fread_trace0(20, len(iline_idx), xline_stride,
                                            offsets, xline_idx, "crossline")
        iline_trace0 = _segyio.fread_trace0(1, len(xline_idx), iline_stride,
                                            offsets, iline_idx, "inline")

        buf = numpy.zeros((len(iline_idx), samples), dtype=numpy.single)

        _segyio.read_line(f, xline_trace0, len(iline_idx), xline_stride,
                          offsets, buf, tr0, bsz, 1, samples)
        self.assertAlmostEqual(sum(sum(buf)), 800.061169624, places=6)

        _segyio.read_line(f, iline_trace0, len(xline_idx), iline_stride,
                          offsets, buf, tr0, bsz, 1, samples)
        self.assertAlmostEqual(sum(sum(buf)), 305.061146736, places=6)

        _segyio.close(f)
Пример #2
0
 def _fread_line(self, trace0, length, stride, buf):
     return _segyio.read_line(self.xfd, trace0, length, stride, buf,
                              self._tr0, self._bsz, self._fmt, self.samples)
Пример #3
0
 def _fread_line(self, trace0, length, stride, buf):
     offsets = len(self.offsets)
     return _segyio.read_line(self.xfd, trace0, length, stride, offsets,
                              buf, self._tr0, self._bsz, self._fmt,
                              len(self.samples))