def retinotopy_data(m, source='<STR_LIT>'):
if pimms.is_map(source):<EOL><INDENT>if all(k in source for k in ['<STR_LIT>', '<STR_LIT>']): return source<EOL><DEDENT>if geo.is_vset(m): return retinotopy_data(m.properties, source=source)<EOL>source = source.lower()<EOL>model_rets = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>empir_rets = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:data>']<EOL>wild = False<EOL>extra_fields = {'<STR_LIT>':('<STR_LIT>','<STR_LIT>'), '<STR_LIT>':('<STR_LIT>','<STR_LIT>')}<EOL>check_fields = []<EOL>if source in empir_rets:<EOL><INDENT>fixes = empir_rets<EOL>check_fields = extra_fields['<STR_LIT>']<EOL><DEDENT>elif source in model_rets:<EOL><INDENT>fixes = model_rets<EOL>check_fields = extra_fields['<STR_LIT>']<EOL><DEDENT>elif source in ['<STR_LIT>', '<STR_LIT:*>', '<STR_LIT:all>']:<EOL><INDENT>fixes = model_rets + empir_rets<EOL>check_fields = extra_fields['<STR_LIT>'] + extra_fields['<STR_LIT>']<EOL>wild = True<EOL><DEDENT>elif source in ['<STR_LIT:none>', '<STR_LIT>']:<EOL><INDENT>fixes = []<EOL>check_fields = extra_fields['<STR_LIT>'] + extra_fields['<STR_LIT>']<EOL>wild = True<EOL><DEDENT>else: fixes = []<EOL>(z, prefix, suffix) = (None, None, None)<EOL>if wild:<EOL><INDENT>try: z = as_retinotopy(m, '<STR_LIT>')<EOL>except Exception: pass<EOL><DEDENT>for fix in fixes:<EOL><INDENT>if z: break<EOL>try:<EOL><INDENT>z = as_retinotopy(m, '<STR_LIT>', prefix=(fix + '<STR_LIT:_>'))<EOL>prefix = fix + '<STR_LIT:_>'<EOL><DEDENT>except Exception: pass<EOL><DEDENT>for fix in fixes:<EOL><INDENT>if z: break<EOL>try:<EOL><INDENT>z = as_retinotopy(m, '<STR_LIT>', suffix=('<STR_LIT:_>' + fix))<EOL>suffix = fix + '<STR_LIT:_>'<EOL><DEDENT>except Exception: pass<EOL><DEDENT>if not z:<EOL><INDENT>try:<EOL><INDENT>pref = source if source.endswith('<STR_LIT:_>') else (source + '<STR_LIT:_>')<EOL>z = as_retinotopy(m, '<STR_LIT>', prefix=pref)<EOL>prefix = pref<EOL>check_fields = extra_fields['<STR_LIT>'] + extra_fields['<STR_LIT>']<EOL><DEDENT>except Exception:<EOL><INDENT>raise<EOL>try:<EOL><INDENT>suff = source if source.startswith('<STR_LIT:_>') else ('<STR_LIT:_>' + source)<EOL>z = as_retinotopy(m, '<STR_LIT>', suffix=suff)<EOL>suffix = suff<EOL>check_fields = extra_fields['<STR_LIT>'] + extra_fields['<STR_LIT>']<EOL><DEDENT>except Exception: pass<EOL><DEDENT><DEDENT>if not z: raise ValueError('<STR_LIT>' % source)<EOL>res = {'<STR_LIT>': z[<NUM_LIT:0>], '<STR_LIT>': z[<NUM_LIT:1>]}<EOL>pnames = {k.lower():k for k in m} if check_fields else {}<EOL>for fname in set(check_fields):<EOL><INDENT>for (aliases, trfn) in retinotopic_property_aliases.get(fname, []):<EOL><INDENT>if trfn is None: trfn = lambda x:x<EOL>for f in aliases:<EOL><INDENT>if prefix: f = prefix + f<EOL>if suffix: f = f + suffix<EOL>f = f.lower()<EOL>if f in pnames:<EOL><INDENT>res[fname] = trfn(m[pnames[f]])<EOL>trfn = None<EOL>break<EOL><DEDENT><DEDENT>if trfn is None: break<EOL><DEDENT><DEDENT>return res<EOL>
retinotopy_data(m) yields a dict containing a retinotopy dataset with the keys 'polar_angle',
  'eccentricity', and any other related fields for the given retinotopy type; for example,
  'pRF_size' and 'variance_explained' may be included for measured retinotopy datasets and
  'visual_area' may be included for atlas or model datasets. The coordinates are always in the
  'visual' retinotopy style, but can be reinterpreted with as_retinotopy.
retinotopy_data(m, source) may be used to specify a particular source for the data; this may be
  either 'empirical', 'model', or 'any'; or it may be a prefix/suffix beginning/ending with
  an _ character.