def test_ConvolveGaussian(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysis = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
    def test_getCOV(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysis = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
        covInfo = analysis.getCOV()

        data = libHrlAnalysisData.AnalysisData()
        self.assertTrue(data.fillCOV('../../test/data/CA1/CA1_cov.dat'))
        self.assertTrue(data.compareCOV(covInfo.cov))
    def test_serialize(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysisIn = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
        analysisIn.buildDataStructures()
        analysisIn.save("./ser.bin")

        analysisOut = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 0, 0, 0, libHrlAnalysis.vector_string())
        analysisOut.load("./ser.bin")

        spikes = analysisOut.getSpikeTimes()

        data = libHrlAnalysisData.AnalysisData()
        data.fillRasterData('../../test/data/CA1/CA1_raster.dat')

        self.assertTrue(data.compareRasterDataDim(spikes.time, 1))
        self.assertTrue(data.compareRasterDataDim(spikes.spikes, 2))
    def test_GetWindowRates(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysis = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
        rates = analysis.getWindowRate(10, 10)

        data = libHrlAnalysisData.AnalysisData()
        self.assertTrue(
            data.fillWindowRates('../../test/data/CA1/CA1_window_rates.dat'))

        self.assertTrue(data.compareWindowRates_double(rates.rates))
    def test_getRasterResult(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysis = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
        spikes = analysis.getSpikeTimes()

        data = libHrlAnalysisData.AnalysisData()
        data.fillRasterData('../../test/data/CA1/CA1_raster.dat')

        self.assertTrue(data.compareRasterDataDim(spikes.time, 1))
        self.assertTrue(data.compareRasterDataDim(spikes.spikes, 2))
    def test_GetRateBins(self):
        fileNames = libHrlAnalysis.vector_string()
        fileNames.append('../../test/data/CA1/spikes_0001.bin')
        fileNames.append('../../test/data/CA1/spikes_0002.bin')

        analysis = libHrlAnalysis.HrlNeuralAnalysisHRLSim(
            0, 4000, 26200, 28199, fileNames)
        rateBinInfo = analysis.getRateBins(100)

        data = libHrlAnalysisData.AnalysisData()
        self.assertTrue(
            data.fillSpikeBins('../../test/data/CA1/CA1_spike_bins.dat'))

        self.assertTrue(data.compareSpikeBinsAt(rateBinInfo.counts, 0))
        self.assertTrue(data.compareSpikeBinsAt(rateBinInfo.counts, 1))