Skip to content

incorperate image homology into loop matching#97

Merged
stanfish06 merged 14 commits into
masterfrom
diffusion-hyperplane
Jul 13, 2026
Merged

incorperate image homology into loop matching#97
stanfish06 merged 14 commits into
masterfrom
diffusion-hyperplane

Conversation

@stanfish06

Copy link
Copy Markdown
Owner
  • landscape analysis
  • landscape
  • landscape
  • add downsample mode and cleanup code
  • prepare for image based cross species matching
  • make ripser return birth and death simplices
  • update: image based filtration
  • fix: downsample logic
  • update: image based rips
  • update: image based loop matching for bootstrap
  • fix: memory issue for image homology
  • fix bug: diagonal entry handling for image PH
  • update readme

@stanfish06 stanfish06 merged commit 5b5b1e3 into master Jul 13, 2026
6 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b5b1e3e31

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


############

from match.utils_plot import *

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the unresolved match.utils_plot import

In any environment that imports scloop.matching.utils, this top-level import raises ModuleNotFoundError before any of the new matching helpers can be used; I searched the repo for utils_plot/match and this is the only reference, so the dependency is neither vendored nor package-relative.

Useful? React with 👍 / 👎.

return out

#### define your system
send_cmd = send_cmd_windows

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Select the POSIX command runner on non-Windows hosts

When this module is used on Linux or macOS, helpers like compute_image_bars still call send_cmd_windows because of this unconditional assignment. That runner passes the entire command string to subprocess.Popen without shell=True, so POSIX tries to execute a literal filename like ./ripser-image --dim ... instead of running the command; choose the runner based on the platform or pass argv explicitly.

Useful? React with 👍 / 👎.

Comment on lines +960 to +961
else
columns_to_reduce.push_back(edge);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip ambient-only edges in image reductions

When computing image homology on the union complex, sub_edges still contains ambient edges whose endpoints are not both in the chosen subfiltration, with diameter_sub == inf. This branch can enqueue those ambient-only edges as reduction columns, allowing them to claim pivots before true subfiltration edges and thereby suppress or shift H1 image bars whenever the two samples are connected through cross/other-sample edges; the column-building pass should skip edges whose subfiltration diameter exceeds the threshold, as the dim-0 pass above already does.

Useful? React with 👍 / 👎.

Comment on lines +167 to +169
size=len(source_indices)
if bootstrap_sampling == "resample"
else int(len(source_indices) * bootstrap_downsample_fraction),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clamp downsampled bootstrap size

When bootstrap_sampling="downsample", this uses int(len(source_indices) * bootstrap_downsample_fraction) directly. For small inputs or low fractions this can choose fewer than two vertices, e.g. two source vertices with the default 2/3 fraction produces a one-point bootstrap, unlike the FPS branches that clamp to at least two; downstream homology rounds then fail or produce unusable empty loop samples instead of a valid bootstrap.

Useful? React with 👍 / 👎.

# Extract data from self based on bootstrap flag
if not bootstrap:
assert self.persistence_diagram is not None
assert self.persistence_pair_simplices is not None

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist pair simplices before requiring them

After save_scloop/load_scloop, persistence_pair_simplices is always None because the HDF5 writer only serializes persistence_diagram and cocycles; this new assertion therefore makes re-running loop representative computation on a loaded homology object fail even though the diagrams and cocycles needed by the previous implementation were persisted. Either serialize/deserialize the pair simplices or allow this call to proceed with None for backward-compatible loaded data.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant