예제 #1
0
    def test_trigger_durations(self):
        """Test trigger durations"""

        parameters = Parameters.from_cast_values(time_target=1.0,
                                                 time_cross=0.5,
                                                 time_flash=0.2)
        durations = trigger_durations(parameters)

        self.assertEqual(durations['calib'], 0.0)
        self.assertEqual(durations['first_pres_target'], 1.0)
        self.assertEqual(durations['fixation'], 0.5)
        self.assertEqual(durations['nontarget'], 0.2)
        self.assertEqual(durations['target'], 0.2)
예제 #2
0
    def setUp(self):
        """Override; set up the needed path for load functions."""

        self.temp_dir = tempfile.mkdtemp()

        with open(Path(self.temp_dir, 'triggers.txt'), 'w') as trg_file:
            trg_file.write(self.__class__.trg_data)

        with open(Path(self.temp_dir, 'raw_data.csv'), 'w') as data_file:
            data_file.write(self.__class__.sample_data)

        params = Parameters.from_cast_values(raw_data_name='raw_data.csv',
                                             trigger_file_name='triggers.txt')
        params.save(self.temp_dir, 'parameters.json')
예제 #3
0
    def test_alternate_constructor(self):
        """Test alternate constructor from cast values"""
        parameters = Parameters.from_cast_values(myint=1,
                                                 mybool=True,
                                                 mystr="Testing")
        self.assertTrue(parameters.cast_values)
        self.assertEqual(parameters['myint'], 1)
        self.assertEqual(parameters['mybool'], True)
        self.assertEqual(parameters['mystr'], 'Testing')

        parameters.cast_values = False
        self.assertEqual(parameters['myint']['value'], '1')
        self.assertEqual(parameters['mybool']['value'], 'true')
        self.assertEqual(parameters['mystr']['value'], 'Testing')