Skip to content

Instantly share code, notes, and snippets.

@mgmarino
Created February 27, 2017 20:56
Show Gist options
  • Save mgmarino/cbf5078c922748de375e5855d17560ab to your computer and use it in GitHub Desktop.
Save mgmarino/cbf5078c922748de375e5855d17560ab to your computer and use it in GitHub Desktop.
# coding: utf-8
# In[1]:
import numpy
import itertools
import h5py
# make an array with a lot of stuff
length_of_array = 800
total_other_numbers = int(45000000/length_of_array)
total_other_numbers = int(4500000/length_of_array)
# In[2]:
rnd = numpy.random.normal
arr = numpy.array
generator = lambda i: map(lambda x: [i, rnd()], range(length_of_array))
x = arr([i for i in itertools.chain(*map(generator, range(total_other_numbers)))])
# In[3]:
hids = x[:,0]
transitions = numpy.nonzero(hids[1:] - hids[:-1])[0]
# In[8]:
anobj = {}
i = 0
for idx in transitions:
anobj[str(int(x[i][0]))] = x[:,1][i:idx+1]
i = idx+1
# In[10]:
import hickle
with open('test1.hkl', 'w') as hf:
hickle.dump(anobj, hf)
# In[ ]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment