@staticmethod<EOL><INDENT>def load_subject(cache_directory, sid):<DEDENT>
if pimms.is_int(sid): sid = '<STR_LIT>' % sid<EOL>sub = freesurfer_subject(os.path.join(cache_directory, '<STR_LIT>', sid))<EOL>def _load_ints(flnm):  return np.asarray(nyio.load(flnm), dtype=np.int)<EOL>def _load_angle(flnm):<EOL><INDENT>dat = nyio.load(flnm)<EOL>(d,n) = os.path.split(flnm)<EOL>d = os.path.split(d)[<NUM_LIT:0>]<EOL>return -dat if d.endswith('<STR_LIT>') and n.startswith('<STR_LIT>') else dat<EOL><DEDENT>def update_hemi(subname, hemis, hname):<EOL><INDENT>hemi = hemis[hname]<EOL>stup = {'<STR_LIT>':subname, '<STR_LIT>':hname}<EOL>pdat = {}<EOL>sprops = (BensonWinawer2018Dataset.fsaverage_properties if subname == '<STR_LIT>' else<EOL>BensonWinawer2018Dataset.subject_properties)<EOL>for (propname, filename) in six.iteritems(sprops):<EOL><INDENT>filename = os.path.join(cache_directory, filename.format(stup))<EOL>if not os.path.isfile(filename): continue<EOL>pdat[propname] = curry(<EOL>(_load_ints  if propname.endswith('<STR_LIT>') else<EOL>_load_angle if propname.endswith('<STR_LIT>') else<EOL>nyio.load),<EOL>filename)<EOL><DEDENT>hemi = hemi.with_prop(pimms.lazy_map(pdat))<EOL>rdat = {}<EOL>sregs = (BensonWinawer2018Dataset.fsaverage_registrations if subname == '<STR_LIT>' else<EOL>BensonWinawer2018Dataset.subject_registrations)<EOL>for (rname, filename) in six.iteritems(sregs):<EOL><INDENT>filename = os.path.join(cache_directory, filename.format(stup))<EOL>if not os.path.isfile(filename): continue<EOL>rdat[rname] = curry(nyio.load, filename, '<STR_LIT>')<EOL><DEDENT>hemi = hemi.copy(_registrations=pimms.merge(hemi.registrations, pimms.lazy_map(rdat)))<EOL>return hemi<EOL><DEDENT>hemis = reduce(lambda h,hname: h.set(hname, curry(update_hemi, sub.name, sub.hemis, hname)),<EOL>['<STR_LIT>','<STR_LIT>'],<EOL>sub.hemis)<EOL>return sub.copy(hemis=hemis)<EOL>
BensonWinawer2018Dataset.load_subject(dir, subjid) loads the given subject ID from the given
  Benson and Winawer (2018) cache directory. This directory must contain the relevant
  freesurfer_subjects/, retinotopy/, and analyses/, directories (they should be
  auto-downloaded if accessed via the databases interface).