sigproc.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:bifrost 作者: ledatelescope 项目源码 文件源码
def read_data(self, start=None, end=None):
        """read data from file and store it locally"""
        nframe = self._find_nframe_from_file()
        seek_to_data(self.file_object)
        read_start = 0
        end_read = nframe * self.nifs * self.nchans
        if start is not None:
            if start < 0:
                read_start = (nframe + start) * self.nifs * self.nchans
            elif start >= 0:
                read_start = start * self.nifs * self.nchans
        if end is not None:
            if end < 0:
                end_read = (nframe + end) * self.nifs * self.nchans
            elif end >= 0:
                end_read = end * self.nifs * self.nchans
        self.file_object.seek(read_start, os.SEEK_CUR)
        nbytes_to_read = end_read - read_start
        data = np.fromfile(self.file_object, count=nbytes_to_read, dtype=self.dtype)
        nframe = data.size // self.nifs // self.nchans
        data = data.reshape((nframe, self.nifs, self.nchans))
        if self.nbits < 8:
            data = unpack(data, self.nbits)
        self.data = data
        return self.data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号