In [1]:
import numpy as np
np.random.seed(1)
import scipy.stats
import sys
import cProfile
%load_ext memory_profiler
# dev imports
sys.path.insert(0, '../src')
%reload_ext autoreload
%autoreload 1
%aimport anhima.sim
%aimport anhima.gt
In [2]:
genotypes = np.random.randint(-1, 3, size=(200000, 100, 2)).astype('i1')
genotypes.nbytes / 1e6
Out[2]:
In [3]:
packed = anhima.gt.pack_diploid(genotypes)
In [4]:
packed.nbytes / 1e6
Out[4]:
In [5]:
%timeit anhima.gt.pack_diploid(genotypes)
In [6]:
%memit anhima.gt.pack_diploid(genotypes)
In [7]:
unpacked = anhima.gt.unpack_diploid(packed)
In [8]:
unpacked.nbytes / 1e6
Out[8]:
In [9]:
%timeit anhima.gt.unpack_diploid(packed)
In [10]:
%memit anhima.gt.unpack_diploid(packed)
In [ ]: