From 119cf51143e9c81d53bd1ed063500f6b2e656aec Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 23:49:22 -0700 Subject: [PATCH 1/2] docs(surfinfo): add missing docstring for flat_border flat_border had no docstring at all despite being on the website's API reference. Describes its outfile/subject parameters and the lines/ismwalls arrays it saves. Co-Authored-By: Claude Sonnet 5 --- cortex/surfinfo.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cortex/surfinfo.py b/cortex/surfinfo.py index f59525648..de11406d7 100644 --- a/cortex/surfinfo.py +++ b/cortex/surfinfo.py @@ -153,6 +153,22 @@ def tissots_indicatrix(outfile, sub, radius=10, spacing=50): np.savez(outfile, left=tissots[0], right=tissots[1], centers=allcenters) def flat_border(outfile, subject): + """ + Compute the boundary of the flatmap as a set of line segments, split into + segments that lie along the medial wall and segments that don't, and + save the result to `outfile`. + + Parameters + ---------- + outfile : str + Path where the border map will be saved as an npz file, with `lines` + (a list of boundary line segments, each an array of 2D points) and + `ismwalls` (a boolean flag for each segment indicating whether it + lies along the medial wall) arrays. + subject : str + Subject in the pycortex database for whom the flatmap border will be + computed. + """ flatpts, flatpolys = db.get_surf(subject, "flat", merge=True, nudge=True) flatpolyset = set([tuple(x) for x in flatpolys]) From 6c0285508f5fa867afeae330cb5c7c0f479111cc Mon Sep 17 00:00:00 2001 From: AgarwalNilay Date: Thu, 20 Aug 2026 23:54:40 -0700 Subject: [PATCH 2/2] flag undefined `height` bug in flat_border flat_border references an undefined `height` variable, which raises NameError as written. Adds a FIXME comment noting this and pointing to the commented-out Image.new(...) call that suggests it was meant to be a parameter, for a reviewer to decide the right fix. Co-Authored-By: Claude Sonnet 5 --- cortex/surfinfo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cortex/surfinfo.py b/cortex/surfinfo.py index de11406d7..e64b9c1b2 100644 --- a/cortex/surfinfo.py +++ b/cortex/surfinfo.py @@ -216,7 +216,11 @@ def make_surface_graph(tris): splitbounds.append(sb) ismwall = [[s.mean()>0.5 for s in np.split(mwb, c)] for mwb,c in zip(mwallbounds, changes)] - + + # FIXME: `height` is undefined -- this raises NameError as written. + # It was presumably meant to be a parameter (see the commented-out + # Image.new(...) call below, which used it as the output image height + # in pixels). Needs a reviewer decision on the right fix/default. aspect = (height / (flatpts.max(0) - flatpts.min(0))[1]) lpts = (flatpts - flatpts.min(0)) * aspect rpts = (flatpts - flatpts.min(0)) * aspect