Skip to content

Add toy problem for bispectrum#6

Open
johmathe wants to merge 6 commits intomainfrom
johmathe/add-demo
Open

Add toy problem for bispectrum#6
johmathe wants to merge 6 commits intomainfrom
johmathe/add-demo

Conversation

@johmathe
Copy link
Copy Markdown
Collaborator

No description provided.

@johmathe johmathe changed the title Add demo Add toy problem for bispectrum Jan 19, 2026
Comment thread examples/so3_3_trains.py
from bispectrum import SO3onS2


def power_spectrum(coeffs: torch.Tensor) -> torch.Tensor:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we call it spherical_power_spectrum?

"power spectrum" makes it sound like it's the 2D translation fourier power spectrum and its confusing.

Comment thread examples/so3_3_trains.py
# Power law decay l^-2 with meaningful high-frequency content
torch.manual_seed(42) # Reproducibility
truth_coeffs = torch.randn(1, LMAX + 1, LMAX + 1, dtype=torch.complex64, device=device)
for l in range(LMAX + 1):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think with the convention for lmax from SHT, you don't need to do the "+1". Double check?

I think their arrays are of length lmax, that is range(lmax).

Comment thread examples/so3_3_trains.py
# Pre-compute the "Structural Fingerprint" (rotation-invariant bispectrum)
# In practice, this could come from physical constraints or a reference signal
with torch.no_grad():
truth_invariants = bsp_module(truth_coeffs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: true_coeffs?

Comment thread examples/so3_3_trains.py
# --- 2. Generate "Input" (Blurry Observation) ---
# Heavily dampen high frequencies to simulate degraded observation
input_coeffs = truth_coeffs.clone().detach()
for l in range(3, LMAX + 1):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ditto

Comment thread examples/so3_deblur_3.py
from bispectrum import SO3onS2


def power_spectrum(coeffs: torch.Tensor) -> torch.Tensor:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is already define din the other file

Comment thread examples/so3_deblur_3.py
return corr.detach().cpu().numpy()


def run_deblurring_demo():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure I understand the difference btw this demo and the other one. Clarify docstrings or remove one of the two files

from bispectrum import SO3onS2


def power_spectrum(coeffs: torch.Tensor) -> torch.Tensor:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again?

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.

2 participants