# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

#  .. _process:
#  
#  .. title:: Process
#  
# #### Process

# Created on Sat May 1 15:12:38 2019  
# @author: <NAME>  
# @email: <EMAIL>  
# @url: https://semeon.io/d/R33-analysis  
# @purpose: Hub for running processing and analysis.  

# ##### imports

# +
#----local
from imhr import plot, processing, raw, redcap
import imhr.model as model
import imhr.settings as settings

# check if required libraries are available
is_library = False
if is_library:
    settings.library()
pass

# core
from pdb import set_trace as breakpoint
import pandas as pd
import gc, glob, string, pytz
from datetime import datetime

# config
config = settings.config
filters = settings.config['filters']
#set parameters
config['task'] = 'gRT'
config['type'] = 'eyetracking'
config['single_subject'] = False
config['single_trial'] = False

# set current date
date_start = []; date_end = []
date_now  = datetime.now().replace(microsecond=0).strftime('%Y-%m-%d %H:%M:%S')
# -

# ##### start

print(console['red'] + 'Step: preprocessing data' + console['ENDC'])
#----parameters
path = config['output'] + "/raw/"
subject = 31
trial = 35
#----if single subject, single trial
if (config['single_subject']) and (config['single_trial']):
    print('processing: single subject, single trial')
    processing.run(path=path, task_type=config['type'], single_subject=True, single_trial=True, subject=subject, trial=trial)
#----else if single subject, all trials
elif (config['single_subject']) and (not config['single_trial']):
    print('processing: single subject, all trials')
    processing.run(path=path, task_type=config['type'], single_subject=True, single_trial=False, subject=subject)
#----if all subjects, all trials
elif (not config['single_subject']) and (not config['single_trial']):
    print('processing: all subjects, all trials')
    processing.run(path=path, task_type=config['type'], single_subject=False, single_trial=False, isMultiprocessing=True, cores=7)
#----finished	
date_end.append({'preprocessing':'%s'%(datetime.now().replace(microsecond=0).isoformat())})

StarcoderdataJupyterScriptsDedupFiltered