Read part of the binary file

        Args:
            size_chunk (int) : Size of the chunk to read
            start (int): Starting byte
            bytesize (int): Ending byte

        Returns:
            (np.array): array of the corresponding values
761323
def array(self, size_chunk, start, bytesize):
        ''' 
        '''

        with open(self.img, 'rb') as f1:
            f1.seek(self.start_byte + start * self.bytesize)
            data = f1.read(size_chunk * self.bytesize)
            Z = np.fromstring(data, dtype=self.dtype, count=size_chunk)
            if self.grid == 'LOLA':
                return Z * float(self.SCALING_FACTOR)
            else:
                return Z
779705
def split_size(size):
    ''''''
    rem = size % CHUNK_SIZE
    if rem == 0:
        cnt = size // CHUNK_SIZE
    else:
        cnt = size // CHUNK_SIZE + 1

    chunks = []
    for i in range(cnt):
        pos = i * CHUNK_SIZE
        if i == cnt - 1:
            disp = size - pos
        else:
            disp = CHUNK_SIZE
        chunks.append((pos, disp))
    return chunks
1029597
def read(self, size=None):
        
        if size is None:
            size = self.size - self.position
        else:
            size = min(size, self.size - self.position)

        buf = b""
        while size > 0:
            while True:
                data, start, stop, offset = self.map[self.map_index]
                if start <= self.position < stop:
                    break
                else:
                    self.map_index += 1
                    if self.map_index == len(self.map):
                        self.map_index = 0
            length = min(size, stop - self.position)
            if data:
                self.fileobj.seek(offset + (self.position - start))
                buf += self.fileobj.read(length)
            else:
                buf += NUL * length
            size -= length
            self.position += length
        return buf
420465
def load_chunk(filename, bounds, encoding='utf8', slow=False):
    
    if slow:
        return _load_chunk_slow(filename, bounds, encoding)

    with open(filename, 'rb') as f:
        f.seek(bounds.byte_start)
        size = bounds.byte_end - bounds.byte_start
        return f.read(size).decode(encoding)
551243
def _read(self, size):
        
        data = ''
        while len(data) < size:
            try:
                chunk = self.socket.recv(size-len(data))
            except socket.error as (err, msg):
                self.connected = False
                raise ScratchError("[Errno %d] %s" % (err, msg))
            if chunk == '':
                self.connected = False
                raise ScratchConnectionError("Connection broken")
            data += chunk
        return data
784233
async def iter_chunks(self, chunk_size=_DEFAULT_CHUNK_SIZE):
        
        while True:
            current_chunk = await self.read(chunk_size)
            if current_chunk == b"":
                break
            await yield_(current_chunk)
1017939
def read(self, size=None):
        
        if self.closed:
            raise ValueError("I/O operation on closed file")

        buf = b""
        if self.buffer:
            if size is None:
                buf = self.buffer
                self.buffer = b""
            else:
                buf = self.buffer[:size]
                self.buffer = self.buffer[size:]

        if size is None:
            buf += self.fileobj.read()
        else:
            buf += self.fileobj.read(size - len(buf))

        self.position += len(buf)
        return buf
1140249
def parseChunk(self, chunk, size, terminate):
        
        ret = libxml2mod.xmlParseChunk(self._o, chunk, size, terminate)
        return ret
3202
def chunk(self, size=0):
        

        if size == 0:
            raise ValueError('Invalid chunk size')

        self.__prepare()
        _new_content = []

        while(len(self._json_data) > 0):
            _new_content.append(self._json_data[0:size])
            self._json_data = self._json_data[size:]

        self._json_data = _new_content

        return self._json_data
916873
def read_bytes(self, length) -> bytes:
        
        value = self.stream.read(length)
        return value
929304
def read(self, size=1):
        
        if self.is_closed_flag:
            raise Exception("Unable to read - already closed!")
        if self.get_remaining_size() < size:
            raise Exception("Unable to read byte buffer - too short remaining data size!")
        self.read_count += size
        return self.file.read(size)
1213416
def chunklentype(self):
        

        x = self.file.read(8)
        if not x:
            return None
        if len(x) != 8:
            raise FormatError(
              'End of file whilst reading chunk length and type.')
        length,type = struct.unpack('!I4s', x)
        type = bytestostr(type)
        if length > 2**31-1:
            raise FormatError('Chunk %s is too large: %d.' % (type,length))
        return length,type
369213
def get_chunk(self):
        """"""
        while not self._eof_reached:
            read = self.input_stream.read(self.chunk_size - len(self._partial_chunk))
            if len(read) == 0:
                self._eof_reached = True
            self._partial_chunk += read
            if len(self._partial_chunk) == self.chunk_size or self._eof_reached:
                chunk = self._partial_chunk
                self._partial_chunk = ""
                return chunk
948117
def read(self, size = None):
        
        r = self._buffer
        self._buffer = b''
        if size is not None:
            size -= len(r)
        r = r + self._response.read(size)
        return r
343466
def read(self, bytes, offset):
        
        return Zchunk(lib.zfile_read(self._as_parameter_, bytes, offset), True)
795526
def read(self, b=-1):
        
        remaining_bytes = b
        data = io.BytesIO()
        while True:
            try:
                chunk = to_bytes(self.__wrapped__.read(remaining_bytes))
            except ValueError:
                if self.__wrapped__.closed:
                    break
                raise

            if not chunk:
                break

            data.write(chunk)
            remaining_bytes -= len(chunk)

            if remaining_bytes <= 0:
                break
        return data.getvalue()
364527
def get_chunks(source, chunk_len):
    
    return (source[i: i + chunk_len] for i in range(0, len(source), chunk_len))