def tasks_to_task_images(tasks, verbose=True, random=random, alphabets_dict=None):
    if alphabets_dict is None: alphabets_dict = get_accepted_image_list(from_path=FROM_PATH)
    return [{
             'completionImage': anonymize_image(alphabets_dict[alphabet][completion_uid][character_i], from_path=FROM_PATH, include_hash=False, include_original=False),
             'duplicationImage': anonymize_image(alphabets_dict[alphabet][duplication_uid][character_i], from_path=FROM_PATH, include_hash=False, include_original=False),
             'imageHalf': image_half
            }
            for alphabet, character_i, (completion_uid, duplication_uid), image_half in tasks]
示例#2
0
def tasks_to_task_images(tasks, verbose=True, random=random):
    alphabets_dict = get_accepted_image_list(from_path=FROM_PATH)
    return [{
             'anchors' :[anonymize_image(alphabets_dict[alphabet][uid][character_i], from_path=FROM_PATH, include_hash=False, include_original=False)
                         for alphabet, character_i, ids in [anchor] # kludge to unpack values from anchor
                         for uid in ids],
             'classes':[([anonymize_image(alphabets_dict[alphabet][uid][character_i], from_path=FROM_PATH, include_hash=False, include_original=False)],
                         are_same)
                        for character_class, are_same in classes
                        for alphabet, character_i, uid in [character_class]]
            }
            for anchor, classes in tasks]
示例#3
0
def create_first_task(form, args, reset=False, verbose=False):
    if "taskGroupIndex" in form.keys():
        task_group_index = int(form.getfirst("taskGroupIndex"))
    else:
        task_group_index = 0
    passOnValues = {
        "pauseToFirstHint": [500],
        "pauseToSecondHint": [500],
        "pauseToExample": [1000],
        "pauseToNoise": [50],
        "pauseToTest": [1000],
        "tasksPerFeedbackGroup": [10],
        "tasksPerWaitGroup": [10],
        "pauseToGroup": [-1],
        "displayProgressBarDuringTask": False,
        "allowDidNotSeeCount": [1],
        "random": False,
        "characterSet": None,
        "trialsPerExperiment": 200,
        "fractionSame": 0.5,  # this was 0.25 before the RT task, changed to 0.5 for RT
        "calibrationTaskCount": 25,
    }
    rtn = aggregate_values(passOnValues, args, form)

    if get_boolean_value(form, "random", default=passOnValues["random"]):
        tasks = make_get_random_task(form, passOnValues, verbose=verbose)
    else:
        tasks = get_a_task(task_group_index, reset=reset, verbose=verbose)
    alphabets = get_accepted_image_list(from_path=FROM_PATH)
    tasks = [
        (
            anonymize_image(alphabets[task[0][0]][task[0][2]][task[0][1]], from_path=FROM_PATH),
            anonymize_image(alphabets[task[1][0]][task[1][2]][task[1][1]], from_path=FROM_PATH),
            task[0][0] == task[1][0] and task[0][1] == task[1][1],
        )
        for task in tasks
    ]

    tasks = [
        (
            example,
            test,
            urllib.parse.urljoin(BASE_URL, random.choice(_STROKE_NOISES)),
            correct_answer,
        )  # http://www.quasimondo.com/hydra/sineNoise1.jpg')
        for example, test, correct_answer in tasks
    ]
    rtn["tasks"] = tasks
    return rtn
def tasks_to_task_images(tasks, verbose=True, random=random, alphabets_dict=None):
    if alphabets_dict is None: alphabets_dict = get_accepted_image_list(from_path=FROM_PATH)
    return [{
             'images': [anonymize_image(alphabets_dict[alphabet][uid][character_i], from_path=FROM_PATH, include_hash=False, include_original=False)
                        for alphabet, character_i, uid in task],
             'areSame': task[0][0] == task[1][0] and task[0][1] == task[1][1]
            }
            for task in tasks]
示例#5
0
def create_first_task(form, args, reset=False, verbose=False):
    if 'taskGroupIndex' in form.keys():
        task_group_index = int(form.getfirst('taskGroupIndex'))
    else:
        task_group_index = 0
    passOnValues = {
        'pauseToFirstHint': [500],
        'pauseToSecondHint': [500],
        'pauseToExample': [1000],
        'pauseToNoise': [50],
        'pauseToTest': [1000],
        'tasksPerFeedbackGroup': [10],
        'tasksPerWaitGroup': [10],
        'pauseToGroup': [-1],
        'displayProgressBarDuringTask': False,
        'allowDidNotSeeCount': [1],
        'random': False,
        'characterSet': None,
        'trialsPerExperiment': 200,
        'fractionSame':
        0.5,  # this was 0.25 before the RT task, changed to 0.5 for RT
        'calibrationTaskCount': 25
    }
    rtn = aggregate_values(passOnValues, args, form)

    if get_boolean_value(form, 'random', default=passOnValues['random']):
        tasks = make_get_random_task(form, passOnValues, verbose=verbose)
    else:
        tasks = get_a_task(task_group_index, reset=reset, verbose=verbose)
    alphabets = get_accepted_image_list(from_path=FROM_PATH)
    tasks = [(anonymize_image(alphabets[task[0][0]][task[0][2]][task[0][1]],
                              from_path=FROM_PATH),
              anonymize_image(alphabets[task[1][0]][task[1][2]][task[1][1]],
                              from_path=FROM_PATH), task[0][0] == task[1][0]
              and task[0][1] == task[1][1]) for task in tasks]

    tasks = [
        (example, test,
         urllib.parse.urljoin(BASE_URL, random.choice(_STROKE_NOISES)),
         correct_answer)  #http://www.quasimondo.com/hydra/sineNoise1.jpg')
        for example, test, correct_answer in tasks
    ]
    rtn['tasks'] = tasks
    return rtn
def tasks_to_task_images(tasks,
                         verbose=True,
                         random=random,
                         alphabets_dict=None):
    if alphabets_dict is None:
        alphabets_dict = get_accepted_image_list(from_path=FROM_PATH)
    return [{
        'completionImage':
        anonymize_image(alphabets_dict[alphabet][completion_uid][character_i],
                        from_path=FROM_PATH,
                        include_hash=False,
                        include_original=False),
        'duplicationImage':
        anonymize_image(alphabets_dict[alphabet][duplication_uid][character_i],
                        from_path=FROM_PATH,
                        include_hash=False,
                        include_original=False),
        'imageHalf':
        image_half
    } for alphabet, character_i, (completion_uid,
                                  duplication_uid), image_half in tasks]
def tasks_to_task_images(tasks,
                         verbose=True,
                         random=random,
                         alphabets_dict=None):
    if alphabets_dict is None:
        alphabets_dict = get_accepted_image_list(from_path=FROM_PATH)
    return [{
        'images': [[
            anonymize_image(alphabets_dict[alphabet][uid][character_i],
                            from_path=FROM_PATH,
                            include_hash=False,
                            include_original=False)
            for alphabet, character_i, uid in group
        ] for group in task]
    } for task in tasks]