def cortex_to_angle(self, *args):
if len(args) == <NUM_LIT:1>:<EOL><INDENT>try:              m = geo.to_mesh(args[<NUM_LIT:0>])<EOL>except Exception: m = None<EOL>if m is not None:<EOL><INDENT>if geo.is_flatmap(m):<EOL><INDENT>(x,y) = m.coordinates<EOL>return self.model.cortex_to_angle(x, y)<EOL><DEDENT>else:<EOL><INDENT>fm = self.map_projection(m)<EOL>res = np.zeros((<NUM_LIT:3>, args[<NUM_LIT:0>].vertex_count))<EOL>c2a = np.asarray(self.cortex_to_angle(fm.coordinates))<EOL>res[:, fm.labels] = (c2a if len(c2a) == len(res) else c2a.T)<EOL>return res<EOL><DEDENT><DEDENT>try:              c = mri.to_cortex(args[<NUM_LIT:0>])<EOL>except Exception: c = None<EOL>if c is not None:<EOL><INDENT>m = self.map_projection(c)<EOL>res = np.zeros((<NUM_LIT:3>, c.vertex_count))<EOL>c2a = np.asarray(self.cortex_to_angle(m.coordinates))<EOL>res[:, m.labels] = (c2a if len(c2a) == len(res) else c2a.T)<EOL>return res<EOL><DEDENT>X = np.asarray(args[<NUM_LIT:0>])<EOL>if len(X.shape) != <NUM_LIT:2>: raise ValueError('<STR_LIT>')<EOL>X = X if X.shape[<NUM_LIT:0>] == <NUM_LIT:2> or X.shape[<NUM_LIT:0>] == <NUM_LIT:3> else X.T<EOL>if X.shape[<NUM_LIT:0>] == <NUM_LIT:2>: return self.model.cortex_to_angle(X[<NUM_LIT:0>], X[<NUM_LIT:1>])<EOL>elif X.shape[<NUM_LIT:0>] == <NUM_LIT:3>:<EOL><INDENT>(x,y) = self.map_projection(X)<EOL>return self.model.cortex_to_angle(x, y)<EOL><DEDENT>else: raise ValueError('<STR_LIT>')<EOL><DEDENT>else: return self.model.cortex_to_angle(*args)<EOL>
The cortex_to_angle method of the RegisteredRetinotopyModel class is identical to that
of the RetinotopyModel class, but the method may be given a map, mesh, or cortex, in
which case the result is applied to the coordinates after the appropriate transformation (if
any) is first applied.