@importer('<STR_LIT>', ('<STR_LIT>', '<STR_LIT>'))<EOL>def load_fmm_model(filename, radius=np.pi/<NUM_LIT>, sphere_radius=<NUM_LIT>):
if not os.path.exists(filename):<EOL><INDENT>models_path = os.path.join(library_path(), '<STR_LIT>')<EOL>fname = next((fnm<EOL>for beg in ['<STR_LIT>', models_path] for end in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']<EOL>for fnm0 in [filename + end]<EOL>for fnm in [fnm0 if beg is None else os.path.join(beg, fnm0)]<EOL>if os.path.exists(fnm)),<EOL>None)<EOL>if fname is None:<EOL><INDENT>raise ValueError('<STR_LIT>' % filename)<EOL><DEDENT>filename = fname<EOL><DEDENT>if not os.path.isfile(filename):<EOL><INDENT>raise ValueError('<STR_LIT>' % filename)<EOL><DEDENT>gz = True if len(filename) > <NUM_LIT:3> and filename[-<NUM_LIT:3>:] == '<STR_LIT>' else False<EOL>lines = None<EOL>with (gzip.open(filename, '<STR_LIT>') if gz else open(filename, '<STR_LIT>')) as f:<EOL><INDENT>lines = f.read().split('<STR_LIT:\n>')<EOL><DEDENT>if len(lines) < <NUM_LIT:3> or lines[<NUM_LIT:0>] != '<STR_LIT>':<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>n = int(lines[<NUM_LIT:1>].split('<STR_LIT::>')[<NUM_LIT:1>].strip())<EOL>m = int(lines[<NUM_LIT:2>].split('<STR_LIT::>')[<NUM_LIT:1>].strip())<EOL>reg = lines[<NUM_LIT:3>].split('<STR_LIT::>')[<NUM_LIT:1>].strip()<EOL>hemi = lines[<NUM_LIT:4>].split('<STR_LIT::>')[<NUM_LIT:1>].strip().upper()<EOL>center = list(map(float, lines[<NUM_LIT:5>].split('<STR_LIT::>')[<NUM_LIT:1>].strip().split('<STR_LIT:U+002C>')))<EOL>onxaxis = list(map(float, lines[<NUM_LIT:6>].split('<STR_LIT::>')[<NUM_LIT:1>].strip().split('<STR_LIT:U+002C>')))<EOL>method = lines[<NUM_LIT:7>].split('<STR_LIT::>')[<NUM_LIT:1>].strip().lower()<EOL>tx = np.asarray(<EOL>[list(map(float, row.split('<STR_LIT:U+002C>')))<EOL>for row in lines[<NUM_LIT:8>].split('<STR_LIT::>')[<NUM_LIT:1>].strip('<STR_LIT>').split('<STR_LIT:;>')])<EOL>if lines[<NUM_LIT:9>].startswith('<STR_LIT>'):<EOL><INDENT>s = lines[<NUM_LIT:9>][<NUM_LIT:12>:-<NUM_LIT:1>]<EOL>area_names = tuple(s.split('<STR_LIT:U+0020>'))<EOL>l0 = <NUM_LIT:10>        <EOL><DEDENT>else:<EOL><INDENT>area_names = None<EOL>l0 = <NUM_LIT:9><EOL><DEDENT>crds = []<EOL>for row in lines[l0:(n+l0)]:<EOL><INDENT>(left,right) = row.split('<STR_LIT>')<EOL>crds.append(list(map(float, left.split('<STR_LIT:U+002C>'))))<EOL><DEDENT>crds = np.asarray([list(map(float, left.split('<STR_LIT:U+002C>')))<EOL>for row in lines[l0:(n+l0)]<EOL>for (left,right) in [row.split('<STR_LIT>')]])<EOL>vals = np.asarray([list(map(float, right.split('<STR_LIT:U+002C>')))<EOL>for row in lines[l0:(n+l0)]<EOL>for (left,right) in [row.split('<STR_LIT>')]])<EOL>tris = -<NUM_LIT:1> + np.asarray(<EOL>[list(map(int, row.split('<STR_LIT:U+002C>')))<EOL>for row in lines[(n+l0):(n+m+l0)]])<EOL>return RegisteredRetinotopyModel(<EOL>RetinotopyMeshModel(tris, crds,<EOL><NUM_LIT>-<NUM_LIT>/np.pi*vals[:,<NUM_LIT:0>], vals[:,<NUM_LIT:1>], np.asarray(vals[:,<NUM_LIT:2>], dtype=np.int),<EOL>transform=tx,<EOL>area_name_to_id=area_names),<EOL>geo.MapProjection(registration=reg,<EOL>center=center,<EOL>center_right=onxaxis,<EOL>method=method,<EOL>radius=radius,<EOL>sphere_radius=sphere_radius,<EOL>chirality=hemi))<EOL>
load_fmm_model(filename) yields the fmm model indicated by the given file name. Fmm models are
triangle meshes that define a field value at every vertex as well as the parameters of a
projection to the 2D cortical surface via a registartion name and projection parameters.
The following options may be given:
  * radius (default: pi/3) specifies the radius that should be assumed by the model; fmm models
    do not specify radius values in their projection parameters, but pi/3 is usually large for
    localized models.
  * sphere_radius (default: 100) specifies the radius of the sphere that should be assumed by
    the model. Note that in Freesurfer, spheres have a radius of 100.