Beispiel #1
0
 def get_images(self):
     l_files = []
     l_dir = os.path.join(settings.module_abs_path(), 'images')
     for i_file in os.listdir(l_dir):
         if i_file.endswith('bmp'):
             l_files.append(os.path.join(l_dir, i_file))
     return l_files
Beispiel #2
0
 def get_images(self):
     l_files = []
     l_dir = os.path.join(settings.module_abs_path(), 'images')
     for i_file in os.listdir(l_dir):
         if i_file.endswith('bmp'):
              l_files.append(os.path.join(l_dir, i_file))
     return l_files
    def __init__(self, p_config_name=None):
        super(Experiment_manager, self).__init__()
        self.config_file = self.read_experiment_config(p_config_name)
        print self.config_file
        self.screens = self.config_file['screens']
        self.sc_configs = []
        self.repeats = self.config_file['repeats']
        self.readable_names = self.config_file['readable_names']
        self.programme = self.config_file['file_to_run'] 

        # set up screens configuration - pair screens with diode freqs
        if not self.config_file.get('USE_DEFAULT_FREQS'):
            self.freq_sets = self.config_file['freqs']
	    print "UWAGA"
	    print ""
	    print ""
	    print self.screens
	    print len(self.screens)
	    print self.freq_sets
	    print len(self.freq_sets)
            assert(len(self.screens) == len(self.freq_sets))
            self.sc_configs = [zip(scr, fre) for scr, fre in zip(self.screens,
                self.freq_sets)]
        else:
            def_freqs = self.config_file['DEFAULT_FREQS']
            assert(def_freqs != None)
            self.sc_configs = [zip(scr, def_freqs) for scr in self.screens]

        LOGGER.info("screens and freqs: \n" + \
                str(self.sc_configs))

        self._prepare_screens(self.sc_configs)

        LOGGER.debug("SHUFFLED screens and freqs: \n" + \
                str(self.sc_configs))

        self._delay = self.config_file['delay']
        self._last_delay = None
        try:
            self._delay + 0
            # No error, delay is not random, just a number
            self._rand_delay = False
        except TypeError:
            self._rand_delay = True

        self.config_manager = UgmConfigManager()
        self._connection = None
        self._screen_sounds = self.config_file.get('sounds', None)
        self._screen_look_num = 0
        if self._screen_sounds:
            import pygame
            import settings
            pygame.init()
            for i, s in enumerate(self._screen_sounds):
                self._screen_sounds[i] = os.path.join(
                    settings.module_abs_path(), 
                    self._screen_sounds[i])
Beispiel #4
0
    def __init__(self, addresses):
        super(Filter, self).__init__(addresses=addresses, type=peers.FILTER)
        montage_path = ''.join([settings.module_abs_path(), "montage.list"])
        print(montage_path)
        #channels_path = "channels.list"
        lines = file(montage_path).readlines()
	print lines
        # chann = file(channels.path).readline() 
	
        self.macierz = array([[float(x) for x in line.strip(" \n").split(" ")] for line in lines])
Beispiel #5
0
    def __init__(self, addresses):
        super(Filter, self).__init__(addresses=addresses, type=peers.FILTER)
        montage_path = ''.join([settings.module_abs_path(), "montage.list"])
        print(montage_path)
        #channels_path = "channels.list"
        lines = file(montage_path).readlines()
        print lines
        # chann = file(channels.path).readline()

        self.macierz = array([[float(x) for x in line.strip(" \n").split(" ")]
                              for line in lines])
Beispiel #6
0
    def get_words(self):
        l_groups = []
        l_csv_file = os.path.join(settings.module_abs_path(), 'words')
        l_csv_file = os.path.join(l_csv_file, 'words.csv')
        l_csv_reader = csv_manager.Reader(l_csv_file)
        for i_row in l_csv_reader:
            print(i_row)
            if len(i_row[0]) == 0:
                #end of group
                l_groups.append(l_group)
            elif i_row[0] == 'grupa':
                #new group
                l_group = []
            else:
                l_group.append(i_row)
        l_csv_reader.close()
        random.shuffle(l_groups)

        l_words = []
        for i_group in l_groups:
            l_words = l_words + i_group
        return l_words
Beispiel #7
0
 def get_words(self):
     l_groups = []
     l_csv_file = os.path.join(settings.module_abs_path(), 'words')
     l_csv_file = os.path.join(l_csv_file, 'words.csv')
     l_csv_reader = csv_manager.Reader(l_csv_file)
     for i_row in l_csv_reader:
         print(i_row)
         if len(i_row[0]) == 0:
             #end of group
             l_groups.append(l_group)
         elif i_row[0] == 'grupa':
             #new group
             l_group = []
         else:
             l_group.append(i_row)
     l_csv_reader.close()
     random.shuffle(l_groups)
     
     l_words = []
     for i_group in l_groups:
         l_words = l_words + i_group
     return l_words
Beispiel #8
0
    def __init__(self, p_config_name=None):
        super(Experiment_manager, self).__init__()
        self.config_file = self.read_experiment_config(p_config_name)
        print self.config_file
        self.screens = self.config_file['screens']
        self.sc_configs = []
        self.repeats = self.config_file['repeats']
        self.readable_names = self.config_file['readable_names']
        self.programme = self.config_file['file_to_run']

        # set up screens configuration - pair screens with diode freqs
        if not self.config_file.get('USE_DEFAULT_FREQS'):
            self.freq_sets = self.config_file['freqs']
            print "UWAGA"
            print ""
            print ""
            print self.screens
            print len(self.screens)
            print self.freq_sets
            print len(self.freq_sets)
            assert (len(self.screens) == len(self.freq_sets))
            self.sc_configs = [
                zip(scr, fre) for scr, fre in zip(self.screens, self.freq_sets)
            ]
        else:
            def_freqs = self.config_file['DEFAULT_FREQS']
            assert (def_freqs != None)
            self.sc_configs = [zip(scr, def_freqs) for scr in self.screens]

        LOGGER.info("screens and freqs: \n" + \
                str(self.sc_configs))

        self._prepare_screens(self.sc_configs)

        LOGGER.debug("SHUFFLED screens and freqs: \n" + \
                str(self.sc_configs))

        self._delay = self.config_file['delay']
        self._last_delay = None
        try:
            self._delay + 0
            # No error, delay is not random, just a number
            self._rand_delay = False
        except TypeError:
            self._rand_delay = True

        self.config_manager = UgmConfigManager()
        self._connection = None
        self._screen_sounds = self.config_file.get('sounds', None)
        self._field_look_nums = self.config_file.get('field_look_nums', None)

        if self._field_look_nums != None:
            self._sc_look_index = 0
        else:
            self._screen_look_num = 0

        if self._screen_sounds:
            import pygame
            import settings
            pygame.init()
            for i, s in enumerate(self._screen_sounds):
                self._screen_sounds[i] = os.path.join(
                    settings.module_abs_path(), self._screen_sounds[i])