Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f0fa32f
Add example 06: spectral analysis with fuge EMRI embeddings
cweniger Feb 19, 2026
23a8033
Widen prior ranges and increase buffer/batch sizes for spectral example
cweniger Feb 19, 2026
69c98e6
Fix TokenEmbed to compute z-score normalization on first batch
cweniger Feb 19, 2026
f48d1a4
Force JAX CPU backend for EMRI simulator in Ray workers
cweniger Feb 19, 2026
d82d39a
Only fall back to JAX CPU when no GPU is visible
cweniger Feb 19, 2026
5bf2728
Add Fisher/CRB comparison plotting script for spectral example
cweniger Feb 20, 2026
793514f
Default make_plots.py to outputs/latest
cweniger Feb 20, 2026
2031dea
Add chunk_size to avoid OOM during posterior sampling
cweniger Feb 21, 2026
9a16bd4
Tune spectral analysis buffer and sampling parameters
cweniger Feb 21, 2026
68f64d8
Detach STFT output to avoid wasteful backward pass and add spectra an…
cweniger Feb 21, 2026
e73bb18
Support deterministic intermediate nodes in inference graph and add t…
cweniger Feb 22, 2026
8ea2370
Mixed-precision dtype zones and explicit online normalization
cweniger Feb 22, 2026
12fda24
Add dim parameter to RunningNorm in example 06 configs
cweniger Feb 22, 2026
01ade92
Trigger CI
cweniger Feb 22, 2026
020fa4f
Fix proposal re-simulation corrupting deterministic intermediate nodes
cweniger Feb 24, 2026
0120c1e
update config.yml
cweniger Feb 24, 2026
09d565c
Add spectrum animation script for example 06
cweniger Feb 24, 2026
2e976c8
Read signal parameters from config in plotting scripts
cweniger Feb 24, 2026
03ba7ce
GPU-accelerate signal generation with JAX vmap, scale to N=1M
cweniger Feb 25, 2026
0986803
Consolidate example 06 benchmark: local chirp model, 10σ CRB priors, …
cweniger Mar 3, 2026
6982edb
Fix float64 precision for GaussianPosterior output buffers
cweniger Mar 4, 2026
16968a4
Correct posterior sampling for proposal-trained Gaussian estimator
cweniger Mar 6, 2026
6b17c3e
Updates config2.yml
cweniger Mar 6, 2026
aab9d24
Add SpectralTokenEmbed with Fourier frequency features and PhaseForme…
cweniger Mar 7, 2026
9dedaa7
Simplify SVDEmbedding forward using fuge StreamingPCA zero-fallback
cweniger Mar 9, 2026
679399f
Use float64 for Signal and Noise simulator outputs
cweniger Mar 9, 2026
b71326f
Add FIXME for missing condition refs in _execute_graph output
cweniger Mar 9, 2026
8be0f15
Rename CLI options: --run-dir → --output/-o, --config-name → --config/-c
cweniger Mar 10, 2026
f735db5
Add combined SVD+token embedding config and Concat module
cweniger Mar 10, 2026
73332ed
Merge branch 'main' into feat/06_example
cweniger Mar 10, 2026
5d0bc3a
Merge branch 'main' into rename-cli-options
cweniger May 6, 2026
50ce17a
Merge branch 'rename-cli-options' into feat/06_example
cweniger May 6, 2026
009347f
Merge branch 'main' into feat/06_example
cweniger May 6, 2026
d663130
Merge branch 'main' into feat/06_example
cweniger May 6, 2026
7add1ba
Merge branch 'main' into feat/06_example
cweniger May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
741 changes: 741 additions & 0 deletions examples/06_spectral_analysis/PhaseFormer.md

Large diffs are not rendered by default.

138 changes: 138 additions & 0 deletions examples/06_spectral_analysis/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# =============================================================================
# Falcon Example Configuration: 06_spectral_analysis (tokenized variant)
# -----------------------------------------------------------------------------
# Uses Signal + Noise + Data decomposition with an intermediate "tokens" node
# that caches the expensive STFT tokenization. Training operates on compact
# token tensors instead of re-running the STFT every epoch.
#
# Graph: theta -> y (clean signal)
# \
# -> x (observed = y + n) -> tokens
# /
# n (noise)
#
# NOTE: This config will currently FAIL during proposal/posterior sampling
# because falcon's inference graph does not include intermediate deterministic
# nodes (tokens has no estimator and no evidence).
# =============================================================================

logging:
wandb:
enabled: false
project: falcon_examples
group: 06_spectral_analysis
dir: ${run_dir}
local:
enabled: true
dir: ${paths.graph}

paths:
import: "./src"
buffer: ${run_dir}/sim_dir
graph: ${run_dir}/graph_dir
samples: ${run_dir}/samples_dir

buffer:
min_samples: 4092
max_samples: 4092
validation_samples: 256
simulate_count: 256
simulate_when_full: true
simulate_interval: 1
store_fraction: 0.0

graph:
theta:
evidence: [tokens]
sample_chunk_size: 8

simulator:
_target_: falcon.priors.Product
priors: # 10x CRB at N=100k
- ['normal', 2.75e-3, 1e-7] # f0
- ['normal', 1.0, 1e-5] # chirp_mass
- ['normal', 1.5, 1e-1] # harmonic_decay

estimator:
_target_: falcon.estimators.Gaussian
loop:
num_epochs: 500
batch_size: 64
early_stop_patience: 32
network:
hidden_dim: 512
num_layers: 3
momentum: 0.1
min_var: 1.0e-25
eig_update_freq: 1
embedding:
_target_: fuge.nn.TransformerEmbedding
d_model: 64
n_heads: 4
n_layers: 2
d_ff: 256
dropout: 0.0
_input_:
_target_: falcon.embeddings.RunningNorm
momentum: 0.01
dim: [0, 1]
output_dtype: float32
_input_:
_target_: embeddings.SpectralTokenEmbed
n_freq: 10
phase_mode: boundary
_input_: [tokens]
optimizer:
lr: 0.005
lr_decay_factor: 0.5
scheduler_patience: 16
inference:
gamma: 1.0
discard_samples: false
log_ratio_threshold: -20.0

ray:
num_gpus: 0.2

y:
parents: [theta]
sample_chunk_size: 8
simulator:
_target_: model.Signal
N: 100000
ray:
num_gpus: 0.2

n:
simulator:
_target_: model.Noise
N: 100000
sigma: 1.0

x:
parents: [y, n]
sample_chunk_size: 8
simulator:
_target_: model.Data
observed: "./data/obs.npz['x']"
ray:
num_gpus: 0.2

tokens:
parents: [x]
sample_chunk_size: 8
simulator:
_target_: embeddings.Tokenizer
k: 10000 # 2024
n_peaks: 3
n_dlnf: 11
dlnf_min: 0.0
dlnf_max: 0.05
ray:
num_gpus: 0.2

sample:
prior:
n: 1000
posterior:
n: 1000
110 changes: 110 additions & 0 deletions examples/06_spectral_analysis/config2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# =============================================================================
# Falcon Example Configuration: 06_spectral_analysis (SVD variant)
# -----------------------------------------------------------------------------
# Uses scaffolded streaming SVD embedding on raw signals.
# Clean signal (y) and noise (n) are scaffolds — available during training
# for whitening/PCA learning, but not at inference time.
#
# Graph: theta -> y (clean signal)
# \
# -> x (observed = y + n)
# /
# n (noise)
#
# Prior ranges are 3x CRB at N=100k (narrow, for parameter estimation).
# Amortized only (no proposal resampling).
# =============================================================================

logging:
wandb:
enabled: false
project: falcon_examples
group: 06_spectral_analysis
dir: ${run_dir}
local:
enabled: true
dir: ${paths.graph}

paths:
import: "./src"
buffer: ${run_dir}/sim_dir
graph: ${run_dir}/graph_dir
samples: ${run_dir}/samples_dir

buffer:
min_samples: 4092
max_samples: 4092
validation_samples: 256
simulate_count: 256
simulate_when_full: true
simulate_interval: 1
store_fraction: 0.0

graph:
theta:
evidence: [x]
scaffolds: [y, n]

simulator:
_target_: falcon.priors.Product
priors: # 10x CRB at N=100k
- ['normal', 2.75e-3, 1e-7] # f0
- ['normal', 1.0, 1e-5] # chirp_mass
- ['normal', 1.5, 1e-1] # harmonic_decay

estimator:
_target_: falcon.estimators.Gaussian
loop:
num_epochs: 500
batch_size: 64
early_stop_patience: 32
network:
hidden_dim: 128
num_layers: 3
momentum: 0.1
min_var: 1.0e-25
eig_update_freq: 1
embedding:
_target_: embeddings.SVDEmbedding
N: 100000
n_components: 64
buffer_size: 256
momentum: 0.1
_input_: [x, y, n]
optimizer:
lr: 0.005
lr_decay_factor: 0.5
scheduler_patience: 16
inference:
gamma: 1.0
discard_samples: false
log_ratio_threshold: -20.0

ray:
num_gpus: 0.3

y:
parents: [theta]
simulator:
_target_: model.Signal
N: 100000
ray:
num_gpus: 0.3

n:
simulator:
_target_: model.Noise
N: 100000
sigma: 1.0

x:
parents: [y, n]
simulator:
_target_: model.Data
observed: "./data/obs.npz['x']"

sample:
prior:
n: 1000
posterior:
n: 1000
106 changes: 106 additions & 0 deletions examples/06_spectral_analysis/config3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# =============================================================================
# Falcon Example Configuration: 06_spectral_analysis (N=256, no embedding)
# -----------------------------------------------------------------------------
# Minimal config with 256 data bins — raw signal fed directly into Gaussian
# estimator (no embedding network needed at this data size).
#
# Graph: theta -> y (clean signal)
# \
# -> x (observed = y + n)
# /
# n (noise)
#
# Prior ranges are ±10σ CRB at N=256.
# =============================================================================

logging:
wandb:
enabled: false
project: falcon_examples
group: 06_spectral_analysis
dir: ${run_dir}
local:
enabled: true
dir: ${paths.graph}

paths:
import: "./src"
buffer: ${run_dir}/sim_dir
graph: ${run_dir}/graph_dir
samples: ${run_dir}/samples_dir

buffer:
min_samples: 32000
max_samples: 32000
validation_samples: 256
simulate_count: 256
simulate_when_full: false
simulate_interval: 1
store_fraction: 0.0

graph:
theta:
evidence: [x]

simulator:
_target_: falcon.priors.Product
priors: # Normal, 5σ CRB at N=256
# - ['normal', 2.7500000000e-3, 4.9540464808e-8] # f0
# - ['normal', 1.0000000000, 7.0304073517e-5] # chirp_mass
#- ['normal', 1.5000000000, 2.9271998214e-1] # harmonic_decay
- ['normal', 2.7500000200e-3, 4.9540464808e-8] # f0
- ['normal', 1.0000200000, 7.0304073517e-5] # chirp_mass
- ['normal', 1.6000000000, 2.9271998214e-1] # harmonic_decay

estimator:
_target_: falcon.estimators.Gaussian
loop:
num_epochs: 500
batch_size: 256
early_stop_patience: 16
network:
hidden_dim: 512
num_layers: 3
momentum: 0.1
min_var: 1.0e-25
eig_update_freq: 1
embedding:
_target_: torch.nn.Identity
_input_: x
optimizer:
lr: 0.005
lr_decay_factor: 0.5
scheduler_patience: 16
inference:
gamma: 0.1
discard_samples: false
log_ratio_threshold: -20.0

ray:
num_gpus: 0.3

y:
parents: [theta]
simulator:
_target_: model.Signal
N: 256
ray:
num_gpus: 0.3

n:
simulator:
_target_: model.Noise
N: 256
sigma: 1.0

x:
parents: [y, n]
simulator:
_target_: model.Data
observed: "./data/obs_256.npz['x']"

sample:
prior:
n: 1000
posterior:
n: 1000
Loading
Loading