sage.core.graph
Sage pipeline building blocks.
- Preprocessor
Sequential chain of preprocessing modules (whitening, multirate, etc.). Passes data through each module in order. Modules may accept and return either raw tensors (legacy) or
GWBatchobjects —nn.Sequentialis type-agnostic, so the chain works in both cases transparently.- TorchChoice
Probabilistic per-sample module selection. Useful for augmentation or domain randomisation.
Classes
Sequential preprocessing pipeline for gravitational-wave data. |
|
Choose one module per sample according to provided probabilities. |
Module Contents
- class Preprocessor(modules)[source]
Bases:
torch.nn.ModuleSequential preprocessing pipeline for gravitational-wave data.
Chains an ordered list of
nn.Moduletransforms. Each module receives the output of the previous one. A typical pipeline for TD training is:Preprocessor([FiducialWhitening(), MultirateSampler(...)])
and for FD_COARSE (worst-case multibanding):
Preprocessor([FiducialWhitening()])
The pipeline is grid-aware when modules return
GWBatchobjects (which is the default for updated modules). The training loop is responsible for wrapping the combined signal+noise tensor in a GWBatch before calling this module, and for extractingbatch.to_network_input()afterward.- Parameters:
modules (list of nn.Module) – Ordered preprocessing steps.
state (Initialize internal Module)
ScriptModule. (shared by both nn.Module and)
- forward(x)[source]
Run the full preprocessing pipeline.
- Parameters:
x (torch.Tensor or GWBatch) – Input data. Shape and type depend on the first module.
- Returns:
Preprocessed data. Type matches whatever the last module returns.
- Return type:
- class TorchChoice(modules, probabilities)[source]
Bases:
torch.nn.ModuleChoose one module per sample according to provided probabilities.
Useful for data augmentation that should apply different transforms to different samples within a batch.
- Parameters: