from os.path import dirname, abspath, join

import numpy as np
import pandas as pd

from blaze import resource

qty=10000
gauss = {'oneA': np.random.randn(qty),
         'oneB': np.random.randn(qty),
         'cats': np.random.randint(0,5,size=qty),
         'hundredA': np.random.randn(qty)*100,
         'hundredB': np.random.randn(qty)*100}
gauss = pd.DataFrame(gauss)

uniform = {'oneA': np.random.rand(qty),
           'oneB': np.random.rand(qty),
           'hundredA': np.random.rand(qty)*100,
           'hundredB': np.random.rand(qty)*100}
uniform = pd.DataFrame(uniform)
bivariate = {'A1': np.hstack([np.random.randn(qty/2), np.random.randn(qty/2)+1]),
             'A2': np.hstack([np.random.randn(qty/2), np.random.randn(qty/2)+2]),
             'A3': np.hstack([np.random.randn(qty/2), np.random.randn(qty/2)+3]),
             'A4': np.hstack([np.random.randn(qty/2), np.random.randn(qty/2)+4]),
             'A5': np.hstack([np.random.randn(qty/2), np.random.randn(qty/2)+5]),
             'B': np.random.randn(qty),
             'C': np.hstack([np.zeros(qty/2), np.ones(qty/2)])}
bivariate = pd.DataFrame(bivariate)
import bokeh.server.tests
path = join(dirname(bokeh.server.tests.__file__), 'data', 'AAPL.hdf5')
aapl = resource("hdfstore://%s::__data__" % path)

path = join(dirname(bokeh.server.tests.__file__), 'data', 'array.hdf5')
arr = resource(path + "::" + "array")

path = join(dirname(bokeh.server.tests.__file__), 'data', 'CensusTracts.hdf5')
census = resource("hdfstore://%s::__data__" % path)

data = dict(uniform=uniform,
            gauss=gauss,
            bivariate=bivariate,
            aapl=aapl,
            array=arr,
            census=census
)
