# Path: pynet/datasets/dataset.py
# class Dataset(object):
# 
#     def __init__(self, train_valid_test_ratio = [8,1,1],
#                 preprocessor=None, noise=None, batch_size=100, num_batches=None,
#                 iter_class='SequentialSubsetIterator', rng=None, log=None):
# 
#         '''
#         DESCRIPTION: Abstract class
#         PARAMS:
#             split_mode(sequential | random): sequentially or randomly split the dataset
#         '''
# 
#         assert len(train_valid_test_ratio) == 3, 'the size of list is not 3'
#         self.ratio = train_valid_test_ratio
#         self.preprocessor = preprocessor
#         self.noise = noise
#         self.iter_class = iter_class
#         self.batch_size = batch_size
#         self.num_batches = num_batches
#         self.rng = rng
# 
#         self.log = log
# 
#         if self.log is None:
#             # use default Log setting
#             self.log = Log(logger=internal_logger)
# 
#     def __iter__(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def next(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def nblocks(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def feature_size(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def target_size(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
# class DataBlocks(Dataset):
# 
#     def __init__(self, feature_size, target_size, data_paths, **kwargs):
# 
#         """
#         DESCRIPTION:
#             This is class for processing blocks of data, whereby dataset is loaded
#             and unloaded into memory one block at a time.
#         PARAM:
#             data_paths(list): contains the paths to the numpy data files. It's a
#                             list of tuples whereby the first element of the tuple
#                             is the X path, and the second is the y path.
#         """
#         super(DataBlocks, self).__init__(**kwargs)
#         self.featureSize = feature_size
#         self.targetSize = target_size
#         assert isinstance(data_paths, list), "data_paths is not a list"
#         self.data_paths = data_paths
#         self.single_block = SingleBlock(X=None, y=None, **kwargs)
# 
#     def __iter__(self):
#         self.files = iter(self.data_paths)
#         return self
# 
#     def next(self):
#         file = next(self.files)
# 
#         assert isinstance(file, tuple) or isintance(file, list), str(type(file)) + "is not a tuple or list"
#         with open(file[0], 'rb') as X_fin, open(file[1], 'rb') as y_fin:
#             data = np.load(X_fin)
#             X = data
#             y = np.load(y_fin)
# 
#         if self.preprocessor:
#             self.log.info('..applying preprocessing: ' + self.preprocessor.__class__.__name__)
#             data = self.preprocessor.apply(data)
#             X = data
# 
#         if self.noise:
#             self.log.info('..applying noise: ' + self.noise.__class__.__name__)
#             noisy_data = self.noise.apply(data)
#             X = noisy_data
# 
#         self.single_block.set_Xy(X=X, y=y)
#         return self.single_block
# 
# 
#     def nblocks(self):
#         return len(self.data_paths)
# 
#     def feature_size(self):
#         return self.featureSize
# 
#     def target_size(self):
#         return self.targetSize


import logging
import os
import numpy as np
import theano
import glob
from pynet.datasets.dataset import Dataset, DataBlocks
        self.dataset.valid = None
        self.dataset.test = None
        with open(self.data_dir + '/' + next(self.files), 'rb') as f:
            data = np.load(f)
        assert self.dataset.preprocessor is not None \
                and self.dataset.preprocessor.__class__.__name__ == 'GCN'
        logger.info('..applying preprocessing: ' + self.preprocessor.__class__.__name__)
        data = self.dataset.preprocessor.apply(data)
        normal = self.dataset.preprocessor.normalizers
        self.dataset.set_Xy(X=data, y=normal.reshape((normal.shape[0], 1)))
        data = None
        return self.dataset

    def nblocks(self):
        return len(self.parts)

class Laura_Warp_Blocks_GCN_Mapping(Laura_Blocks_GCN_Mapping):
    def __init__(self, feature_size, target_size, **kwargs):
        super(Laura_Warp_Blocks_GCN_Mapping, self).__init__(feature_size, target_size, **kwargs)
        self.parts = [ 'Laura_warp_data_000.npy',  'Laura_warp_data_010.npy',
                       'Laura_warp_data_001.npy',  'Laura_warp_data_011.npy',
                       'Laura_warp_data_002.npy',  'Laura_warp_data_012.npy',
                       'Laura_warp_data_003.npy',  'Laura_warp_data_013.npy',
                       'Laura_warp_data_004.npy',  'Laura_warp_data_014.npy',
                       'Laura_warp_data_005.npy',  'Laura_warp_data_015.npy',
                       'Laura_warp_data_006.npy',  'Laura_warp_data_016.npy',
                       'Laura_warp_data_007.npy',  'Laura_warp_data_017.npy',
                       'Laura_warp_data_008.npy',  'Laura_warp_data_018.npy',
                       'Laura_warp_data_009.npy',  'Laura_warp_data_019.npy']


# Path: pynet/datasets/dataset.py
# class Dataset(object):
# 
#     def __init__(self, train_valid_test_ratio = [8,1,1],
#                 preprocessor=None, noise=None, batch_size=100, num_batches=None,
#                 iter_class='SequentialSubsetIterator', rng=None, log=None):
# 
#         '''
#         DESCRIPTION: Abstract class
#         PARAMS:
#             split_mode(sequential | random): sequentially or randomly split the dataset
#         '''
# 
#         assert len(train_valid_test_ratio) == 3, 'the size of list is not 3'
#         self.ratio = train_valid_test_ratio
#         self.preprocessor = preprocessor
#         self.noise = noise
#         self.iter_class = iter_class
#         self.batch_size = batch_size
#         self.num_batches = num_batches
#         self.rng = rng
# 
#         self.log = log
# 
#         if self.log is None:
#             # use default Log setting
#             self.log = Log(logger=internal_logger)
# 
#     def __iter__(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def next(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def nblocks(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def feature_size(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
#     def target_size(self):
#         raise NotImplementedError(str(type(self))+" does not implement the __iter__ method.")
# 
# class DataBlocks(Dataset):
# 
#     def __init__(self, feature_size, target_size, data_paths, **kwargs):
# 
#         """
#         DESCRIPTION:
#             This is class for processing blocks of data, whereby dataset is loaded
#             and unloaded into memory one block at a time.
#         PARAM:
#             data_paths(list): contains the paths to the numpy data files. It's a
#                             list of tuples whereby the first element of the tuple
#                             is the X path, and the second is the y path.
#         """
#         super(DataBlocks, self).__init__(**kwargs)
#         self.featureSize = feature_size
#         self.targetSize = target_size
#         assert isinstance(data_paths, list), "data_paths is not a list"
#         self.data_paths = data_paths
#         self.single_block = SingleBlock(X=None, y=None, **kwargs)
# 
#     def __iter__(self):
#         self.files = iter(self.data_paths)
#         return self
# 
#     def next(self):
#         file = next(self.files)
# 
#         assert isinstance(file, tuple) or isintance(file, list), str(type(file)) + "is not a tuple or list"
#         with open(file[0], 'rb') as X_fin, open(file[1], 'rb') as y_fin:
#             data = np.load(X_fin)
#             X = data
#             y = np.load(y_fin)
# 
#         if self.preprocessor:
#             self.log.info('..applying preprocessing: ' + self.preprocessor.__class__.__name__)
#             data = self.preprocessor.apply(data)
#             X = data
# 
#         if self.noise:
#             self.log.info('..applying noise: ' + self.noise.__class__.__name__)
#             noisy_data = self.noise.apply(data)
#             X = noisy_data
# 
#         self.single_block.set_Xy(X=X, y=y)
#         return self.single_block
# 
# 
#     def nblocks(self):
#         return len(self.data_paths)
# 
#     def feature_size(self):
#         return self.featureSize
# 
#     def target_size(self):
#         return self.targetSize


# Path: pynet/datasets/mapping.py
import logging
import os
import numpy as np
import theano
import glob
from pynet.datasets.dataset import Dataset, DataBlocks

        self.dataset.valid = None
        self.dataset.test = None
        with open(self.data_dir + '/' + next(self.files), 'rb') as f:
            data = np.load(f)
        assert self.dataset.preprocessor is not None \
                and self.dataset.preprocessor.__class__.__name__ == 'GCN'
        logger.info('..applying preprocessing: ' + self.preprocessor.__class__.__name__)
        data = self.dataset.preprocessor.apply(data)
        normal = self.dataset.preprocessor.normalizers
        self.dataset.set_Xy(X=data, y=normal.reshape((normal.shape[0], 1)))
        data = None
        return self.dataset

    def nblocks(self):
        return len(self.parts)

class Laura_Warp_Blocks_GCN_Mapping(Laura_Blocks_GCN_Mapping):
    def __init__(self, feature_size, target_size, **kwargs):
        super(Laura_Warp_Blocks_GCN_Mapping, self).__init__(feature_size, target_size, **kwargs)
        self.parts = [ 'Laura_warp_data_000.npy',  'Laura_warp_data_010.npy',
                       'Laura_warp_data_001.npy',  'Laura_warp_data_011.npy',
                       'Laura_warp_data_002.npy',  'Laura_warp_data_012.npy',
                       'Laura_warp_data_003.npy',  'Laura_warp_data_013.npy',
                       'Laura_warp_data_004.npy',  'Laura_warp_data_014.npy',
                       'Laura_warp_data_005.npy',  'Laura_warp_data_015.npy',
                       'Laura_warp_data_006.npy',  'Laura_warp_data_016.npy',
                       'Laura_warp_data_007.npy',  'Laura_warp_data_017.npy',
                       'Laura_warp_data_008.npy',  'Laura_warp_data_018.npy',
                       'Laura_warp_data_009.npy',  'Laura_warp_data_019.npy']


        self.data_dir = os.environ['PYNET_DATA_PATH'] + '/Laura_warp_npy'