Skip to content

Conversation

@preshanth
Copy link
Owner

The goal here is more more general RFI generation code into rfi toolbox and it has been done. I think this branch is good to go into main. Once tested.

  SAM-RFI now depends on rfi_toolbox for shared utilities.

  ## Changes

  **src/samrfi/data/__init__.py**:
  - Forward import MSLoader, Preprocessor, GPUPreprocessor from rfi_toolbox
  - Forward import TorchDataset, BatchWriter from rfi_toolbox.datasets
  - Keep SAM2-specific modules (SAMDataset, AdaptivePatcher, GPU utilities)

  **src/samrfi/evaluation/__init__.py**:
  - Forward import all metrics from rfi_toolbox.evaluation
  - Forward import inject_synthetic_data from rfi_toolbox.io
  - All core metrics now shared via rfi_toolbox

  **src/samrfi/data_generation/__init__.py**:
  - Forward import SyntheticDataGenerator from rfi_toolbox
  - Keep MSDataGenerator (SAM2-specific)

  **pyproject.toml**:
  - Added note about rfi_toolbox dependency

  ## Testing

  ✓ All imports work: MSLoader, Preprocessor, metrics, SyntheticDataGenerator
  ✓ Backward compatibility maintained via forward imports
  ✓ No breaking changes for existing SAM-RFI code

  ## Status

  - rfi_toolbox: Phases 1-3 complete (commit 6d8d29f)
  - SAM-RFI: Phase 4 complete (this commit)
@preshanth preshanth requested a review from Kitchi December 31, 2025 09:10
… rfi_toolbox

- Removes circular import issues by not loading rfi_toolbox at samrfi import time
- Tests that don't need rfi_toolbox (e.g., test_errors.py) won't trigger its initialization
- Updated all imports to use rfi_toolbox directly:
  - from rfi_toolbox.preprocessing import Preprocessor
  - from rfi_toolbox.datasets import BatchWriter, TorchDataset
  - from rfi_toolbox.io import MSLoader
- Clearer separation of SAM-specific vs shared utilities
- Same fix as previous commit - remove rfi_toolbox re-exports
- Import directly: from rfi_toolbox.data_generation import SyntheticDataGenerator
- Prevents rfi_toolbox initialization when importing samrfi
…ke tests

- Removed all rfi_toolbox.evaluation re-exports from samrfi.evaluation
- Updated test imports to use rfi_toolbox.evaluation directly
- Added comprehensive import smoke tests (test_aaa_imports.py) that:
  - Run first to catch import issues early
  - Verify samrfi imports don't trigger rfi_toolbox initialization
  - Test rfi_toolbox imports work without circular dependencies
  - Verify import order independence
  - Provide clear error messages for debugging

This completes the removal of all rfi_toolbox re-exports from samrfi.
@preshanth preshanth merged commit 6a105d8 into main Jan 1, 2026
5 of 8 checks passed
@preshanth preshanth deleted the rfi-toolbox branch January 1, 2026 06:46
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