Exemple #1
0
def get_condition(rng, dt, context={}):
    #-------------------------------------------------------------------------------------
    # Epochs
    #-------------------------------------------------------------------------------------

    delay = context.get('delay')
    if delay is None:
        delay = tasktools.uniform(rng, dt, delay_min, delay_max)

    durations = {
        'fixation':   (0, fixation),
        'f1':         (fixation, fixation + f1),
        'delay':      (fixation + f1, fixation + f1 + delay),
        'f2':         (fixation + f1 + delay, fixation + f1 + delay + f2),
        'decision':   (fixation + f1 + delay + f2, tmax),
        'tmax':       tmax
        }
    time, epochs = tasktools.get_epochs_idx(dt, durations)

    gt_lt = context.get('gt_lt')
    if gt_lt is None:
        gt_lt = tasktools.choice(rng, gt_lts)

    fpair = context.get('fpair')
    if fpair is None:
        fpair = tasktools.choice(rng, fpairs)

    return {
        'durations': durations,
        'time':      time,
        'epochs':    epochs,
        'gt_lt':     gt_lt,
        'fpair':     fpair
        }
Exemple #2
0
def get_condition(rng, dt, context={}):
    #-------------------------------------------------------------------------------------
    # Epochs
    #-------------------------------------------------------------------------------------

    delay = context.get('delay')
    if delay is None:
        delay = tasktools.uniform(rng, dt, delay_min, delay_max)

    durations = {
        'fixation': (0, fixation),
        'f1': (fixation, fixation + f1),
        'delay': (fixation + f1, fixation + f1 + delay),
        'f2': (fixation + f1 + delay, fixation + f1 + delay + f2),
        'decision': (fixation + f1 + delay + f2, tmax),
        'tmax': tmax
    }
    time, epochs = tasktools.get_epochs_idx(dt, durations)

    gt_lt = context.get('gt_lt')
    if gt_lt is None:
        gt_lt = tasktools.choice(rng, gt_lts)

    fpair = context.get('fpair')
    if fpair is None:
        fpair = tasktools.choice(rng, fpairs)

    return {
        'durations': durations,
        'time': time,
        'epochs': epochs,
        'gt_lt': gt_lt,
        'fpair': fpair
    }
def get_condition(rng, dt, context={}):
    #-------------------------------------------------------------------------------------
    # Epochs
    #-------------------------------------------------------------------------------------

    offer_on = context.get('offer-on')
    if offer_on is None:
        offer_on = tasktools.uniform(rng, dt, offer_on_min, offer_on_max)

    durations = {
        'fixation':    (0, fixation),
        'offer-on':    (fixation, fixation + offer_on),
        'decision':    (fixation + offer_on, tmax),
        'tmax':        tmax
        }
    time, epochs = tasktools.get_epochs_idx(dt, durations)

    #-------------------------------------------------------------------------------------
    # Trial
    #-------------------------------------------------------------------------------------

    juice = context.get('juice')
    if juice is None:
        juice = tasktools.choice(rng, juices)

    offer = context.get('offer')
    if offer is None:
        offer = tasktools.choice(rng, offers)

    juiceL, juiceR = juice
    nB, nA = offer

    if juiceL == 'A':
        nL, nR = nA, nB
    else:
        nL, nR = nB, nA

    return {
        'durations': durations,
        'time':      time,
        'epochs':    epochs,
        'juice':     juice,
        'offer':     offer,
        'nL':        nL,
        'nR':        nR
        }
Exemple #4
0
def get_condition(rng, dt, context={}):
    #-------------------------------------------------------------------------------------
    # Epochs
    #-------------------------------------------------------------------------------------

    offer_on = context.get('offer-on')
    if offer_on is None:
        offer_on = tasktools.uniform(rng, dt, offer_on_min, offer_on_max)

    durations = {
        'fixation':    (0, fixation),
        'offer-on':    (fixation, fixation + offer_on),
        'decision':    (fixation + offer_on, tmax),
        'tmax':        tmax
        }
    time, epochs = tasktools.get_epochs_idx(dt, durations)

    #-------------------------------------------------------------------------------------
    # Trial
    #-------------------------------------------------------------------------------------

    juice = context.get('juice')
    if juice is None:
        juice = tasktools.choice(rng, juices)

    offer = context.get('offer')
    if offer is None:
        offer = tasktools.choice(rng, offers)

    juiceL, juiceR = juice
    nB, nA = offer

    if juiceL == 'A':
        nL, nR = nA, nB
    else:
        nL, nR = nB, nA

    return {
        'durations': durations,
        'time':      time,
        'epochs':    epochs,
        'juice':     juice,
        'offer':     offer,
        'nL':        nL,
        'nR':        nR
        }