This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib2 import PurePath | |
img_root = Path('AAT_images') | |
class AatImage(): | |
def __init__(curr_path): | |
""" | |
get list of image in current directory | |
curr_path: PosixPAth object parent dir of the images, starts with push* / pull* | |
""" | |
self.action = 'Push' if curr_path.name.count('Push') else 'Pull' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def gen_dict(a): | |
d = defaultdict(list) | |
# the score would be look like this [('image_name', response_time)...] | |
# Group the list by image_name and combine the score | |
for k,v in a: | |
d[k].append(v) | |
# Output: defaultdict(<type 'list'>, {'a': [1, 2, 3], 'c': [1, 2, 3], 'b': [1, 2, 3]}) | |
# >>> d['a'] | |
# [1, 2, 3] |