def main(): argParser = argparse.ArgumentParser() argParser.add_argument('--config', '-c', default=defaultConfig, type=str, help='experiment config file (.json or .toml)') argParser.add_argument('--runs', '-r', default='', type=str, help='Comma separated list of run numbers') argParser.add_argument('--scans', '-s', default='', type=str, help='Comma separated list of scan number') # creates web pipe communication link to send/request responses through web pipe argParser.add_argument('--webpipe', '-w', default=None, type=str, help='Named pipe to communicate with webServer') argParser.add_argument('--filesremote', '-x', default=False, action='store_true', help='dicom files retrieved from remote server') argParser.add_argument('--getReward', '-g', default=False, action='store_true', help='if you want to calculate reward earned') argParser.add_argument( '--makePlots', '-p', default=False, action='store_true', help='if you want to plot correct probability over time') args = argParser.parse_args() print(args) cfg = greenEyes.initializeGreenEyes(args.config, args) correct_prob = getCorrectProbability(cfg) print('Prob for each run (col) over all stations (row)') print(correct_prob.T) if args.getReward: total_reward = getReward(cfg, correct_prob) if args.makePlots: plotCorrectProbability(cfg, correct_prob)
'axes.titlesize': 'x-large', 'xtick.labelsize': 'x-large', 'ytick.labelsize': 'x-large' } font = {'weight': 'bold', 'size': 22} plt.rc('font', **font) defaultConfig = os.path.join(os.getcwd(), 'conf/greenEyes_cluster.toml') cfg = loadConfigFile(defaultConfig) params = StructDict({ 'config': defaultConfig, 'runs': '1', 'scans': '9', 'webpipe': 'None', 'webfilesremote': False }) cfg = greenEyes.initializeGreenEyes(defaultConfig, params) # date doesn't have to be right, but just make sure subject number, session number, computers are correct def getClassificationAndScore(data): correct_prob = data['correct_prob'][0, :] max_ratio = data['max_ratio'][0, :] return correct_prob, max_ratio def getPatternsData(subjectNum, runNum): bids_id = 'sub-{0:03d}'.format(subjectNum) ses_id = 'ses-{0:02d}'.format(2) filename = '/jukebox/norman/amennen/RT_prettymouth/data/intelData/{0}/{1}/patternsData_r{2}_*.mat'.format( bids_id, ses_id, runNum) fn = glob.glob(filename)[-1]
sys.path.append('/home/amennen/code/rt-cloud') # OR FOR INTELRT sys.path.append('/Data1/code/rt-cloud/') from rtCommon.utils import loadConfigFile, dateStr30, DebugLevels, writeFile, loadMatFile from rtCommon.readDicom import readDicomFromBuffer from rtCommon.fileClient import FileInterface import rtCommon.webClientUtils as wcutils from rtCommon.structDict import StructDict import rtCommon.dicomNiftiHandler as dnh import greenEyes subject=102 #conf='/home/amennen/code/rt-cloud/projects/greenEyes/conf/greenEyes_organized.local.toml' conf = '/Data1/code/rt-cloud/projects/greenEyes/conf/greenEyes_organized.toml' args = StructDict() args.config=conf args.runs = '1' args.scans = '5' args.webpipe = None args.filesremote = False cfg = greenEyes.initializeGreenEyes(args.config,args) r = 0 fileStr = '{0}/patternsData_r{1}*'.format(cfg.subject_full_day_path,r+1) run_pat = glob.glob(fileStr)[-1] run_data = loadMatFile(run_pat) # check classifier modelfn = '/home/amennen/utils/greenEyes_clf/UPPERRIGHT_stationInd_0_ROI_1_AVGREMOVE_1_filter_0_k1_0_k2_25.sav' modelfn = '/Data1/code/utils_greenEyes/greenEyes_clf/UPPERRIGHT_stationInd_0_ROI_1_AVGREMOVE_1_filter_0_k1_0_k2_25.sav'' loaded_model = pickle.load(open(modelfn, 'rb'))