# Path: pyrl/tasktools.py
# def generate_ei(N, pE=0.8):
# def to_map(*args):
# def get_idx(t, (start, end)):
# def get_epochs_idx(dt, epochs):
# def choice(rng, a):
# def unravel_index(i, dims):
# def uniform(rng, dt, xmin, xmax):
# def truncated_exponential(rng, dt, mean, xmin=0, xmax=np.inf):
# def divide(x, y):
# def correct_2AFC(perf):
#     def __init__(self):
#     EXC = idx[:Nexc]
#     INH = idx[Nexc:]
# class Task(object):


import numpy as np
from pyrl import tasktools
def scale(x):
    return x/5

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:

# Path: pyrl/tasktools.py
# def generate_ei(N, pE=0.8):
# def to_map(*args):
# def get_idx(t, (start, end)):
# def get_epochs_idx(dt, epochs):
# def choice(rng, a):
# def unravel_index(i, dims):
# def uniform(rng, dt, xmin, xmax):
# def truncated_exponential(rng, dt, mean, xmin=0, xmax=np.inf):
# def divide(x, y):
# def correct_2AFC(perf):
#     def __init__(self):
#     EXC = idx[:Nexc]
#     INH = idx[Nexc:]
# class Task(object):


# Path: examples/models/padoaschioppa2006.py
import numpy as np
from pyrl import tasktools

def scale(x):
    return x/5

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)