# Path: pyglm/components/component.py
# class Component(object):
#     """
#     """
#     
#     def __init__(self, model):
#         """ Initialize the component with the parameters from the given model.
#         """
#         pass
#     
#     def get_variables(self):
#         """ Get a dictionary of (name : Theano variable) items for all the
#             symbolic variables associated with this component.
#         """
#         return {}
#     
#     def get_state(self):
#         return {}
# 
#     def preprocess_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
# 
#     def set_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
#     
#     def set_hyperparameters(self, model):
#         """ Set hyperparameters of the model
#         """
#         pass
# 
#     def sample(self, acc):
#         """
#         return a sample of the variables
#                 """
#         return {}


import sys
import hashlib
import cPickle
import theano
import theano.tensor as T
from os.path import expanduser
from pyglm.components.component import Component
from pyglm.utils.basis import *
                                   data['stim'][:, d])

        # Project the stimulus onto the basis
        cstim = convolve_with_basis(stim, self.ibasis.get_value())

        # Flatten this manually (there's surely a way to do this with numpy)
        (nT,D,B) = cstim.shape 
        fstim = np.empty((nT,D*B))
        for d in np.arange(D):
            for b in np.arange(B):
                fstim[:,d*B+b] = cstim[:,d,b]

        data['fstim'] = fstim

    def set_data(self, data):
        self.stim.set_value(data['fstim'])

    def set_hyperparameters(self, model):
        """ Set hyperparameters of the model
        """
        pass

    def sample(self, acc):
        """
        return a sample of the variables
                """
        smpl = {str(self.w_stim) : 0.01*np.random.randn(self.n_vars)}
        return smpl



# Path: pyglm/components/component.py
# class Component(object):
#     """
#     """
#     
#     def __init__(self, model):
#         """ Initialize the component with the parameters from the given model.
#         """
#         pass
#     
#     def get_variables(self):
#         """ Get a dictionary of (name : Theano variable) items for all the
#             symbolic variables associated with this component.
#         """
#         return {}
#     
#     def get_state(self):
#         return {}
# 
#     def preprocess_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
# 
#     def set_data(self, data):
#         """ Set the shared memory variables that depend on the data
#         """
#         pass
#     
#     def set_hyperparameters(self, model):
#         """ Set hyperparameters of the model
#         """
#         pass
# 
#     def sample(self, acc):
#         """
#         return a sample of the variables
#                 """
#         return {}


# Path: pyglm/components/bkgd.py
import sys
import hashlib
import cPickle
import theano
import theano.tensor as T
from os.path import expanduser
from pyglm.components.component import Component
from pyglm.utils.basis import *

                                   data['stim'][:, d])

        # Project the stimulus onto the basis
        cstim = convolve_with_basis(stim, self.ibasis.get_value())

        # Flatten this manually (there's surely a way to do this with numpy)
        (nT,D,B) = cstim.shape 
        fstim = np.empty((nT,D*B))
        for d in np.arange(D):
            for b in np.arange(B):
                fstim[:,d*B+b] = cstim[:,d,b]

        data['fstim'] = fstim

    def set_data(self, data):
        self.stim.set_value(data['fstim'])

    def set_hyperparameters(self, model):
        """ Set hyperparameters of the model
        """
        pass

    def sample(self, acc):
        """
        return a sample of the variables
                """
        smpl = {str(self.w_stim) : 0.01*np.random.randn(self.n_vars)}
        return smpl



class SpatiotemporalStimulus(Component):