Skip to content

infinityabundance/dsfb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

287 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSFB - Drift-Slew Fusion Bootstrap

crates.io docs.rs License: Apache-2.0 DOI: Slew-Aware DSFB Paper DOI: Fusion Diagnostics Paper

What is DSFB?

DSFB compares prediction and measurement.

  • If they disagree a lot, it reduces trust.
  • If they agree, it increases trust.

Instead of treating a sensor as valid or invalid, DSFB treats it as trusted proportionally.

Essentially: Proportional Trust Observer.


ELI5

If a sensor says something that matches what you expect, you listen a lot.
If it says something very different, you listen a little.

Don’t believe a sensor all at once.


Informal overview. See paper for formal definition.

Citations

de Beer, R. (2026). Deterministic Drift--Slew Fusion Bootstrap for Navigation During Plasma Blackout in Hypersonic Re-Entry Vehicles (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18711897]

de Beer, R. (2026). Drift--Slew Fusion Bootstrap: A Deterministic Residual-Based State Correction Framework (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18706455]

de Beer, R. (2026).
Trust-Adaptive Multi-Diagnostic Weighting for Magnetically Confined Plasma State Estimation (v1.0).
Zenodo. [https://doi.org/10.5281/zenodo.18644561]

de Beer, R. (2026).
Slew-Aware Trust-Adaptive Nonlinear State Estimation for Oscillatory Systems With Drift and Corruption (v1.0).
Zenodo. [https://doi.org/10.5281/zenodo.18642887]

de Beer, R. (2026). Hierarchical Residual-Envelope Trust: A Deterministic Framework for Grouped Multi-Sensor Fusion (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18783283]

de Beer, R. (2026). Deterministic Disturbance Modeling Framework for Residual-Envelope Fusion Systems (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18806150]

de Beer, R. (2026). Algebraic Deterministic Dynamics (ADD): A Non-Stochastic Structural Extension of DSFB (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18830567]

de Beer, R. (2026). Deterministic Structural Causal Dynamics (DSCD): Trust-Gated Emergence of Certifiable Causal Graphs for Safety-Critical Aerospace Autonomy (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18867217]

de Beer, R. (2026). Deterministic Causal Dynamics for Safety-Critical Autonomous Systems - Trust-Controlled Causal Topology (TCCT) and Structural Regime Dynamics (SRD) (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18976566]

de Beer, R. (2026). Trust-Monotone Temporal Recursion in Deterministic Structural Dynamics (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.18998208]

de Beer, R. (2026). Alternative Deterministic Structural Inference: The DSFB Stack for Reconstruction, Causal Architecture, Trust Recursion, and Historical Replay (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.19028440]

de Beer, R. (2026). Deterministic Spectral Residual Inference for Swarm Interaction Networks: A DSFB Framework for Structural Phase Stability (v1.0). Zenodo. [https://doi.org/10.5281/zenodo.19073826]


DSFB Simulation Notebook: Open In Colab

Fusion Bench Figures Notebook: Open In Colab

High-Rate Estimation Trust Figures Notebook: Open In Colab

HRET Correlated Group Figures Notebook: Open In Colab

Starship High-Fidelity 6-DoF Re-Entry Notebook: Open In Colab

Hierarchical Residual-Envelope Trust (HRET) Open In Colab

Deterministic Disturbance Modeling Framework (DDMF) Open In Colab

Structural Regime Dynamics (SRD) Open In Colab

TMTR Research Notebook: Open In Colab

DSFB Bank Repro Notebook: Open In Colab

DSFB Swarm Notebook Open In Colab


Algebraic Deterministic Dynamics (ADD) Sweep

The dsfb-add crate runs deterministic parameter sweeps for the Algebraic Deterministic Dynamics (ADD) stack:

  • Algebraic Echo Theory (AET)
  • Topological Charge Propagation (TCP)
  • Resonance Lattice Theory (RLT)
  • Invariant Word-Length Thermodynamics (IWLT)

It generates CSV outputs and figures used in the ADD paper.

Open In Colab


Deterministic Structural Causal Dynamics (DSCD)

The dsfb-dscd crate runs deterministic trust-gated causal graph sweeps and finite-size scaling analyses on top of the DSFB and ADD stacks.

Quick mode (Colab-friendly):

cargo run -p dsfb-dscd -- --quick

Full mode (workstation):

cargo run -p dsfb-dscd -- --full

Explicit scale override:

cargo run -p dsfb-dscd -- --num-events 100000 --scaling-ns 4096,8192,16384,32768,65536,100000 --num-tau-samples 1001

This writes timestamped CSV outputs under output-dsfb-dscd/<timestamp>/ (including threshold_scaling_summary.csv, threshold_curve_N_<N>.csv, graph_events.csv, graph_edges.csv, degree_distribution.csv, interval_sizes.csv, path_lengths.csv, and edge_provenance.csv).

All DSCD paper figures are reproducible from those generated CSVs and the notebook:

  • crates/dsfb-dscd/notebooks/dscd_plots.ipynb

Open In Colab


Workspace Crates

This repository contains seven crates for different DSFB workflows:

Crates.io: dsfb dsfb-ddmf dsfb-fusion-bench dsfb-hret dsfb-lcss-hret dsfb-srd dsfb-starship

  • dsfb: crate for the DSFB estimator itself workspace path: crates/dsfb crates.io: https://crates.io/crates/dsfb docs.rs: https://docs.rs/dsfb
  • dsfb-ddmf: deterministic disturbance modeling + residual-envelope Monte Carlo sweep crate built on top of dsfb workspace path: crates/dsfb-ddmf local README: crates/dsfb-ddmf/README.md crates.io: https://crates.io/crates/dsfb-ddmf docs.rs: https://docs.rs/dsfb-ddmf
  • dsfb-fusion-bench: standalone synthetic benchmarking + plotting-data generator crate workspace path: crates/dsfb-fusion-bench local README: crates/dsfb-fusion-bench/README.md
  • dsfb-hret: hierarchical residual-envelope trust crate for grouped multi-sensor fusion under shared disturbances workspace path: crates/dsfb-hret local README: crates/dsfb-hret/README.md crates.io: https://crates.io/crates/dsfb-hret docs.rs: https://docs.rs/dsfb-hret
  • dsfb-lcss-hret: standalone high-rate estimation trust analysis benchmarking crate workspace path: crates/dsfb-lcss-hret local README: crates/dsfb-lcss-hret/README.md isolated crate (not part of workspace) - compiles independently
  • dsfb-srd: deterministic Structural Regime Dynamics phase-transition demonstrator for trust-gated causal graphs workspace path: crates/dsfb-srd local README: crates/dsfb-srd/README.md isolated crate (not part of workspace) - compiles independently
  • dsfb-starship: Starship high-fidelity 6-DoF re-entry simulation + DSFB trust-adaptive fusion demo workspace path: crates/dsfb-starship local README: crates/dsfb-starship/README.md publish-ready (not yet published)

Observer-theoretic framework for slew-aware trust-adaptive oscillatory state estimation under bounded disturbances.

Overview

DSFB is a state estimation algorithm that tracks position (φ), velocity/drift (ω), and acceleration/slew (α) across multiple measurement channels with adaptive trust weighting. The algorithm dynamically adjusts trust weights for each channel based on exponential moving averages (EMA) of residuals, making it robust to impulse disturbances and measurement anomalies.

Key Features

  • Trust-adaptive fusion: Automatically down-weights unreliable measurement channels
  • Drift-slew dynamics: Tracks position, velocity (drift), and acceleration (slew)
  • O(M) complexity: Efficient per-step computation for M channels
  • Deterministic: Reproducible results with seed control
  • Pure Rust: No external C dependencies

Algorithm

The DSFB algorithm operates in discrete time with the following steps:

Predict

φ⁻ = φ + ω·dt
ω⁻ = ω + α·dt
α⁻ = α

Update Trust Weights

rₖ = yₖ - h(φ⁻)              # Residuals
sₖ = ρ·sₖ + (1-ρ)·|rₖ|       # EMA residuals
w̃ₖ = 1 / (σ₀ + sₖ)           # Raw trust weights
wₖ = w̃ₖ / Σⱼw̃ⱼ              # Normalized weights

Correct

R = Σₖ wₖ·rₖ                 # Aggregate residual
φ = φ⁻ + k_φ·R
ω = ω⁻ + k_ω·R
α = α⁻ + k_α·R

Installation

From crates.io:

[dependencies]
dsfb = "0.1.1"

To track unreleased changes, use Git:

[dependencies]
dsfb = { git = "https://github.com/infinityabundance/dsfb", branch = "main" }

Or install from source:

git clone https://github.com/infinityabundance/dsfb
cd dsfb
cargo build --release -p dsfb

Usage

Basic Example

use dsfb::{DsfbObserver, DsfbParams, DsfbState};

// Configure parameters
let params = DsfbParams::new(
    0.5,  // k_phi: position gain
    0.1,  // k_omega: velocity gain
    0.01, // k_alpha: acceleration gain
    0.95, // rho: EMA smoothing (0 < ρ < 1)
    0.1,  // sigma0: trust softness
);

// Create observer with 2 channels
let mut observer = DsfbObserver::new(params, 2);

// Initialize state
observer.init(DsfbState::new(0.0, 0.5, 0.0));

// Process measurements
let dt = 0.01;
let measurements = vec![1.0, 1.05];
let state = observer.step(&measurements, dt);

println!("φ={}, ω={}, α={}", state.phi, state.omega, state.alpha);

// Check trust weights
let w0 = observer.trust_weight(0);
let w1 = observer.trust_weight(1);
println!("Trust weights: {}, {}", w0, w1);

Running the Simulation

The repository includes a complete simulation harness that demonstrates DSFB performance against baseline methods:

# Run simulation and generate CSV output
cargo run --release -p dsfb --example drift_impulse

# Output will be written to: output-dsfb/<timestamp>/sim-dsfb.csv

The simulation compares three methods:

  1. Mean Fusion: Simple average of measurements
  2. Freq-Only Observer: Observer without acceleration state
  3. DSFB Observer: Full drift-slew fusion with trust adaptation

Simulation scenario:

  • Two measurement channels
  • Channel 2 has linear drift and impulse disturbance
  • Impulse occurs at t=3.0s for 1.0s duration
  • Metrics: RMS error, peak error during impulse, recovery time

Fusion Benchmark Crate (Separate Artifact)

For the separate fusion diagnostics benchmarking artifact, use dsfb-fusion-bench:

cargo run --release -p dsfb-fusion-bench -- --run-default
cargo run --release -p dsfb-fusion-bench -- --run-sweep

Outputs are written under:

  • output-dsfb-fusion-bench/<timestamp>/ (from workspace root by default)
  • includes summary.csv, heatmap.csv, trajectories.csv, and sim-dsfb-fusion-bench.csv

Companion notebook for figures:

  • crates/dsfb-fusion-bench/dsfb_fusion_figures.ipynb

High-Rate Estimation Trust Crate (Separate Artifact)

For the high-rate estimation trust analysis, use the standalone dsfb-lcss-hret crate:

# Run default benchmark configuration
cargo run --release --manifest-path crates/dsfb-lcss-hret/Cargo.toml -- --run-default

# Run parameter sweep
cargo run --release --manifest-path crates/dsfb-lcss-hret/Cargo.toml -- --run-sweep

# Customize parameters
cargo run --release --manifest-path crates/dsfb-lcss-hret/Cargo.toml -- \
  --run-default \
  --num-runs 500 \
  --time-steps 2000 \
  --seed 123

Outputs are written under:

  • output-dsfb-lcss-hret/<timestamp>/ (timestamped directories)
  • includes summary.csv, trajectories.csv, and heatmap.csv

Companion notebook for dsfb-lcss-hret figures:

  • crates/dsfb-lcss-hret/dsfb_lcss_hret_figures.ipynb

Note: This crate is intentionally isolated (not part of the workspace) and compiles independently.

Paper Verification Workflow

For a single-command run that builds the example, writes the simulation CSV, computes metrics from CSV, and generates plots:

./scripts/run_drift_impulse_verify.sh

This produces:

  • output-dsfb/<timestamp>/sim-dsfb.csv
  • output-dsfb/<timestamp>/analysis/metrics.json
  • output-dsfb/<timestamp>/analysis/metrics_summary.csv
  • output-dsfb/<timestamp>/analysis/phi_estimates.png
  • output-dsfb/<timestamp>/analysis/estimation_errors.png
  • output-dsfb/<timestamp>/analysis/trust_weight_and_ema.png

Recovery time is computed as steps after the impulse window until error stays below a near-baseline threshold for hold_steps consecutive samples. The threshold is:

  • baseline_rms * baseline_factor + baseline_margin
  • baseline_rms is RMS error before the impulse start

You can tune this definition:

./scripts/run_drift_impulse_verify.sh \
  --hold-steps 10 \
  --baseline-factor 1.10 \
  --baseline-margin 0.005

To verify against values reported in your paper, pass expected metrics and tolerance:

./scripts/run_drift_impulse_verify.sh \
  --expect-rms-mean <value> \
  --expect-rms-freqonly <value> \
  --expect-rms-dsfb <value> \
  --expect-peak-mean <value> \
  --expect-peak-freqonly <value> \
  --expect-peak-dsfb <value> \
  --expect-recovery-mean <value> \
  --expect-recovery-freqonly <value> \
  --expect-recovery-dsfb <value> \
  --tolerance 1e-3

Visualizing Results

Use the Jupyter notebook to visualize simulation results:

# First, run the simulation to generate data
cargo run --release -p dsfb --example drift_impulse

# Then open the notebook
jupyter notebook crates/dsfb/dsfb_simulation.ipynb

Or use Google Colab: DSFB Simulation Notebook: Open In Colab

Fusion Bench Figures Notebook: Open In Colab

High-Rate Estimation Trust Figures Notebook: Open In Colab

Starship High-Fidelity 6-DoF Re-Entry Notebook: Open In Colab

In Google Colab, click Run all first. If a notebook asks for CSV files, click Browse in the file picker and upload the required CSVs from your local machine.

The notebook displays:

  • Position estimates vs ground truth
  • Error curves for all methods
  • Trust weight adaptation over time
  • EMA residual tracking
  • Performance metrics table

API Reference

DsfbState

State vector for the observer:

  • phi: f64 - Position/phase
  • omega: f64 - Velocity/frequency (drift)
  • alpha: f64 - Acceleration/slew

DsfbParams

Algorithm parameters:

  • k_phi: f64 - Position correction gain
  • k_omega: f64 - Velocity correction gain
  • k_alpha: f64 - Acceleration correction gain
  • rho: f64 - EMA smoothing factor (0 < ρ < 1, typical: 0.95)
  • sigma0: f64 - Trust softness parameter (typical: 0.1)

DsfbObserver

Main observer struct:

  • new(params: DsfbParams, channels: usize) -> Self - Create observer
  • init(&mut self, initial_state: DsfbState) - Set initial state
  • step(&mut self, measurements: &[f64], dt: f64) -> DsfbState - Process one time step
  • state(&self) -> DsfbState - Get current state
  • trust_weight(&self, channel: usize) -> f64 - Get trust weight for channel
  • ema_residual(&self, channel: usize) -> f64 - Get EMA residual for channel

Testing

# Run unit tests
cargo test -p dsfb

# Run with verbose output
cargo test -p dsfb -- --nocapture

# Run specific test
cargo test -p dsfb test_observer_creation

Release Checklist

Before publishing a new version to crates.io:

# Verify package contents
cargo package --list -p dsfb

# Verify publishability without uploading
cargo publish --dry-run -p dsfb

Then tag and publish explicitly:

# Optional: tag release
git tag v0.1.0
git push origin v0.1.0

# Publish (intentional/manual step)
cargo publish -p dsfb

Performance

  • Time complexity: O(M) per step for M channels
  • Space complexity: O(M) for channel statistics
  • Deterministic: Given fixed seed, produces identical results

License

Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

References

For theoretical background, see:

Repository Structure

dsfb/
├── Cargo.toml                      # Workspace configuration (dsfb, dsfb-fusion-bench, dsfb-starship, dsfb-hret, dsfb-ddmf)
├── Cargo.lock
├── crates/
│   ├── dsfb/                       # Core DSFB estimator crate
│   │   ├── Cargo.toml
│   │   ├── src/                    # Observer, params, state, trust logic
│   │   └── examples/               # Drift/impulse example programs
│   ├── dsfb-ddmf/                  # Deterministic disturbance modeling + Monte Carlo sweeps
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── src/                    # Envelope, disturbances, sim, Monte Carlo, CLI
│   │   ├── dsfb_ddmf_colab.ipynb   # DDMF Colab notebook
│   │   └── dsfb_ddmf_colab.py      # Notebook source script
│   ├── dsfb-fusion-bench/          # Fusion diagnostics benchmark crate
│   │   ├── Cargo.toml
│   │   ├── configs/                # Reproducible run configs
│   │   ├── src/                    # Simulation + metrics + CLI
│   │   └── dsfb_fusion_figures.ipynb
│   ├── dsfb-hret/                  # Hierarchical residual-envelope trust crate
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── src/                    # HRET API + tests
│   │   └── hret_hypersonic_validation.ipynb
│   ├── dsfb-lcss-hret/             # Standalone high-rate estimation trust benchmark
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   ├── src/                    # CLI + experiment logic
│   │   ├── dsfb_lcss_hret_figures.ipynb
│   │   └── dsfb-lcss-hret-correlated.ipynb
│   └── dsfb-starship/              # Starship 6-DoF re-entry + DSFB demo
│       ├── Cargo.toml
│       ├── README.md
│       ├── src/                    # Dynamics, estimators, CLI
│       └── starship_reentry_demo.ipynb
├── .github/
│   └── workflows/
│       └── ci.yml                  # Workspace CI
├── docs/                           # Reference papers and extra notes
├── scripts/                        # Plotting and verification helpers
├── output-dsfb-ddmf/               # DDMF run outputs (generated at runtime)
├── output-dsfb-lcss-hret/          # LCSS-HRET run outputs (generated at runtime)
├── README.md                       # Top-level overview + Colab links
├── LICENSE
└── CITATION.cff

About

Drift–Slew Fusion Bootstrap (DSFB)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors