I want to read in a random chunk from a large binary data file in Python and so far I have not found a good solution to my problem.
What I have so far is the following, but it only can read in the first n integers and cannot start somewhere else in the file.
import numpy as np
#Pick an n here.
f = open("test2.rd14")
a = np.fromfile(f, dtype = np.uint16, count=int(n))
with open("test2.rd14") as file:
filecontent = file.read()
It's all in the docs.
Open it in binary mode
f = open("test2.rd14", "rb")
and then you want to use the seek method,
to start elsewhere.