@pimms.calc('<STR_LIT>', '<STR_LIT>')<EOL>def calc_atlases(worklog, atlas_subject_id='<STR_LIT>'):
try:              sub = freesurfer_subject(atlas_subject_id)<EOL>except Exception: sub = None<EOL>if sub is None:<EOL><INDENT>try: sub = hcp_subject(atlas_subject_id)<EOL>except Exception: sub = None<EOL><DEDENT>if sub is None: raise ValueError('<STR_LIT>' % atlas_subject_id)<EOL>worklog('<STR_LIT>' % sub.path)<EOL>atlases = AutoDict()<EOL>atlas_patt = r'<STR_LIT>'<EOL>atlas_hemi_ii = <NUM_LIT:1><EOL>atlas_atls_ii = <NUM_LIT:2><EOL>atlas_meas_ii = <NUM_LIT:3><EOL>atlas_vrsn_ii = <NUM_LIT:6><EOL>libdir = os.path.join(library_path(), '<STR_LIT:data>')<EOL>for pth in [libdir] + config['<STR_LIT>'] + [sub.path]:<EOL><INDENT>pth = os.path.join(pth, sub.name, '<STR_LIT>')<EOL>if not os.path.isdir(pth): continue<EOL>for fl in os.listdir(pth):<EOL><INDENT>m = re.match(atlas_patt, fl)<EOL>if m is None: continue<EOL>fl = os.path.join(pth, fl)<EOL>(h, atls, meas, vrsn) = [<EOL>m.group(ii) for ii in (atlas_hemi_ii, atlas_atls_ii, atlas_meas_ii, atlas_vrsn_ii)]<EOL>if vrsn is not None: vrsn = tuple([int(s) for s in vrsn.split('<STR_LIT:_>')])<EOL>atlases[atls][vrsn][h][meas] = curry(nyio.load, fl)<EOL><DEDENT><DEDENT>atlas_map = pyr.pmap({a:pyr.pmap({v:pyr.pmap({h:pimms.lazy_map(hv)<EOL>for (h,hv) in six.iteritems(vv)})<EOL>for (v,vv) in six.iteritems(av)})<EOL>for (a,av) in six.iteritems(atlases)})<EOL>return {'<STR_LIT>':atlas_map, '<STR_LIT>':sub}<EOL>
cacl_atlases finds all available atlases in the possible subject directories of the given atlas
subject.

In order to be a template, it must either be a collection of files (either mgh/mgz or FreeSurfer
curv/morph-data files) named as '<hemi>.<template>_<quantity><ending>' such as the files
'lh.wang2015_mplbl.mgz' and 'rh.wang2015_mplbl.mgz'. They may additionally have a version
prior to the ending, as in 'lh.benson14_angle.v2_5.mgz'. Files without versions are considered 
to be of a higher version than all versioned files. All files must be found in the atlas
subject's surf/ directory; however, all subjects in all FreeSurfer subjects paths with the same
subject id are searched if the atlas is not found in the atlas subejct's directory.

Afferent parameters:
  @ atlas_subject_id 
    The FreeSurfer subject name subject path of the subject that is to be used as the atlas
    subject from which the atlas is interpolated. HCP subjects are not currently supported.

Efferent values:
  @ atlas_map 
    A persistent map whose keys are atlas names, the values of which are themselves persistent
    maps whose keys are the versions of the given atlas (None potentially being included). The
    values of these maps are again maps of hemisphere names then finally of the of the quantity
    names (such as 'eccen' or 'maxprob') to the property vectors imported from the appropriate
    files.