I have a memmap to a very large (10-100 GB) file containing current and voltage data. From a given starting index, I want to find the index of the next point for which the voltage satisfies a given condition.
In the case of a relatively small list I could do this with an iterator like so:
filename = '[redacted]'
columntypes = np.dtype([('current', '>f8'), ('voltage', '>f8')])
data = np.memmap(filename, dtype=columntypes)
current = data['current']
voltage = data['voltage']
condition = (i for i,v in enumerate(voltage) if voltage > 0.1)
print next(condition)
but because my memmap is so large, it can't build the iterator. Is there a way to do this in a pythonic way without actually loading the data into memory? I can always take the ugly approach of reading in chunks of data and looping through it until I find the index I need, but this seems inelegant.