def fit(self, subjects_dir, target=None): study_dir = os.path.split(subjects_dir[0])[0] self.study_id_ = os.path.split(study_dir)[1] self.run_key_ = check_run_key(study_dir) self.task_contrasts_ = check_task_contrasts(study_dir, self.model_id, self.run_key_) self.condition_key_ = check_condition_key(study_dir, self.model_id) self.scan_key_ = check_scan_key(study_dir) self.task_key_ = get_table(os.path.join(study_dir, 'task_key.txt')) self.model_key_ = get_table(os.path.join(study_dir, 'model_key.txt')) self.orthogonalize_ = check_orthogonalize(study_dir, self.run_key_) return self
def fit(self, subjects_dir, target=None): study_dir = os.path.split(subjects_dir[0])[0] self.study_id_ = os.path.split(study_dir)[1] self.run_key_ = check_run_key(study_dir) self.task_contrasts_ = check_task_contrasts( study_dir, self.model_id, self.run_key_) self.condition_key_ = check_condition_key(study_dir, self.model_id) self.scan_key_ = check_scan_key(study_dir) self.task_key_ = get_table(os.path.join(study_dir, 'task_key.txt')) self.model_key_ = get_table(os.path.join(study_dir, 'model_key.txt')) self.orthogonalize_ = check_orthogonalize(study_dir, self.run_key_) return self
def check_scan_key(study_dir): """Parse scan_key file to get scanning information (currently only TR). """ if not os.path.exists(os.path.join(study_dir, 'scan_key.txt')): warnings.warn('Scan key does not exist') return {} scan_key = get_table(os.path.join(study_dir, 'scan_key.txt')) scan_key['TR'] = float(scan_key['TR']) return scan_key
def check_scan_key(study_dir): """Parse scan_key file to get scanning information (currently only TR). """ scan_key = get_table(os.path.join(study_dir, 'scan_key.txt')) scan_key['TR'] = float(scan_key['TR']) return scan_key