Esempio n. 1
0
def cohort(data_dir, mouse_id):
    c = Cohort.init_from_files(data_dir, [mouse_id])
    yield c
Esempio n. 2
0
    trials["reaction_time"] = trials.end - trials.start
    trials.loc[trials["outcome"] == Outcomes.MISSED, "reaction_time"] = np.nan
    trials.loc[trials["outcome"] == Outcomes.CANCELLED,
               "reaction_time"] = np.nan

    sns.stripplot(
        data=trials,
        x='day',
        y='reaction_time',
        hue='mouse_id',
        dodge=True,
    )

    plt.show()


if __name__ == '__main__':
    mouse_ids = []
    for i in sys.argv[2:]:
        mouse_ids.append(i)
    if not mouse_ids:
        raise SystemError(
            f'Usage: {__file__} /path/to/json/folder mouse1 mouse2')

    cohort = Cohort.init_from_files(
        data_dir=sys.argv[1],
        mouse_ids=mouse_ids,
    )

    main(cohort)
Esempio n. 3
0
import seaborn as sns
import pandas as pd

from pixtools import utils
from reach import Cohort
from reach.session import Outcomes

mouse_ids = [
    "HFR18",
    "HFR29",
    "HFR30",
]

cohort = Cohort.init_from_files(
    data_dir=Path(
        '~/duguidlab/CuedBehaviourAnalysis/Data/TrainingJSON').expanduser(),
    mouse_ids=mouse_ids,
)

# Find best days
results = pd.DataFrame(cohort.get_results())
results['correct'] = results['correct_l'] + results['correct_r']
results['incorrect'] = results['incorrect_l'] + results['incorrect_r']

best_days = []
max_rewards = []
incorrects = []

for mouse in mouse_ids:
    mouse_results = results[results['mouse_id'] == mouse]
    max_reward = mouse_results['correct'].max()