Esempio n. 1
0
 def test_TrialHandlerAndXLSX(self):
     """Currently tests the contents of xslx file against known good example
     """
     conds = data.importConditions(
         os.path.join(fixturesPath, 'trialTypes.xlsx'))
     trials = data.TrialHandler(trialList=conds,
                                seed=100,
                                nReps=2,
                                autoLog=False)
     responses = [1, 1, None, 3, 2, 3, 1, 3, 2, 2, 1, 1]
     rts = [0.1, 0.1, None, 0.3, 0.2, 0.3, 0.1, 0.3, 0.2, 0.2, 0.1, 0.1]
     for trialN, trial in enumerate(trials):
         if responses[trialN] is None:
             continue
         trials.addData('resp', responses[trialN])
         trials.addData('rt', rts[trialN])
     trials.saveAsExcel(
         self.name
     )  # '.xlsx' should be added automatically to make fullName
     trials.saveAsText(
         self.name, delim=','
     )  # '.xlsx' should be added automatically to make fullName
     trials.saveAsWideText(os.path.join(self.temp_dir, 'actualXlsx'))
     # Make sure the file is there
     assert os.path.isfile(self.fullName)
     #compare with known good file
     utils.compareXlsxFiles(self.fullName,
                            os.path.join(fixturesPath, 'corrXlsx.xlsx'))
Esempio n. 2
0
    def test_TrialHandlerAndXLSX(self):
        """Currently tests the contents of xslx file against known good example
        """
        conds = data.importConditions(os.path.join(fixturesPath,
                                                   'trialTypes.xlsx'))
        trials = data.TrialHandler(trialList=conds,
                                   seed=self.random_seed,
                                   nReps=2, autoLog=False)

        responses = [1,1,None,3,2,3, 1,3,2,2,1,1]
        rts = [0.1,0.1,None,0.3,0.2,0.3, 0.1,0.3,0.2,0.2,0.1,0.1]

        for trialN, trial in enumerate(trials):
            if responses[trialN] is None:
                continue
            trials.addData('resp', responses[trialN])
            trials.addData('rt',rts[trialN])

        trials.saveAsExcel(self.name)# '.xlsx' should be added automatically
        trials.saveAsText(self.name, delim=',')# '.xlsx' added automatically
        trials.saveAsWideText(os.path.join(self.temp_dir,'actualXlsx'))
        # Make sure the file is there
        assert os.path.isfile(self.fullName)
        #compare with known good file
        utils.compareXlsxFiles(self.fullName,
                               os.path.join(fixturesPath,'corrXlsx.xlsx'))
Esempio n. 3
0
 def test_multiKeyResponses(self):
     dat = fromFile(os.path.join(fixturesPath,'multiKeypressTrialhandler.psydat'))
     #test csv output
     dat.saveAsText(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), appendFile=False)
     utils.compareTextFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), pjoin(fixturesPath,'corrMultiKeyTrials.csv'))
     #test xlsx output
     dat.saveAsExcel(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), appendFile=False)
     utils.compareXlsxFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), pjoin(fixturesPath,'corrMultiKeyTrials.xlsx'))
Esempio n. 4
0
    def test_multiKeyResponses(self):
        pytest.skip()  # temporarily; this test passed locally but not under travis, maybe PsychoPy version of the .psyexp??

        dat = fromFile(os.path.join(fixturesPath,'multiKeypressTrialhandler.psydat'))
        #test csv output
        dat.saveAsText(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), appendFile=False)
        utils.compareTextFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), pjoin(fixturesPath,'corrMultiKeyTrials.csv'))
        #test xlsx output
        dat.saveAsExcel(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), appendFile=False)
        utils.compareXlsxFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), pjoin(fixturesPath,'corrMultiKeyTrials.xlsx'))
Esempio n. 5
0
    def test_multiKeyResponses(self):
        pytest.skip()  # temporarily; this test passed locally but not under travis, maybe PsychoPy version of the .psyexp??

        dat = fromFile(os.path.join(fixturesPath,'multiKeypressTrialhandler.psydat'))
        #test csv output
        dat.saveAsText(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), appendFile=False)
        utils.compareTextFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'), pjoin(fixturesPath,'corrMultiKeyTrials.csv'))
        #test xlsx output
        dat.saveAsExcel(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), appendFile=False)
        utils.compareXlsxFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'), pjoin(fixturesPath,'corrMultiKeyTrials.xlsx'))
 def test_multiKeyResponses(self):
     dat = misc.fromFile(
         os.path.join(fixturesPath, 'multiKeypressTrialhandler.psydat'))
     #test csv output
     dat.saveAsText(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'),
                    appendFile=False)
     utils.compareTextFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.csv'),
                            pjoin(fixturesPath, 'corrMultiKeyTrials.csv'))
     #test xlsx output
     dat.saveAsExcel(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'),
                     appendFile=False)
     utils.compareXlsxFiles(pjoin(self.temp_dir, 'testMultiKeyTrials.xlsx'),
                            pjoin(fixturesPath, 'corrMultiKeyTrials.xlsx'))