def getScreenMeasurements(dpath, et_model, et_model_display_configs): """ :param dpath: :param et_model: :param et_model_display_configs: :return: """ # et_model, _ = getInfoFromPath(dpath) display_param = et_model_display_configs.get(et_model) if display_param is None: et_config_path = glob.glob('./configs/*%s.yaml' % (et_model)) if et_config_path: et_config_path = nabs(et_config_path[0]) display_config = load(file(et_config_path, 'r'), Loader=Loader) dev_list = display_config.get('monitor_devices') for d in dev_list: if d.keys()[0] == 'Display': d = d['Display'] width = d.get('physical_dimensions', {}).get('width') height = d.get('physical_dimensions', {}).get('height') eye_dist = d.get('default_eye_distance', {}).get( 'surface_center') et_model_display_configs[et_model] = OrderedDict() et_model_display_configs[et_model][ screen_measure_fields[0]] = width et_model_display_configs[et_model][ screen_measure_fields[1]] = height et_model_display_configs[et_model][ screen_measure_fields[2]] = eye_dist return et_model_display_configs[et_model] return display_param
def getGeometry(data): return np.mean((1/(np.degrees(2*np.arctan(data['screen_width']/(2*data['eye_distance'])))/data['display_width_pix']), 1/(np.degrees(2*np.arctan(data['screen_height']/(2*data['eye_distance'])))/data['display_height_pix']))) if not os.path.exists(OUTPUT_DIR): os.mkdir(OUTPUT_DIR) OUTPUT_DIR = getFullOutputFolderPath(OUTPUT_DIR) if not os.path.exists(OUTPUT_DIR): os.mkdir(OUTPUT_DIR) print 'OUTPUT_FOLDER:', OUTPUT_DIR DATA_FILES = [nabs(fpath) for fpath in glob.glob(GLOB_PATH_PATTERN) if analyseit(fpath, INCLUDE_SUB, INCLUDE_TRACKERS)] stim_all = [] if __name__ == '__main__': for file_path in DATA_FILES: file_log = open(OUTPUT_DIR + '/win_select.log', 'a') try: # if 1: t1 = time.time() DATA = np.load(file_path) et_model, sub = getInfoFromPath(file_path) #Removes every second sample for LC Tech EyeFollower #TODO: come up with a better alternative
'min_cal_points': 8, 'win_select_func': 'roll', 'win_size': 0.175, 'win_type': 'sample', 'window_skip': 0.2, 'wsa': 'fiona' , 'units': 'gaze', }] if not os.path.exists(OUTPUT_FOLDER): os.mkdir(OUTPUT_FOLDER) OUTPUT_FOLDER = getFullOutputFolderPath(OUTPUT_FOLDER) print 'OUTPUT_FOLDER:', OUTPUT_FOLDER DATA_FILES = [nabs(fpath) for fpath in glob.glob(GLOB_PATH_PATTERN) if analyseit(fpath)] #Check for dublicates sub_dict = dict() for et_model in INCLUDE_TRACKERS: sub_dict[et_model] = [] for file_path in DATA_FILES: et, sub = getInfoFromPath(file_path) if et==et_model: sub_dict[et_model].append(sub) if len(sub_dict[et_model]) != len(np.unique(sub_dict[et_model])): unique_ids, unique_counts = np.unique(sub_dict[et_model], return_counts=True) print 'Dublicate subject ids in %s:'%et_model, \ unique_ids[np.argwhere(unique_counts > 1).flatten()]